Revert "scripts: Various shell script cleanups (#4008)"

This reverts commit fba4fd5314.

The series of commits I made for PR #4008 were squashed into a single
commit and rebased. Somewhere along the way a mistake was made in a
merge conflict resolution, resulting in some bad code in
`bin/buildForWindows.sh`. This commit reverts the bad squashed commit.
This commit is contained in:
Richard Hansen 2020-06-01 22:45:11 -04:00
parent 02af7d0c2d
commit 9ffb2ccfb0
5 changed files with 132 additions and 129 deletions

View file

@ -1,23 +1,5 @@
#!/bin/sh
pecho() { printf %s\\n "$*"; }
log() { pecho "$@"; }
error() { log "ERROR: $@" >&2; }
fatal() { error "$@"; exit 1; }
is_cmd() { command -v "$@" >/dev/null 2>&1; }
# Move to the folder where ep-lite is installed
cd "$(dirname "$0")"/..
# Is wget installed?
is_cmd wget || fatal "Please install wget"
# Is zip installed?
is_cmd zip || fatal "Please install zip"
# Is zip installed?
is_cmd unzip || fatal "Please install unzip"
=======
#Move to the folder where ep-lite is installed
cd $(dirname $0)
@ -47,9 +29,9 @@ hash unzip > /dev/null 2>&1 || {
START_FOLDER=$(pwd);
TMP_FOLDER=$(mktemp -d)
log "create a clean environment in $TMP_FOLDER..."
cp -ar . "$TMP_FOLDER"
cd "$TMP_FOLDER"
echo "create a clean environment in $TMP_FOLDER..."
cp -ar . $TMP_FOLDER
cd $TMP_FOLDER
rm -rf node_modules
rm -f etherpad-lite-win.zip
@ -57,33 +39,33 @@ rm -f etherpad-lite-win.zip
# making the windows package smaller
export NODE_ENV=production
log "do a normal unix install first..."
echo "do a normal unix install first..."
bin/installDeps.sh || exit 1
log "copy the windows settings template..."
echo "copy the windows settings template..."
cp settings.json.template settings.json
log "resolve symbolic links..."
echo "resolve symbolic links..."
cp -rL node_modules node_modules_resolved
rm -rf node_modules
mv node_modules_resolved node_modules
log "download windows node..."
echo "download windows node..."
cd bin
wget "https://nodejs.org/dist/latest-erbium/win-x86/node.exe" -O ../node.exe
log "remove git history to reduce folder size"
echo "remove git history to reduce folder size"
rm -rf .git/objects
log "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 "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
log "create the zip..."
cd "$TMP_FOLDER"
zip -9 -r "$START_FOLDER"/etherpad-lite-win.zip ./*
echo "create the zip..."
cd $TMP_FOLDER
zip -9 -r $START_FOLDER/etherpad-lite-win.zip ./*
log "clean up..."
rm -rf "$TMP_FOLDER"
echo "clean up..."
rm -rf $TMP_FOLDER
log "Finished. You can find the zip in the Etherpad root folder, it's called etherpad-lite-win.zip"
echo "Finished. You can find the zip in the Etherpad root folder, it's called etherpad-lite-win.zip"