From 0a48f9e79b4e5c82dc0fe6aa147d9b84ec14a32e Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 16 May 2018 01:53:15 -0600 Subject: [PATCH] tested installer with unzip --- installer/get.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/installer/get.sh b/installer/get.sh index bac890f..be4a974 100644 --- a/installer/get.sh +++ b/installer/get.sh @@ -76,13 +76,14 @@ sudo mkdir -p "$GREENLOCK_PATH" echo "sudo chown -R $(whoami) '$GREENLOCK_PATH'" sudo chown -R $(whoami) "$GREENLOCK_PATH" +echo "Installing node.js dependencies into $GREENLOCK_PATH" # until node v10.x gets fix for ursa we have no advantage to switching from 8.x export NODEJS_VER=v8.11.1 export NODE_PATH="$GREENLOCK_PATH/lib/node_modules" export NPM_CONFIG_PREFIX="$GREENLOCK_PATH" export PATH="$GREENLOCK_PATH/bin:$PATH" sleep 1 -http_bash https://git.coolaj86.com/coolaj86/node-installer.sh/raw/branch/master/install.sh --no-dev-deps +http_bash https://git.coolaj86.com/coolaj86/node-installer.sh/raw/branch/master/install.sh --no-dev-deps >/dev/null 2>/dev/null my_tree="master" my_node="$GREENLOCK_PATH/bin/node" @@ -90,15 +91,17 @@ my_npm="$my_node $GREENLOCK_PATH/bin/npm" my_tmp="$GREENLOCK_PATH/tmp" mkdir -p $my_tmp -echo "blah" +echo "Installing Greenlock into $GREENLOCK_PATH" set +e my_unzip=$(type -p unzip) my_tar=$(type -p tar) if [ -n "$my_unzip" ]; then rm -f $my_tmp/greenlock-$my_tree.zip http_get https://git.coolaj86.com/coolaj86/greenlock-cli.js/archive/$my_tree.zip $my_tmp/greenlock-$my_tree.zip - # -j is the same as --strip 1, it nixes the top-level directory - $my_unzip -j $my_tmp/greenlock-$my_tree.zip -d $GREENLOCK_PATH/ + # -o means overwrite, and there is no option to strip + $my_unzip -o $my_tmp/greenlock-$my_tree.zip -d $GREENLOCK_PATH/ > /dev/null + cp -ar $GREENLOCK_PATH/greenlock-cli.js/* $GREENLOCK_PATH/ > /dev/null + rm -rf $GREENLOCK_PATH/greenlock-cli.js elif [ -n "$my_tar" ]; then rm -f $my_tmp/greenlock-$my_tree.tar.gz http_get https://git.coolaj86.com/coolaj86/greenlock-cli.js/archive/$my_tree.tar.gz $my_tmp/greenlock-$my_tree.tar.gz @@ -110,17 +113,26 @@ else fi set -e -pushd $GREENLOCK_PATH - $my_npm install -popd +pushd $GREENLOCK_PATH >/dev/null + $my_npm install >/dev/null 2>/dev/null +popd >/dev/null cat << EOF > $GREENLOCK_PATH/bin/greenlock -!#/bin/bash +#!/bin/bash $my_node $GREENLOCK_PATH/bin/greenlock.js EOF chmod a+x $GREENLOCK_PATH/bin/greenlock +echo "Creating link to 'greenlock' in /usr/local/bin" ln -sf $GREENLOCK_PATH/bin/greenlock /usr/local/bin/greenlock +echo "" +echo "" +echo "Installed successfully. Try it out:" +echo "" +echo " greenlock --help" +echo "" +echo "" + #sudo setcap cap_net_bind_service=+ep $GREENLOCK_PATH/bin/node #https://git.coolaj86.com/coolaj86/greenlock-cli.js.git