yunohost-admin build: Misc tweaks to workaround the weird issue in npm from vanilla debian buster, use nvm instead

This commit is contained in:
Alexandre Aubin 2020-02-12 20:28:58 +00:00
parent 3b1f9ddb4c
commit 98d88aaca0
2 changed files with 18 additions and 6 deletions

View file

@ -35,15 +35,16 @@ function build_image()
if [ "$ARCH" == "amd64" ]; if [ "$ARCH" == "amd64" ];
then then
#chroot $CHROOT wget -q -O /tmp/setup_nodejs https://deb.nodesource.com/setup_4.x chroot $CHROOT wget https://github.com/tj/n/archive/v4.1.0.tar.gz
chroot $CHROOT wget -q -O /tmp/setup_nodejs https://deb.nodesource.com/setup_6.x chroot $CHROOT tar -xvzf v4.1.0.tar.gz
chroot $CHROOT bash /tmp/setup_nodejs chroot $CHROOT /bin/bash -c "cd n-4.1.0; make install"
chroot $CHROOT apt install -y nodejs chroot $CHROOT n 10 # We take nodjes version 10 because idk
fi fi
chroot $CHROOT apt clean chroot $CHROOT apt clean
cd $CHROOT cd $CHROOT
echo "Now creating tarball with the filesystem ..."
tar -czf $INIT_DIR/${DISTRIB}-${ARCH}.tgz ./* tar -czf $INIT_DIR/${DISTRIB}-${ARCH}.tgz ./*
echo "" echo ""

View file

@ -9,7 +9,13 @@
if ls -d /build/yunohost-admin* >dev/null 2>&1 if ls -d /build/yunohost-admin* >dev/null 2>&1
then then
echo "======================================================" echo "======================================================"
/usr/bin/apt-get install git nodejs -y DIST="$(cat /etc/os-release | grep CODENAME= | cut -d = -f 2)"
if [ "$DIST" != "buster" ]
then
/usr/bin/apt-get install git nodejs -y
else
/usr/bin/apt-get install git -y
fi
echo "========================" echo "========================"
echo "Patching debian/rules ..." echo "Patching debian/rules ..."
echo "========================" echo "========================"
@ -44,7 +50,12 @@ EOF
mkdir /nonexistent mkdir /nonexistent
chown pbuilder:pbuilder /nonexistent chown pbuilder:pbuilder /nonexistent
cd /build/yunohost-admin*/src cd /build/yunohost-admin*/src
su pbuilder -c "npm install" if [ "$DIST" != "buster" ]
then
su pbuilder -c "npm install"
else
su pbuilder -c "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin npm install"
fi
echo "======================================================" echo "======================================================"
fi fi