bin: Quote expansions that are subject to field splitting
parent
a28b7c7595
commit
57237b8568
|
@ -7,7 +7,7 @@ fatal() { error "$@"; exit 1; }
|
|||
is_cmd() { command -v "$@" >/dev/null 2>&1; }
|
||||
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Was this script started in the bin folder? if yes move out
|
||||
if [ -d "../bin" ]; then
|
||||
|
@ -27,8 +27,8 @@ START_FOLDER=$(pwd);
|
|||
TMP_FOLDER=$(mktemp -d)
|
||||
|
||||
log "create a clean environment in $TMP_FOLDER..."
|
||||
cp -ar . $TMP_FOLDER
|
||||
cd $TMP_FOLDER
|
||||
cp -ar . "$TMP_FOLDER"
|
||||
cd "$TMP_FOLDER"
|
||||
rm -rf node_modules
|
||||
rm -f etherpad-lite-win.zip
|
||||
|
||||
|
@ -55,14 +55,14 @@ log "remove git history to reduce folder size"
|
|||
rm -rf .git/objects
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
log "create the zip..."
|
||||
cd $TMP_FOLDER
|
||||
zip -9 -r $START_FOLDER/etherpad-lite-win.zip ./*
|
||||
cd "$TMP_FOLDER"
|
||||
zip -9 -r "$START_FOLDER"/etherpad-lite-win.zip ./*
|
||||
|
||||
log "clean up..."
|
||||
rm -rf $TMP_FOLDER
|
||||
rm -rf "$TMP_FOLDER"
|
||||
|
||||
log "Finished. You can find the zip in the Etherpad root folder, it's called etherpad-lite-win.zip"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Was this script started in the bin folder? if yes move out
|
||||
if [ -d "../bin" ]; then
|
||||
|
|
|
@ -22,8 +22,8 @@ require_minimal_version() {
|
|||
|
||||
# Flag -s (--only-delimited on GNU cut) ensures no string is returned
|
||||
# when there is no match
|
||||
DETECTED_MAJOR=$(pecho $VERSION_STRING | cut -s -d "." -f 1)
|
||||
DETECTED_MINOR=$(pecho $VERSION_STRING | cut -s -d "." -f 2)
|
||||
DETECTED_MAJOR=$(pecho "$VERSION_STRING" | cut -s -d "." -f 1)
|
||||
DETECTED_MINOR=$(pecho "$VERSION_STRING" | cut -s -d "." -f 2)
|
||||
|
||||
[ -n "$DETECTED_MAJOR" ] || fatal "Cannot extract $PROGRAM_LABEL major version from version string \"$VERSION_STRING\""
|
||||
|
||||
|
@ -45,7 +45,7 @@ require_minimal_version() {
|
|||
}
|
||||
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Was this script started in the bin folder? if yes move out
|
||||
if [ -d "../bin" ]; then
|
||||
|
@ -79,9 +79,9 @@ for arg in "$@"; do
|
|||
done
|
||||
|
||||
# Does a $settings exist? if not copy the template
|
||||
if [ ! -f $settings ]; then
|
||||
if [ ! -f "$settings" ]; then
|
||||
log "Copy the settings template to $settings..."
|
||||
cp settings.json.template $settings || exit 1
|
||||
cp settings.json.template "$settings" || exit 1
|
||||
fi
|
||||
|
||||
log "Ensure that all dependencies are up to date... If this is the first time you have run Etherpad please be patient."
|
||||
|
|
|
@ -6,7 +6,7 @@ error() { log "ERROR: $@" >&2; }
|
|||
fatal() { error "$@"; exit 1; }
|
||||
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Was this script started in the bin folder? if yes move out
|
||||
if [ -d "../bin" ]; then
|
||||
|
@ -22,7 +22,7 @@ do
|
|||
done
|
||||
|
||||
# Stop the script if it's started as root
|
||||
if [ "$(id -u)" -eq 0 ] && [ $ignoreRoot -eq 0 ]; then
|
||||
if [ "$(id -u)" -eq 0 ] && [ "$ignoreRoot" -eq 0 ]; then
|
||||
echo "You shouldn't start Etherpad as root!"
|
||||
echo "Please type 'Etherpad rocks my socks' or supply the '--root' argument if you still want to start it as root"
|
||||
read rocks
|
||||
|
|
|
@ -25,7 +25,7 @@ LAST_EMAIL_SEND=0
|
|||
LOG="$1"
|
||||
|
||||
# Move to the folder where ep-lite is installed
|
||||
cd $(dirname $0)
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Was this script started in the bin folder? if yes move out
|
||||
if [ -d "../bin" ]; then
|
||||
|
@ -39,21 +39,21 @@ shift
|
|||
while [ 1 ]
|
||||
do
|
||||
# Try to touch the file if it doesn't exist
|
||||
[ -f ${LOG} ] || touch ${LOG} || fatal "Logfile '${LOG}' is not writeable"
|
||||
[ -f "${LOG}" ] || touch "${LOG}" || fatal "Logfile '${LOG}' is not writeable"
|
||||
|
||||
# Check if the file is writeable
|
||||
[ -w ${LOG} ] || fatal "Logfile '${LOG}' is not writeable"
|
||||
[ -w "${LOG}" ] || fatal "Logfile '${LOG}' is not writeable"
|
||||
|
||||
# Start the application
|
||||
bin/run.sh $@ >>${LOG} 2>>${LOG}
|
||||
bin/run.sh "$@" >>${LOG} 2>>${LOG}
|
||||
|
||||
# Send email
|
||||
if [ $ERROR_HANDLING = 1 ]; then
|
||||
if [ "$ERROR_HANDLING" = 1 ]; then
|
||||
TIME_NOW=$(date +%s)
|
||||
TIME_SINCE_LAST_SEND=$(($TIME_NOW - $LAST_EMAIL_SEND))
|
||||
|
||||
if [ $TIME_SINCE_LAST_SEND -gt $TIME_BETWEEN_EMAILS ]; then
|
||||
printf "Server was restarted at: $(date)\nThe last 50 lines of the log before the error happens:\n $(tail -n 50 ${LOG})" | mail -s "Pad Server was restarted" $EMAIL_ADDRESS
|
||||
if [ "$TIME_SINCE_LAST_SEND" -gt "$TIME_BETWEEN_EMAILS" ]; then
|
||||
printf "Server was restarted at: $(date)\nThe last 50 lines of the log before the error happens:\n $(tail -n 50 "${LOG}")" | mail -s "Pad Server was restarted" "$EMAIL_ADDRESS"
|
||||
|
||||
LAST_EMAIL_SEND=$TIME_NOW
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue