Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help in packaging nodejs package juice-shop #1144

Closed
knyipab opened this issue Aug 20, 2024 · 1 comment
Closed

Help in packaging nodejs package juice-shop #1144

knyipab opened this issue Aug 20, 2024 · 1 comment

Comments

@knyipab
Copy link
Contributor

knyipab commented Aug 20, 2024

I am trying to package the OWASP Juice Shop (nodejs app). While I am not so sure the right way to package it because it seems to be arch-dependent as the github page mentioned

Each packaged distribution includes some binaries for sqlite3 and libxmljs bound to the OS and node.js version which npm install was executed on.

TUR-on-device seems to be the right way but this package should be in tur-hacking.

Besides, will file produced in the directory $TERMUX_PREFIX/opt/juice-shop during runtime be removed when running pkg uninstall?

I drafted a build script below. As expected, it does not work on my phone after built by ubuntu host. And npm install does not seems to install into any ./node_modules folder at all.

TERMUX_PKG_HOMEPAGE=https://owasp.org/www-project-juice-shop/
TERMUX_PKG_DESCRIPTION="A modern and sophisticated insecure web application. "
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux-user-repository"
TERMUX_PKG_VERSION="17.1.0"
TERMUX_PKG_SRCURL=https://github.com/juice-shop/juice-shop/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=335524444670efbd07d787dbe13072e9eb04105a832d121196febcf83103e50f
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_DEPENDS="nodejs-lts"

termux_step_host_build() {
	termux_setup_nodejs
	npm install
}

termux_step_make_install() {
	local install_prefix="$TERMUX_PREFIX/opt/juice-shop"
	rm -rf "$install_prefix"
	mkdir -p "$install_prefix"
	cp -Rf . $install_prefix/
	cat << EOF > $TERMUX_PREFIX/bin/juice-shop
#!$TERMUX_PREFIX/bin/env sh

cd $install_prefix
npm start

EOF
	chmod +x $TERMUX_PREFIX/bin/juice-shop
}
@knyipab knyipab changed the title Help in packaging nodejs package Help in packaging nodejs package juice-shop Aug 20, 2024
@knyipab
Copy link
Contributor Author

knyipab commented Sep 13, 2024

closed by #1186 using ondevice and disable shebang fix

@knyipab knyipab closed this as completed Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant