From c01bda038e84156ffcd8cdc21025e7f3f3892fcf Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 14 Feb 2019 16:40:51 +0530 Subject: Allow optional --ignore-root-warning Now both ./install prod --ignore-root-warning ./install --ignore-root-warning prod will work $1 was both used for the environment and the root flag Fixes wallabag/wallabag#3884 --- scripts/install.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'scripts/install.sh') diff --git a/scripts/install.sh b/scripts/install.sh index 8b7ea03f..de1fb8f6 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -5,9 +5,17 @@ IGNORE_ROOT_ARG="--ignore-root-warning" IGNORE_ROOT=0 -if [ "$1" == "$IGNORE_ROOT_ARG" ]; then - IGNORE_ROOT=1 -fi +while :; do + case $1 in + $IGNORE_ROOT_ARG) IGNORE_ROOT=1 + ;; + *[a-zA-Z]) ENV=$1 + ;; + *) break + ;; + esac + shift +done # Abort running this script if root if [ "$IGNORE_ROOT" -eq 0 ] && [ "$EUID" == "0" ]; then @@ -22,7 +30,6 @@ DIR="${BASH_SOURCE}" if [ ! -d "$DIR" ]; then DIR="$PWD/scripts"; fi . "$DIR/require.sh" -ENV=$1 TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) git checkout $TAG -- cgit v1.2.3 From 7c553a6017c64d98017a6010dc6e77d22ab72da4 Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Thu, 17 Jan 2019 20:04:57 +0100 Subject: Properly source require.sh Fixes #3571. --- scripts/install.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'scripts/install.sh') diff --git a/scripts/install.sh b/scripts/install.sh index de1fb8f6..affa715f 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -25,10 +25,14 @@ if [ "$IGNORE_ROOT" -eq 0 ] && [ "$EUID" == "0" ]; then fi COMPOSER_COMMAND='composer' +REQUIRE_FILE='scripts/require.sh' -DIR="${BASH_SOURCE}" -if [ ! -d "$DIR" ]; then DIR="$PWD/scripts"; fi -. "$DIR/require.sh" +if [ ! -f "$REQUIRE_FILE" ]; then + echo "Cannot find $REQUIRE_FILE" + exit 1 +fi + +. "$REQUIRE_FILE" TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) -- cgit v1.2.3