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 +++++++++++---- scripts/update.sh | 16 +++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'scripts') 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 diff --git a/scripts/update.sh b/scripts/update.sh index c62d104a..e86a76db 100755 --- a/scripts/update.sh +++ b/scripts/update.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 @@ -25,8 +33,6 @@ DIR="${BASH_SOURCE}" if [ ! -d "$DIR" ]; then DIR="$PWD/scripts"; fi . "$DIR/require.sh" -ENV=$1 - rm -rf var/cache/* git fetch origin git fetch --tags -- 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/dev.sh | 10 +++++++--- scripts/install.sh | 10 +++++++--- scripts/update.sh | 10 +++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/dev.sh b/scripts/dev.sh index 0703ced1..28453be0 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -3,10 +3,14 @@ # eg: `sh dev.sh` 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" $COMPOSER_COMMAND install php bin/console wallabag:install 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)) diff --git a/scripts/update.sh b/scripts/update.sh index e86a76db..3ef10439 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -28,10 +28,14 @@ set -e set -u 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" rm -rf var/cache/* git fetch origin -- cgit v1.2.3 From 6546aca4a3a54ec61c3b43e84aa948efb1aeca95 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 29 May 2019 11:41:07 +0200 Subject: Keep composer.lock We initially ignored the `composer.lock` because it generated a lock of rebase on PR when someone updated it and the master updated it too. Now we have less contributions (sadly) so I think we won't run against that problem. Also, it'll solve issue about people cloning the master and got angry because composer eat all the available memory to determine packages to install. It'll also be much easier to make release. Scrutinizer & Travis will be faster too. --- scripts/release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/release.sh b/scripts/release.sh index ee08a688..e697e220 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -9,8 +9,8 @@ ENV=$4 rm -rf $TMP_FOLDER/$RELEASE_FOLDER mkdir $TMP_FOLDER/$RELEASE_FOLDER -git clone git@github.com:wallabag/wallabag.git -b release-$VERSION $TMP_FOLDER/$RELEASE_FOLDER/$VERSION -cd $TMP_FOLDER/$RELEASE_FOLDER/$VERSION && SYMFONY_ENV=$ENV COMPOSER_MEMORY_LIMIT=-1 composer up -n --no-dev +git clone git@github.com:wallabag/wallabag.git $TMP_FOLDER/$RELEASE_FOLDER/$VERSION +cd $TMP_FOLDER/$RELEASE_FOLDER/$VERSION && SYMFONY_ENV=$ENV COMPOSER_MEMORY_LIMIT=-1 composer install -n --no-dev cd $TMP_FOLDER/$RELEASE_FOLDER/$VERSION && php bin/console wallabag:install --env=$ENV -n cd $TMP_FOLDER/$RELEASE_FOLDER/$VERSION && php bin/console assets:install --env=$ENV --symlink --relative cd $TMP_FOLDER/$RELEASE_FOLDER && tar czf wallabag-$VERSION.tar.gz --exclude="var/cache/*" --exclude="var/logs/*" --exclude="var/sessions/*" --exclude=".git" $VERSION -- cgit v1.2.3 From 7a82953b3e34e07df2a6ac8b09d01b47db5da879 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 12 Jun 2019 21:33:53 +0200 Subject: Check if .git directory exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If that folder doesn’t exist, it means the udpate script won’t be able to run because it uses git to retrieve the update. --- scripts/require.sh | 2 +- scripts/update.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/require.sh b/scripts/require.sh index c48ab936..63c38132 100755 --- a/scripts/require.sh +++ b/scripts/require.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -# File used to check dependencies +# Check for composer if [ ! -f composer.phar ]; then echo "composer.phar not found, we'll see if composer is installed globally." command -v composer >/dev/null 2>&1 || { echo >&2 "wallabag requires composer but it's not installed (see http://doc.wallabag.org/en/master/user/installation.html). Aborting."; exit 1; } diff --git a/scripts/update.sh b/scripts/update.sh index 3ef10439..edebe5c5 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -37,6 +37,12 @@ fi . "$REQUIRE_FILE" +# Check for wallabag .git folder +if [ ! -d .git ]; then + echo "Can not update because wallabag wasn't installed using git (see https://doc.wallabag.org/en/admin/upgrade.html#upgrade-on-a-shared-hosting). Aborting."; + exit 1; +fi + rm -rf var/cache/* git fetch origin git fetch --tags -- cgit v1.2.3 From 0a258f85be31c5d99317ffdc83cc8735e504ed48 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 14 Jun 2019 11:28:23 +0200 Subject: Return a different code when git isn't installed --- scripts/update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/update.sh b/scripts/update.sh index edebe5c5..1f31d429 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -40,7 +40,7 @@ fi # Check for wallabag .git folder if [ ! -d .git ]; then echo "Can not update because wallabag wasn't installed using git (see https://doc.wallabag.org/en/admin/upgrade.html#upgrade-on-a-shared-hosting). Aborting."; - exit 1; + exit 2; fi rm -rf var/cache/* -- cgit v1.2.3 From 488e3d7a915dcdce37fe4af14f33293edcb4fbdb Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Wed, 9 Oct 2019 19:33:27 +0200 Subject: Add environment variables to control scripts/dev.sh behavior --- scripts/dev.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/dev.sh b/scripts/dev.sh index 28453be0..cc465cf9 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -13,5 +13,8 @@ fi . "$REQUIRE_FILE" $COMPOSER_COMMAND install -php bin/console wallabag:install -php bin/console server:run +if [ -z "$SKIP_WALLABAG_INITIALIZATION" ] +then + php bin/console wallabag:install +fi +php bin/console server:run $HOST -- cgit v1.2.3