From 2ecfbc1e98d627a790f75df2bb401fbe1623bf63 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 28 Jul 2017 17:03:55 -0600 Subject: [PATCH] Add new file --- install.sh | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..33d8948 --- /dev/null +++ b/install.sh @@ -0,0 +1,100 @@ +#!/bin/bash + +set -e +set -u + +############################### +# # +# boilerplate for curl / wget # +# # +############################### + +http_get="" +http_opts="" +http_out="" + +detect_http_get() +{ + if type -p curl >/dev/null 2>&1; then + http_get="curl" + http_opts="-fsSL" + http_out="-o" + #curl -fsSL "$caddy_url" -o "$PREFIX/tmp/$caddy_pkg" + elif type -p wget >/dev/null 2>&1; then + http_get="wget" + http_opts="--quiet" + http_out="-O" + #wget --quiet "$caddy_url" -O "$PREFIX/tmp/$caddy_pkg" + else + echo "Aborted, could not find curl or wget" + return 7 + fi +} + +dap_dl() +{ + $http_get $http_opts $http_out "$2" "$1" +} + +dap_dl_bash() +{ + dap_url=$1 + #dap_args=$2 + rm -rf dap-tmp-runner.sh + $http_get $http_opts $http_out dap-tmp-runner.sh "$dap_url"; bash dap-tmp-runner.sh; rm dap-tmp-runner.sh +} + +detect_http_get + +############################### +# # +# actual script continues... # +# # +############################### + +install_walnut() +{ + sudo mkdir -p /srv/walnut/{var,etc,packages,node_modules} + # www-data exists on linux, _www exists on mac OS + sudo chown -R $(whoami):www-data /srv/walnut || sudo chown -R $(whoami):_www /srv/walnut + if [ ! -d "/srv/walnut/core/" ]; then + git clone https://git.daplie.com/Daplie/walnut.js.git /srv/walnut/core + fi + pushd /srv/walnut/core + if [ ! -d "./.git/" ]; then + echo "'/srv/walnut/core' exists but is not a git repository... not sure what to do here..." + fi + git checkout v1 + git pull + popd + rm -rf /srv/walnut/core/node_modules + ln -sf ../node_modules /srv/walnut/core/node_modules + /srv/walnut/core/install-helper.sh /srv/walnut + # Now that the install is finished we need to set the owner to the user that will actually + # be running the walnut server. + sudo chown -R www-data:www-data /srv/walnut || sudo chown -R _www:_www /srv/walnut +} + +# Install node +echo "v8.2.1" > /tmp/NODEJS_VER +daplie-install-node-dev +npm install -g npm@4 + +# Install goldilocks +daplie-install-goldilocks + +# Install walnut +install_walnut + +echo "" +echo "You must have some set of domain set up to properly use goldilocks+walnut:" +echo "" +echo " example.com" +echo " www.example.com" +echo " api.example.com" +echo " assets.example.com" +echo " cloud.example.com" +echo " api.cloud.example.com" +echo "" +echo "Check the WALNUT README.md for more info and how to set up /etc/goldilocks/goldilocks.yml" +echo "" \ No newline at end of file