--- misc/xoa-installer/xoa-installer.sh 2016/02/29 10:09:34 2962 +++ misc/xoa-installer/xoa-installer.sh 2016/07/07 10:24:05 3062 @@ -1,10 +1,13 @@ #!/bin/bash -# npm install -g npm@next +# Note: this script works on debian 7/wheezy and debian 8/jessie +# +# If running on a raspberry 1(A/B) raspian/wheezy - downgrade node.js to 5.4.0 +# Please note that raspian/wheezy for arm defaults to gcc 4.6 +# gcc 4.7 is needed for compiling node-js modules -#BRANCH=next-release -BRANCH=master +BRANCH=stable function restartxo { @@ -37,7 +40,7 @@ echo cleaning .forever rm -rf .forever rm -rf forever.log - + echo done exit @@ -54,11 +57,21 @@ apt-get install build-essential || exit fi +if [ ! -f "/usr/include/libpng12/png.h" ] ; then + echo "installing libpng" + apt-get install libpng12-dev || exit +fi + if [ ! -x "/usr/bin/redis-server" ] ; then echo "installing redis-server" apt-get install redis-server || exit fi - + +if [ ! -x "/usr/bin/git" ] ; then + echo "installing git" + apt-get install git || exit +fi + if [ ! -x "/usr/local/bin/n" ] ; then echo "installing node.js bootstrap" @@ -73,10 +86,23 @@ if [ ! -x "/usr/local/bin/gulp" ] ; then echo "installing gulp" - npm install -g gulp + npm install -g gulp || exit fi +if [ ! -x "/usr/local/bin/forever" ] ; then + echo "installing forever" + npm install -g forever || exit +fi +if [ ! -x "/usr/local/bin/node-gyp" ] ; then + echo "installing node-gyp" + npm install -g node-gyp || exit +fi + +if [ ! -d "/usr/local/lib/node_modules/bcrypt" ] ; then + echo "installing bcrypt" + npm install -g bcrypt || exit +fi if [ ! -d "xo-web" ] ; then git clone -b $BRANCH https://github.com/vatesfr/xo-web.git @@ -99,18 +125,37 @@ # xo-server echo "building xo-server" cd xo-server -npm install || exit -npm run build || exit + npm install || exit + npm run build || exit + + #for some reasone leveldown fails occasionally on arm/raspberry pi + if [ ! -d "/root/xo-server/node_modules/leveldown/build" ] ; then + pushd node_modules/leveldown + node-gyp configure || exit + node-gyp build || exit + popd + fi cd .. + #xo-web echo "building xo-web" cd xo-web -npm install --unsafe-perm || exit -npm run build || exit + npm install --unsafe-perm || exit + npm run build || exit cd .. + +if [ ! -f "/etc/xo-server/config.yaml" ] ; then + if [ ! -d "/etc/xo-server" ] ; then + mkdir /etc/xo-server + fi + + echo "please setup /etc/xo-server/config.yaml" + exit +fi + restartxo