2013-09-17 23:27:52 +02:00
|
|
|
#!/bin/sh
|
2011-05-13 16:52:07 +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-06-04 16:57:39 +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
|
|
|
|
2013-01-06 12:48:32 +01:00
|
|
|
ignoreRoot=0
|
2020-06-01 22:02:44 +02:00
|
|
|
for ARG in "$@"; do
|
2013-09-17 23:27:52 +02:00
|
|
|
if [ "$ARG" = "--root" ]; then
|
2013-01-06 12:48:32 +01:00
|
|
|
ignoreRoot=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2020-06-01 22:02:44 +02:00
|
|
|
# Stop the script if it's started as root
|
|
|
|
if [ "$(id -u)" -eq 0 ] && [ "$ignoreRoot" -eq 0 ]; then
|
|
|
|
cat <<EOF >&2
|
|
|
|
You shouldn't start Etherpad as root!
|
|
|
|
Please type 'Etherpad rocks my socks' (or restart with the '--root'
|
|
|
|
argument) if you still want to start it as root:
|
|
|
|
EOF
|
|
|
|
printf "> " >&2
|
2024-03-26 17:11:24 +01:00
|
|
|
read -r rocks
|
2020-06-01 22:02:44 +02:00
|
|
|
[ "$rocks" = "Etherpad rocks my socks" ] || fatal "Your input was incorrect"
|
2011-04-07 15:51:46 +02:00
|
|
|
fi
|
2011-03-26 14:10:41 +01:00
|
|
|
|
2020-06-01 22:02:44 +02:00
|
|
|
# Prepare the environment
|
2024-02-21 21:50:11 +01:00
|
|
|
bin/installDeps.sh "$@" || exit 1
|
2011-06-02 14:43:34 +02:00
|
|
|
|
2024-03-15 21:36:12 +01:00
|
|
|
|
2024-03-14 16:06:32 +01:00
|
|
|
## Create the admin ui
|
|
|
|
if [ -z "$NODE_ENV" ] || [ "$NODE_ENV" = "development" ]; then
|
2024-03-26 17:11:24 +01:00
|
|
|
ADMIN_UI_PATH="$(dirname "$0")/../admin"
|
|
|
|
UI_PATH="$(dirname "$0")/../ui"
|
2024-03-14 16:06:32 +01:00
|
|
|
log "Creating the admin UI..."
|
2024-03-26 17:11:24 +01:00
|
|
|
(cd "$ADMIN_UI_PATH" && pnpm run build)
|
|
|
|
(cd "$UI_PATH" && pnpm run build)
|
2024-03-14 16:06:32 +01:00
|
|
|
else
|
|
|
|
log "Cannot create the admin UI in production mode"
|
|
|
|
fi
|
|
|
|
|
2020-06-01 22:02:44 +02:00
|
|
|
# Move to the node folder and start
|
|
|
|
log "Starting Etherpad..."
|
2013-11-10 17:32:33 +01:00
|
|
|
|
2024-02-21 21:50:11 +01:00
|
|
|
# cd src
|
2024-07-18 08:51:30 +02:00
|
|
|
exec pnpm run prod "$@"
|