2011-08-11 23:00:52 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-05-13 01:38:18 +02:00
|
|
|
set -e
|
|
|
|
|
2020-05-14 23:28:53 +02:00
|
|
|
pecho() { printf %s\\n "$*"; }
|
|
|
|
log() { pecho "$@"; }
|
|
|
|
error() { log "ERROR: $@" >&2; }
|
|
|
|
fatal() { error "$@"; exit 1; }
|
2022-05-13 01:45:18 +02:00
|
|
|
try() { "$@" || fatal "'$@' failed"; }
|
2020-05-17 17:17:45 +02:00
|
|
|
is_cmd() { command -v "$@" >/dev/null 2>&1; }
|
|
|
|
|
2022-05-13 02:07:43 +02:00
|
|
|
for x in git unzip wget zip; do
|
2022-05-13 02:03:53 +02:00
|
|
|
is_cmd "${x}" || fatal "Please install ${x}"
|
|
|
|
done
|
|
|
|
|
2022-05-13 02:07:43 +02:00
|
|
|
# Move to the folder where Etherpad is checked out
|
|
|
|
try cd "${0%/*}"
|
2022-05-13 02:12:44 +02:00
|
|
|
workdir=$(try git rev-parse --show-toplevel) || exit 1
|
|
|
|
try cd "${workdir}"
|
2022-05-13 02:07:43 +02:00
|
|
|
[ -f src/package.json ] || fatal "failed to cd to etherpad root directory"
|
2011-08-11 23:00:52 +02:00
|
|
|
|
2022-05-13 02:14:45 +02:00
|
|
|
OUTPUT=${workdir}/etherpad-win.zip
|
2022-05-13 02:12:44 +02:00
|
|
|
|
2022-05-13 01:45:18 +02:00
|
|
|
TMP_FOLDER=$(try mktemp -d) || exit 1
|
2011-08-11 23:00:52 +02:00
|
|
|
|
2020-05-14 23:28:53 +02:00
|
|
|
log "create a clean environment in $TMP_FOLDER..."
|
2022-05-13 01:45:18 +02:00
|
|
|
try cp -ar . "$TMP_FOLDER"
|
|
|
|
try cd "$TMP_FOLDER"
|
|
|
|
try rm -rf node_modules
|
2022-05-13 02:14:45 +02:00
|
|
|
try rm -f etherpad-win.zip
|
2011-08-11 23:00:52 +02:00
|
|
|
|
2019-10-20 03:12:39 +02:00
|
|
|
# setting NODE_ENV=production ensures that dev dependencies are not installed,
|
|
|
|
# making the windows package smaller
|
|
|
|
export NODE_ENV=production
|
|
|
|
|
2020-05-14 23:28:53 +02:00
|
|
|
log "do a normal unix install first..."
|
2022-05-13 01:45:18 +02:00
|
|
|
try ./src/bin/installDeps.sh
|
2011-08-11 23:00:52 +02:00
|
|
|
|
2020-05-14 23:28:53 +02:00
|
|
|
log "copy the windows settings template..."
|
2022-05-13 01:45:18 +02:00
|
|
|
try cp settings.json.template settings.json
|
2011-08-11 23:00:52 +02:00
|
|
|
|
2020-05-14 23:28:53 +02:00
|
|
|
log "resolve symbolic links..."
|
2022-05-13 01:45:18 +02:00
|
|
|
try cp -rL node_modules node_modules_resolved
|
|
|
|
try rm -rf node_modules
|
|
|
|
try mv node_modules_resolved node_modules
|
2011-08-11 23:00:52 +02:00
|
|
|
|
2020-05-14 23:28:53 +02:00
|
|
|
log "download windows node..."
|
2022-05-13 01:45:18 +02:00
|
|
|
try wget "https://nodejs.org/dist/latest-erbium/win-x86/node.exe" -O node.exe
|
2011-08-11 23:00:52 +02:00
|
|
|
|
2020-05-14 23:28:53 +02:00
|
|
|
log "remove git history to reduce folder size"
|
2022-05-13 01:45:18 +02:00
|
|
|
try rm -rf .git/objects
|
2012-11-15 15:16:12 +01:00
|
|
|
|
2020-05-14 23:28:53 +02:00
|
|
|
log "remove windows jsdom-nocontextify/test folder"
|
2022-05-13 01:45:18 +02:00
|
|
|
try 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/nodemailer/node_modules/mailcomposer/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/encodings/tables
|
2012-11-16 21:51:08 +01:00
|
|
|
|
2020-05-14 23:28:53 +02:00
|
|
|
log "create the zip..."
|
2022-05-13 01:45:18 +02:00
|
|
|
try cd "$TMP_FOLDER"
|
2022-05-13 02:12:44 +02:00
|
|
|
try zip -9 -r "${OUTPUT}" ./* -x var
|
2011-08-11 23:00:52 +02:00
|
|
|
|
2020-05-14 23:28:53 +02:00
|
|
|
log "clean up..."
|
2022-05-13 01:45:18 +02:00
|
|
|
try rm -rf "$TMP_FOLDER"
|
2011-08-11 23:00:52 +02:00
|
|
|
|
2022-05-13 02:12:44 +02:00
|
|
|
log "Finished. You can find the zip at ${OUTPUT}"
|