diff --git a/bin/generateJsDoc.sh b/bin/generateJsDoc.sh index c9424b74..cf876278 100755 --- a/bin/generateJsDoc.sh +++ b/bin/generateJsDoc.sh @@ -1,15 +1,15 @@ -#!/bin/bash +#!/bin/sh if [ -d "../bin" ]; then cd "../" fi -type -P node &>/dev/null || { +hash node > /dev/null 2>&1 || { echo "You need to install node!" >&2 exit 1 } -type -P doc.md &>/dev/null || { +hash doc.md > /dev/null 2>&1 || { echo "You need to install doc.md! npm install -g doc.md" >&2 exit 1 } diff --git a/bin/run.sh b/bin/run.sh index 0b72dc3f..3256d0fd 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh #Move to the folder where ep-lite is installed FOLDER=$(dirname $(readlink -f $0)) @@ -10,20 +10,20 @@ if [ -d "../bin" ]; then fi #Stop the script if its started as root -if [[ $EUID -eq 0 ]]; then +if [ "$(id -u)" -eq 0 ]; then echo "You shouldn't start Etherpad-Lite as root!" 1>&2 echo "Use authbind if you want to use a port lower than 1024 -> http://en.wikipedia.org/wiki/Authbind" 1>&2 exit 1 fi #Is node installed? -type -P node &>/dev/null || { +hash node > /dev/null 2>&1 || { echo "You need to install node to run Etherpad-Lite!" >&2 exit 1 } #Is npm installed? -type -P npm &>/dev/null || { +hash npm > /dev/null 2>&1 || { echo "You need to install npm to run Etherpad-Lite!" >&2 exit 1 } @@ -43,12 +43,12 @@ NEEDED_VERSION="1.6.2" if [ -f "static/js/jquery.min.js" ]; then VERSION=$(cat static/js/jquery.min.js | head -n 2 | tail -n 1 | grep -o "v[0-9]*\.[0-9]*\.[0-9]*"); - if [[ ${VERSION:1} = $NEEDED_VERSION ]]; then + if [ ${VERSION#v} = $NEEDED_VERSION ]; then DOWNLOAD_JQUERY="false" fi fi -if [[ $DOWNLOAD_JQUERY = "true" ]]; then +if [ $DOWNLOAD_JQUERY = "true" ]; then wget -O static/js/jquery.min.js http://code.jquery.com/jquery-$NEEDED_VERSION.min.js fi diff --git a/bin/runDebug.sh b/bin/runDebug.sh index 46eec8e8..041edbb6 100755 --- a/bin/runDebug.sh +++ b/bin/runDebug.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh -type -P node-inspector &>/dev/null || { +hash node-inspector > /dev/null 2>&1 || { echo "You need to install node-inspector to run the tests!" >&2 echo "You can install it with npm" >&2 echo "Run: npm install node-inspector" >&2 diff --git a/bin/runSafe.sh b/bin/runSafe.sh index 180de1fe..d7d2b99c 100755 --- a/bin/runSafe.sh +++ b/bin/runSafe.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh #This script ensures that ep-lite is automatically restarting after an error happens @@ -49,12 +49,12 @@ do bin/run.sh >>$1 2>>$1 #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 - echo -e "Server was restared at: $(date)\nThe last 50 lines of the log before the error happens:\n $(tail -n 50 $1)" | mail -s "Pad Server was restarted" $EMAIL_ADDRESS + printf "Server was restared at: $(date)\nThe last 50 lines of the log before the error happens:\n $(tail -n 50 $1)" | mail -s "Pad Server was restarted" $EMAIL_ADDRESS LAST_EMAIL_SEND=$TIME_NOW fi diff --git a/bin/runTests.sh b/bin/runTests.sh index f22004e3..aa36dbba 100755 --- a/bin/runTests.sh +++ b/bin/runTests.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh -type -P nodeunit &>/dev/null || { +hash nodeunit > /dev/null 2>&1 || { echo "You need to install Nodeunit to run the tests!" >&2 echo "You can install it with npm" >&2 echo "Run: npm install nodeunit" >&2