--- misc/xoa-installer/xoa-installer.sh 2016/07/07 10:24:05 3062 +++ 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,10 +29,22 @@ 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 +# echo cleaning xo-web-v4 +# rm -rf xo-web-v4 + echo cleaning xo-server rm -rf xo-server @@ -101,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 @@ -112,6 +132,12 @@ cd .. fi +#if [ ! -d "xo-web-v4" ] ; then +# git clone -b $BRANCH https://github.com/vatesfr/xo-web.git xo-web-v4 +# cd xo-web-v4 +# git checkout tags/v4.16.0 +# cd .. +#fi if [ ! -d "xo-server" ] ; then git clone -b $BRANCH https://github.com/vatesfr/xo-server.git @@ -125,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 @@ -142,10 +168,28 @@ #xo-web echo "building xo-web" cd xo-web - npm install --unsafe-perm || exit + #npm install --unsafe-perm || exit + npm install || exit npm run build || exit cd .. +##xo-web-v4 +#echo "building xo-web-v4" +#cd xo-web-v4 +# npm install || exit +# npm run build || exit +#cd .. + + + +#if [ ! -f xo-web/dist/styles/main.css ] ; then +# mkdir xo-web/dist/styles +# mkdir xo-web/dist/images +# +# cp xo-web-v4/dist/styles/main.css xo-web/dist/styles/main.css +# cp xo-web-v4/dist/images/logo_small.png xo-web/dist/images/logo_small.png +#fi + if [ ! -f "/etc/xo-server/config.yaml" ] ; then if [ ! -d "/etc/xo-server" ] ; then @@ -156,6 +200,14 @@ exit fi -restartxo +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