2011-07-31 18:37:50 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-07-01 19:23:17 +02:00
|
|
|
|
2021-02-05 00:43:27 +01:00
|
|
|
# Move to the Etherpad base directory.
|
|
|
|
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
|
2024-02-21 21:50:11 +01:00
|
|
|
cd "${MY_DIR}/.." || exit 1
|
2011-07-27 15:37:12 +02:00
|
|
|
|
2021-02-03 00:30:07 +01:00
|
|
|
# Source constants and useful functions
|
2024-02-21 21:50:11 +01:00
|
|
|
. bin/functions.sh
|
2020-10-06 14:28:11 +02:00
|
|
|
|
2024-02-11 09:51:42 +01:00
|
|
|
is_cmd pnpm || npm install pnpm -g
|
|
|
|
|
|
|
|
|
2020-06-01 22:02:44 +02:00
|
|
|
# Is node installed?
|
|
|
|
# Not checking io.js, default installation creates a symbolic link to node
|
|
|
|
is_cmd node || fatal "Please install node.js ( https://nodejs.org )"
|
2011-07-27 15:37:12 +02:00
|
|
|
|
2020-06-01 22:02:44 +02:00
|
|
|
# Check node version
|
2021-09-06 01:28:58 +02:00
|
|
|
require_minimal_version "nodejs" "$(get_program_version "node")" \
|
2021-09-06 01:24:17 +02:00
|
|
|
"$REQUIRED_NODE_MAJOR" "$REQUIRED_NODE_MINOR"
|
2012-01-26 12:55:54 +01:00
|
|
|
|
2020-06-01 22:02:44 +02:00
|
|
|
# Get the name of the settings file
|
2012-02-21 20:20:45 +01:00
|
|
|
settings="settings.json"
|
|
|
|
a='';
|
2019-12-01 01:52:32 +01:00
|
|
|
for arg in "$@"; do
|
2012-02-21 20:20:45 +01:00
|
|
|
if [ "$a" = "--settings" ] || [ "$a" = "-s" ]; then settings=$arg; fi
|
|
|
|
a=$arg
|
|
|
|
done
|
|
|
|
|
2020-06-01 22:02:44 +02:00
|
|
|
# Does a $settings exist? if not copy the template
|
|
|
|
if [ ! -f "$settings" ]; then
|
|
|
|
log "Copy the settings template to $settings..."
|
|
|
|
cp settings.json.template "$settings" || exit 1
|
2011-07-27 15:37:12 +02:00
|
|
|
fi
|
|
|
|
|
2021-09-06 01:23:01 +02:00
|
|
|
log "Installing dependencies..."
|
2023-07-01 19:23:17 +02:00
|
|
|
if [ -z "${ETHERPAD_PRODUCTION}" ]; then
|
2024-02-21 21:50:11 +01:00
|
|
|
log "Installing dev dependencies with pnpm"
|
|
|
|
pnpm --recursive i || exit 1
|
2023-07-01 19:23:17 +02:00
|
|
|
else
|
2024-02-21 21:50:11 +01:00
|
|
|
log "Installing production dependencies with pnpm"
|
|
|
|
pnpm --recursive i --production || exit 1
|
2023-07-01 19:23:17 +02:00
|
|
|
fi
|
2011-07-27 15:37:12 +02:00
|
|
|
|
2020-06-01 22:02:44 +02:00
|
|
|
# Remove all minified data to force node creating it new
|
|
|
|
log "Clearing minified cache..."
|
2011-07-27 15:37:12 +02:00
|
|
|
rm -f var/minified*
|
|
|
|
|
|
|
|
exit 0
|