--- misc/xoa-installer/xoa-installer.sh 2016/09/29 12:41:32 3120 +++ misc/xoa-installer/xoa-installer.sh 2016/12/22 13:00:49 3181 @@ -10,6 +10,14 @@ BRANCH=stable +################################### +# Exit bash if a command fails +set -e +# also exit if a part of a pipe fails +set -o pipefail + + + function restartxo { killall -9 node rm -f /root/forever.log @@ -21,6 +29,15 @@ exit fi + +phymem=$(free -m|awk '/^Mem:/{print $2}') +swapmem=$(free -m|awk '/^Swap:/{print $2}') +total=$(expr $phymem + $swapmem) +if [ $total -le 1536 ] ; then + echo not enough memory: $total + exit +fi + if [ "$1" == "clean" ] ; then echo cleaning xo-web rm -rf xo-web @@ -104,7 +121,7 @@ if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then echo "installing bcrypt" - npm install -g bcrypt || exit + npm install -g --unsafe-perm bcrypt || exit fi if [ ! -d "xo-web" ] ; then @@ -134,7 +151,7 @@ # xo-server echo "building xo-server" cd xo-server - npm install || exit + npm install --unsafe-perm || exit npm run build || exit #for some reasone leveldown fails occasionally on arm/raspberry pi @@ -183,6 +200,14 @@ exit fi +echo Installing plugins +npm install --global xo-server-transport-email +npm install --global xo-server-transport-xmpp +npm install --global xo-server-backup-reports + +#npm install --save xo-server-usage-report + + #restartxo