R2PM_BEGIN

R2PM_GIT "https://github.com/jpenalbae/r2-scripts"
R2PM_DESC "[r2-r2pipe-node] RetDec Decompiler script"

BINDIR="${R2PM_PLUGDIR}/../bin"

R2PM_INSTALL() {
	cd decompiler
	node --version || exit 1
	npm install || exit 1
	mkdir -p "${BINDIR}"
	echo '#!/bin/sh' > "${BINDIR}/retdec"
	echo "exec node '`pwd`'"'/decompile.js $*' >> "${BINDIR}/retdec"
	chmod +x "${BINDIR}"/retdec
}

R2PM_UNINSTALL() {
	rm -f "${BINDIR}"/retdec
}

R2PM_END
