pad.pub0.org/bin/buildForWindows.sh

74 lines
1.8 KiB
Bash
Raw Normal View History

2011-08-11 21:00:52 +00:00
#!/bin/sh
is_cmd() { command -v "$@" >/dev/null 2>&1; }
2020-05-14 21:25:51 +00:00
# Move to the folder where ep-lite is installed
cd $(dirname $0)
2011-08-11 21:00:52 +00:00
2020-05-14 21:25:51 +00:00
# Was this script started in the bin folder? if yes move out
2011-08-11 21:00:52 +00:00
if [ -d "../bin" ]; then
cd "../"
fi
2020-05-14 21:25:51 +00:00
# Is wget installed?
is_cmd wget || {
2011-08-11 21:00:52 +00:00
echo "Please install wget" >&2
exit 1
2011-08-11 21:00:52 +00:00
}
2020-05-14 21:25:51 +00:00
# Is zip installed?
is_cmd zip || {
2011-08-11 21:00:52 +00:00
echo "Please install zip" >&2
exit 1
2011-08-11 21:00:52 +00:00
}
2020-05-14 21:25:51 +00:00
# Is zip installed?
is_cmd unzip || {
2011-08-11 21:00:52 +00:00
echo "Please install unzip" >&2
exit 1
2011-08-11 21:00:52 +00:00
}
START_FOLDER=$(pwd);
TMP_FOLDER=$(mktemp -d)
2011-08-11 21:00:52 +00:00
echo "create a clean environment in $TMP_FOLDER..."
cp -ar . $TMP_FOLDER
cd $TMP_FOLDER
2011-08-11 21:00:52 +00:00
rm -rf node_modules
rm -f etherpad-lite-win.zip
# setting NODE_ENV=production ensures that dev dependencies are not installed,
# making the windows package smaller
export NODE_ENV=production
echo "do a normal unix install first..."
2011-08-11 21:00:52 +00:00
bin/installDeps.sh || exit 1
echo "copy the windows settings template..."
cp settings.json.template settings.json
2011-08-11 21:00:52 +00:00
echo "resolve symbolic links..."
2011-08-11 21:00:52 +00:00
cp -rL node_modules node_modules_resolved
rm -rf node_modules
mv node_modules_resolved node_modules
echo "download windows node..."
2011-08-11 21:00:52 +00:00
cd bin
wget "https://nodejs.org/dist/latest-erbium/win-x86/node.exe" -O ../node.exe
2011-08-11 21:00:52 +00:00
echo "remove git history to reduce folder size"
rm -rf .git/objects
echo "remove windows jsdom-nocontextify/test folder"
rm -rf $TMP_FOLDER/src/node_modules/wd/node_modules/request/node_modules/form-data/node_modules/combined-stream/test
rm -rf $TMP_FOLDER/src/node_modules/nodemailer/node_modules/mailcomposer/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/encodings/tables
echo "create the zip..."
cd $TMP_FOLDER
zip -9 -r $START_FOLDER/etherpad-lite-win.zip ./*
2011-08-11 21:00:52 +00:00
echo "clean up..."
rm -rf $TMP_FOLDER
2011-08-11 21:00:52 +00:00
echo "Finished. You can find the zip in the Etherpad root folder, it's called etherpad-lite-win.zip"