mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 17:06:16 -04:00
bin: Create and use new logging functions
These write errors to stderr and avoid unintentional backslash escape processing in their arguments.
This commit is contained in:
parent
a87a9bb63b
commit
5462d2109c
4 changed files with 49 additions and 54 deletions
|
@ -1,5 +1,9 @@
|
|||
#!/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
|
||||
|
@ -11,27 +15,18 @@ if [ -d "../bin" ]; then
|
|||
fi
|
||||
|
||||
# Is wget installed?
|
||||
is_cmd wget || {
|
||||
echo "Please install wget" >&2
|
||||
exit 1
|
||||
}
|
||||
is_cmd wget || fatal "Please install wget"
|
||||
|
||||
# Is zip installed?
|
||||
is_cmd zip || {
|
||||
echo "Please install zip" >&2
|
||||
exit 1
|
||||
}
|
||||
is_cmd zip || fatal "Please install zip"
|
||||
|
||||
# Is zip installed?
|
||||
is_cmd unzip || {
|
||||
echo "Please install unzip" >&2
|
||||
exit 1
|
||||
}
|
||||
is_cmd unzip || fatal "Please install unzip"
|
||||
|
||||
START_FOLDER=$(pwd);
|
||||
TMP_FOLDER=$(mktemp -d)
|
||||
|
||||
echo "create a clean environment in $TMP_FOLDER..."
|
||||
log "create a clean environment in $TMP_FOLDER..."
|
||||
cp -ar . $TMP_FOLDER
|
||||
cd $TMP_FOLDER
|
||||
rm -rf node_modules
|
||||
|
@ -41,33 +36,33 @@ rm -f etherpad-lite-win.zip
|
|||
# making the windows package smaller
|
||||
export NODE_ENV=production
|
||||
|
||||
echo "do a normal unix install first..."
|
||||
log "do a normal unix install first..."
|
||||
bin/installDeps.sh || exit 1
|
||||
|
||||
echo "copy the windows settings template..."
|
||||
log "copy the windows settings template..."
|
||||
cp settings.json.template settings.json
|
||||
|
||||
echo "resolve symbolic links..."
|
||||
log "resolve symbolic links..."
|
||||
cp -rL node_modules node_modules_resolved
|
||||
rm -rf node_modules
|
||||
mv node_modules_resolved node_modules
|
||||
|
||||
echo "download windows node..."
|
||||
log "download windows node..."
|
||||
cd bin
|
||||
wget "https://nodejs.org/dist/latest-erbium/win-x86/node.exe" -O ../node.exe
|
||||
|
||||
echo "remove git history to reduce folder size"
|
||||
log "remove git history to reduce folder size"
|
||||
rm -rf .git/objects
|
||||
|
||||
echo "remove windows jsdom-nocontextify/test folder"
|
||||
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 "create the zip..."
|
||||
log "create the zip..."
|
||||
cd $TMP_FOLDER
|
||||
zip -9 -r $START_FOLDER/etherpad-lite-win.zip ./*
|
||||
|
||||
echo "clean up..."
|
||||
log "clean up..."
|
||||
rm -rf $TMP_FOLDER
|
||||
|
||||
echo "Finished. You can find the zip in the Etherpad root folder, it's called etherpad-lite-win.zip"
|
||||
log "Finished. You can find the zip in the Etherpad root folder, it's called etherpad-lite-win.zip"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue