mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 16:36:15 -04:00
Windows build: Improve error handling
This commit is contained in:
parent
f19f3833f3
commit
05e54b198f
1 changed files with 21 additions and 19 deletions
|
@ -6,10 +6,12 @@ pecho() { printf %s\\n "$*"; }
|
||||||
log() { pecho "$@"; }
|
log() { pecho "$@"; }
|
||||||
error() { log "ERROR: $@" >&2; }
|
error() { log "ERROR: $@" >&2; }
|
||||||
fatal() { error "$@"; exit 1; }
|
fatal() { error "$@"; exit 1; }
|
||||||
|
try() { "$@" || fatal "'$@' failed"; }
|
||||||
is_cmd() { command -v "$@" >/dev/null 2>&1; }
|
is_cmd() { command -v "$@" >/dev/null 2>&1; }
|
||||||
|
|
||||||
# Move to the folder where ep-lite is installed
|
# Move to the folder where ep-lite is installed
|
||||||
cd "$(cd "${0%/*}" && pwd -P)/../.."
|
mydir=$(try cd "${0%/*}" && try pwd -P) || exit 1
|
||||||
|
try cd "${mydir}/../.."
|
||||||
|
|
||||||
# Is wget installed?
|
# Is wget installed?
|
||||||
is_cmd wget || fatal "Please install wget"
|
is_cmd wget || fatal "Please install wget"
|
||||||
|
@ -20,45 +22,45 @@ is_cmd zip || fatal "Please install zip"
|
||||||
# Is zip installed?
|
# Is zip installed?
|
||||||
is_cmd unzip || fatal "Please install unzip"
|
is_cmd unzip || fatal "Please install unzip"
|
||||||
|
|
||||||
START_FOLDER=$(pwd);
|
START_FOLDER=$(try pwd) || exit 1
|
||||||
TMP_FOLDER=$(mktemp -d)
|
TMP_FOLDER=$(try mktemp -d) || exit 1
|
||||||
|
|
||||||
log "create a clean environment in $TMP_FOLDER..."
|
log "create a clean environment in $TMP_FOLDER..."
|
||||||
cp -ar . "$TMP_FOLDER"
|
try cp -ar . "$TMP_FOLDER"
|
||||||
cd "$TMP_FOLDER"
|
try cd "$TMP_FOLDER"
|
||||||
rm -rf node_modules
|
try rm -rf node_modules
|
||||||
rm -f etherpad-lite-win.zip
|
try rm -f etherpad-lite-win.zip
|
||||||
|
|
||||||
# setting NODE_ENV=production ensures that dev dependencies are not installed,
|
# setting NODE_ENV=production ensures that dev dependencies are not installed,
|
||||||
# making the windows package smaller
|
# making the windows package smaller
|
||||||
export NODE_ENV=production
|
export NODE_ENV=production
|
||||||
|
|
||||||
log "do a normal unix install first..."
|
log "do a normal unix install first..."
|
||||||
src/bin/installDeps.sh || exit 1
|
try ./src/bin/installDeps.sh
|
||||||
|
|
||||||
log "copy the windows settings template..."
|
log "copy the windows settings template..."
|
||||||
cp settings.json.template settings.json
|
try cp settings.json.template settings.json
|
||||||
|
|
||||||
log "resolve symbolic links..."
|
log "resolve symbolic links..."
|
||||||
cp -rL node_modules node_modules_resolved
|
try cp -rL node_modules node_modules_resolved
|
||||||
rm -rf node_modules
|
try rm -rf node_modules
|
||||||
mv node_modules_resolved node_modules
|
try mv node_modules_resolved node_modules
|
||||||
|
|
||||||
log "download windows node..."
|
log "download windows node..."
|
||||||
wget "https://nodejs.org/dist/latest-erbium/win-x86/node.exe" -O node.exe
|
try wget "https://nodejs.org/dist/latest-erbium/win-x86/node.exe" -O node.exe
|
||||||
|
|
||||||
log "remove git history to reduce folder size"
|
log "remove git history to reduce folder size"
|
||||||
rm -rf .git/objects
|
try rm -rf .git/objects
|
||||||
|
|
||||||
log "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
|
try 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
|
try 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..."
|
log "create the zip..."
|
||||||
cd "$TMP_FOLDER"
|
try cd "$TMP_FOLDER"
|
||||||
zip -9 -r "$START_FOLDER"/etherpad-lite-win.zip ./* -x var
|
try zip -9 -r "$START_FOLDER"/etherpad-lite-win.zip ./* -x var
|
||||||
|
|
||||||
log "clean up..."
|
log "clean up..."
|
||||||
rm -rf "$TMP_FOLDER"
|
try rm -rf "$TMP_FOLDER"
|
||||||
|
|
||||||
log "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