From f73e4f9c28ff9b90f5ce133e3a17171a8eff1dd0 Mon Sep 17 00:00:00 2001 From: Simon Let Date: Wed, 18 Dec 2019 17:30:39 +0100 Subject: [PATCH] add a way to install prereleases --- scripts/install.sh | 37 ++++++++++++++++++++++++------------- scripts/rawinstall.sh | 23 +++++++++++++---------- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index a95aa40..4a17c5b 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -63,19 +63,30 @@ else fi fi -# if setsid --version >/dev/null 2>&1; then -# echo " * Setsid installed: OK" -# else -# echo " * Setsid installed: NOT INSTALLED!" -# # > Install using ... -# fi - -# if gnohup --version >/dev/null 2>&1; then -# echo " * Setsid installed: OK" -# else -# echo " * Setsid installed: NOT INSTALLED!" -# # > Install using ... -# fi + +if [ "$(uname)" = Darwin ]; then + if gnohup --version >/dev/null 2>&1; then + echo " * Nohup installed: OK" + else + echo " * Nohup installed: NOT INSTALLED!" + echo " > You don't have nohup" + echo " > Please install GNU coreutils" + echo + echo " $ brew install coreutils" + echo + exit 1 + fi +else + if setsid --version >/dev/null 2>&1; then + echo " * Setsid installed: OK" + else + echo " * Setsid installed: NOT INSTALLED!" + echo " > You don't have setsid" + echo " > Please install unix-util" + echo + exit 1 + fi +fi # echo # echo "Continue with installation? (Any key to CONTINUE / Ctrl+C to ABORT)" diff --git a/scripts/rawinstall.sh b/scripts/rawinstall.sh index 13eede9..55ad970 100755 --- a/scripts/rawinstall.sh +++ b/scripts/rawinstall.sh @@ -6,16 +6,19 @@ echo echo "Please report any issues you encounter to: https://github.com/curusarn/resh/issues" echo -echo "Looking for the latest release ..." -json=$(curl --silent "https://api.github.com/repos/curusarn/resh/releases/latest") - -# latest release -# not very robust but we don't want any dependencies to parse to JSON -tag=$(echo "$json" | grep '"tag_name":' | cut -d':' -f2 | tr -d ',' | cut -d'"' -f2) - -# latest release OR pre-release -# json=$(curl --silent "https://api.github.com/repos/curusarn/resh/releases") -# tag=$(echo "$json" | grep '"tag_name":' | cut -d':' -f2 | tr -d ',' | cut -d'"' -f2 | sort --version-sort --reverse | head -n 1) +if [ "$1" = "--test" ] || [ "$1" = "-t" ]; then + echo "Looking for the latest release or PRERELEASE (because you used --test flag) ..." + # debug + # latest release OR pre-release + json=$(curl --silent "https://api.github.com/repos/curusarn/resh/releases") + tag=$(echo "$json" | grep '"tag_name":' | cut -d':' -f2 | tr -d ',' | cut -d'"' -f2 | sort --version-sort --reverse | head -n 1) +else + echo "Looking for the latest release ..." + # latest release + json=$(curl --silent "https://api.github.com/repos/curusarn/resh/releases/latest") + # not very robust but we don't want any dependencies to parse to JSON + tag=$(echo "$json" | grep '"tag_name":' | cut -d':' -f2 | tr -d ',' | cut -d'"' -f2) +fi if [ ${#tag} -lt 2 ]; then echo "ERROR: Couldn't determine the latest release! (extracted git tag is too short \"${tag}\")"