update install script

This commit is contained in:
AJ ONeal 2017-11-07 14:57:40 -07:00
parent 4ff4e44bc3
commit 9707402e31
4 changed files with 152 additions and 122 deletions

View File

@ -53,6 +53,10 @@ Installation
We're still in a stage where the installation generally requires many manual steps.
``bash
curl https://git.daplie.com/Daplie/walnut.js/raw/v1.2/installer/get.sh | bash
```
See [INSTALL.md](/INSTALL.md)
Usage

View File

@ -1,4 +0,0 @@
#!/bin/bash
curl -fsSL https://git.daplie.com/Daplie/walnut.js/raw/master/installer/install.sh -o walnut-installer.sh
bash walnut-installer.sh

20
installer/get.sh Normal file
View File

@ -0,0 +1,20 @@
set -e
set -u
my_name=walnut
# TODO provide an option to supply my_ver and my_tmp
my_ver=master
my_tmp=$(mktemp -d)
mkdir -p $my_tmp/opt/$my_name/lib/node_modules/$my_name
git clone https://git.daplie.com/Daplie/walnut.js.git $my_tmp/opt/$my_name/core
echo "Installing to $my_tmp (will be moved after install)"
pushd $my_tmp/opt/$my_name/core
git checkout $my_ver
source ./installer/install.sh
popd
echo "Installation successful, now cleaning up $my_tmp ..."
rm -rf $my_tmp
echo "Done"

View File

@ -3,9 +3,24 @@
set -e
set -u
my_tmp=$(mktemp -d)
my_app_name=walnut
### IMPORTANT ###
### VERSION ###
my_name=walnut
my_app_pkg_name=com.daplie.walnut.web
#my_app_ver="v1.1"
my_app_ver="installer-v2"
my_azp_oauth3_ver="v1.2"
export NODE_VERSION="v8.9.0"
if [ -z "${my_tmp-}" ]; then
my_tmp="$(mktemp -d)"
mkdir -p $my_tmp/opt/$my_name/lib/node_modules/$my_name
echo "Installing to $my_tmp (will be moved after install)"
git clone ./ $my_tmp/opt/$my_name/lib/node_modules/$my_name
pushd $my_tmp/opt/$my_name/lib/node_modules/$my_name
fi
#################
### IMPORTANT ###
### VERSION ###
@ -26,25 +41,18 @@ my_npm="$NPM_CONFIG_PREFIX/bin/npm"
my_app_dir=$my_tmp
# TODO un-hardcode core at al
#my_app_dist=$my_tmp/opt/$my_app_name/lib/node_modules/$my_app_name/dist
my_app_dist=$my_tmp/opt/$my_app_name/core/dist
git_base="https://git.daplie.com/Daplie/walnut.js.git"
installer_base="https://git.daplie.com/Daplie/walnut.js/raw/$my_app_ver"
installer_base="https://git.daplie.com/Daplie/goldilocks.js/raw/$my_app_ver"
# Backwards compat
# some scripts still use the old names
my_app_dir=$my_tmp
my_app_name=$my_name
#
# Install to tmp location, then move to /opt
#
echo "Installing to $my_tmp (will be moved after install)"
#mkdir -p $my_tmp/opt/$my_app_name/lib/node_modules/$my_app_name
mkdir -p $my_tmp/opt/$my_app_name/lib/node_modules/$my_app_name
#git clone $git_base $my_tmp/opt/$my_app_name/lib/node_modules/$my_app_name
git clone $git_base $my_tmp/opt/$my_app_name/core
#pushd $my_tmp/opt/$my_app_name/lib/node_modules/$my_app_name
pushd $my_tmp/opt/$my_app_name/core
git checkout $my_app_ver
mkdir -p $my_tmp/{etc,opt,srv,var}/$my_app_name
@ -160,12 +168,10 @@ pushd $my_tmp/opt/$my_app_name/core
# make sure the files are all read/write for the owner and group, and then set
# the setuid and setgid bits so that any files/directories created inside these
# directories have the same owner and group.
$sudo_cmd chmod -R ug+rwX /opt/$my_app_name
find /opt/$my_app_name -type d -exec $sudo_cmd chmod ug+s {} \;
popd
$sudo_cmd chmod -R ug+rwX $my_root/opt/$my_app_name
find $my_root/opt/$my_app_name -type d -exec $sudo_cmd chmod ug+s {} \;
rm -rf $my_tmp
echo ""
echo "You must have some set of domain set up to properly use goldilocks+walnut:"
@ -180,3 +186,7 @@ echo ""
echo "Check the WALNUT README.md for more info and how to set up /etc/goldilocks/goldilocks.yml"
echo ""
echo "Unistall: rm -rf /srv/walnut/ /var/walnut/ /etc/walnut/ /opt/walnut/ /var/log/walnut/ /etc/systemd/system/walnut.service"
rm -rf $my_tmp