make /opt/goldilocks user-writable for install

This commit is contained in:
AJ ONeal 2017-05-22 14:23:18 -05:00
parent e386b19e3f
commit 100e7cee7c
1 changed files with 15 additions and 5 deletions

View File

@ -169,6 +169,7 @@ set -u
dap_dl_bash "https://git.daplie.com/coolaj86/node-install-script/raw/master/setup-min.sh" dap_dl_bash "https://git.daplie.com/coolaj86/node-install-script/raw/master/setup-min.sh"
# Install # Install
# TODO install to tmp location, then move to /opt
export NODE_PATH=/opt/goldilocks/lib/node_modules export NODE_PATH=/opt/goldilocks/lib/node_modules
export NPM_CONFIG_PREFIX=/opt/goldilocks export NPM_CONFIG_PREFIX=/opt/goldilocks
$sudo_cmd mkdir -p /etc/goldilocks $sudo_cmd mkdir -p /etc/goldilocks
@ -176,17 +177,26 @@ $sudo_cmd mkdir -p /var/log/goldilocks
$sudo_cmd mkdir -p /srv/www $sudo_cmd mkdir -p /srv/www
$sudo_cmd mkdir -p /var/www $sudo_cmd mkdir -p /var/www
$sudo_cmd mkdir -p /opt/goldilocks/{lib,bin,etc} $sudo_cmd mkdir -p /opt/goldilocks/{lib,bin,etc}
# Change to user perms
# OS X or Linux
$sudo_cmd chown -R $(whoami) /opt/goldilocks/ || true
npm install -g 'git+https://git@git.daplie.com/Daplie/goldilocks.js.git#v1'
# Finish up with submodule
pushd /opt/goldilocks/lib/node_modules/goldilocks
bash ./update-packages.sh
popd
# Change to admin perms
# OS X # OS X
$sudo_cmd chown _www:_www /var/www /srv/www || true $sudo_cmd chown _www:_www /var/www /srv/www || true
$sudo_cmd chown -R _www:_www /opt/goldilocks/{lib,bin,etc} || true $sudo_cmd chown -R _www:_www /opt/goldilocks/{lib,bin,etc} || true
# Linux # Linux
$sudo_cmd chown www-data:www-data /var/www /srv/www || true $sudo_cmd chown www-data:www-data /var/www /srv/www || true
$sudo_cmd chown -R www-data:www-data /opt/goldilocks/{lib,bin,etc} || true $sudo_cmd chown -R www-data:www-data /opt/goldilocks/{lib,bin,etc} || true
npm install -g 'git+https://git@git.daplie.com/Daplie/goldilocks.js.git#v1'
# Finish up with submodule
pushd /opt/goldilocks/lib/node_modules/goldilocks
bash ./update-packages.sh
popd
# Unistall # Unistall
dap_dl "https://git.daplie.com/Daplie/goldilocks.js/raw/master/uninstall.sh" "./goldilocks-uninstall" dap_dl "https://git.daplie.com/Daplie/goldilocks.js/raw/master/uninstall.sh" "./goldilocks-uninstall"