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" ];
then
#chroot $CHROOT wget -q -O /tmp/setup_nodejs https://deb.nodesource.com/setup_4.x
chroot $CHROOT wget -q -O /tmp/setup_nodejs https://deb.nodesource.com/setup_6.x
chroot $CHROOT bash /tmp/setup_nodejs
chroot $CHROOT apt install -y nodejs
chroot $CHROOT wget https://github.com/tj/n/archive/v4.1.0.tar.gz
chroot $CHROOT tar -xvzf v4.1.0.tar.gz
chroot $CHROOT /bin/bash -c "cd n-4.1.0; make install"
chroot $CHROOT n 10 # We take nodjes version 10 because idk
fi
chroot $CHROOT apt clean
cd $CHROOT
echo "Now creating tarball with the filesystem ..."
tar -czf $INIT_DIR/${DISTRIB}-${ARCH}.tgz ./*
echo ""

View file

@ -9,7 +9,13 @@
if ls -d /build/yunohost-admin* >dev/null 2>&1
then
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 "Patching debian/rules ..."
echo "========================"
@ -44,7 +50,12 @@ EOF
mkdir /nonexistent
chown pbuilder:pbuilder /nonexistent
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 "======================================================"
fi