2017-09-20 21:59:14 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# Dirty hook to npm install, because I have no idea how this
|
|
|
|
# is supposed to be done properly
|
|
|
|
# (no network during the actual build)
|
|
|
|
#
|
|
|
|
|
|
|
|
if ls -d /build/yunohost-admin* >dev/null 2>&1
|
|
|
|
then
|
|
|
|
echo "======================================================"
|
2020-02-12 21:28:58 +01:00
|
|
|
DIST="$(cat /etc/os-release | grep CODENAME= | cut -d = -f 2)"
|
2021-02-05 02:18:01 +01:00
|
|
|
if [ "$DIST" == "stretch" ]
|
2020-02-12 21:28:58 +01:00
|
|
|
then
|
|
|
|
/usr/bin/apt-get install git nodejs -y
|
2017-09-20 21:59:14 +02:00
|
|
|
echo "========================"
|
|
|
|
echo "Patching debian/rules ..."
|
|
|
|
echo "========================"
|
|
|
|
cd /build/yunohost-admin*
|
|
|
|
cat << EOF > rules.patch
|
|
|
|
diff --git a/debian/rules b/debian/rules
|
|
|
|
index b031511..477f27c 100755
|
|
|
|
--- a/debian/rules
|
|
|
|
+++ b/debian/rules
|
|
|
|
@@ -20,12 +20,14 @@ override_dh_auto_build:
|
|
|
|
sed -i 's/VERSION/\$(DEBVERS)/g' src/index.html
|
|
|
|
|
|
|
|
# Run npm/bower/gulp
|
|
|
|
- cd src ; npm --progress false --loglevel warn --color false install
|
|
|
|
+ #cd src ; npm --progress false --loglevel warn --color false install
|
|
|
|
cd src ; node_modules/gulp/bin/gulp.js build
|
|
|
|
+ rm -rf src/node_modules
|
|
|
|
+ rm -rf src/bower_components
|
|
|
|
|
|
|
|
override_dh_clean:
|
|
|
|
dh_clean
|
|
|
|
- rm -rf src/node_modules
|
|
|
|
- rm -rf src/bower_components
|
|
|
|
+ #rm -rf src/node_modules
|
|
|
|
+ #rm -rf src/bower_components
|
|
|
|
rm -rf src/dist
|
|
|
|
EOF
|
|
|
|
patch -p1 < rules.patch
|
2020-05-11 03:33:27 +02:00
|
|
|
fi
|
2020-08-31 16:24:46 +02:00
|
|
|
|
2017-09-20 21:59:14 +02:00
|
|
|
echo "========================"
|
|
|
|
echo "Starting npm install ..."
|
|
|
|
echo "========================"
|
|
|
|
mkdir /nonexistent
|
|
|
|
chown pbuilder:pbuilder /nonexistent
|
2021-01-21 20:40:29 +01:00
|
|
|
cd /build/yunohost-admin*/app
|
2021-02-05 02:18:01 +01:00
|
|
|
if [ "$DIST" == "stretch" ]
|
2020-02-12 21:28:58 +01:00
|
|
|
then
|
|
|
|
su pbuilder -c "npm install"
|
|
|
|
else
|
2020-08-31 16:24:46 +02:00
|
|
|
su pbuilder -c "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin npm ci"
|
2020-02-12 21:28:58 +01:00
|
|
|
fi
|
2017-09-20 21:59:14 +02:00
|
|
|
echo "======================================================"
|
|
|
|
fi
|
|
|
|
|