Make it possible to change path used by upgrade.sh on command line
authorJocelyn Jaubert <jocelyn.jaubert@gmail.com>
Mon, 21 May 2018 20:10:13 +0000 (22:10 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 22 May 2018 06:08:40 +0000 (08:08 +0200)
scripts/upgrade.sh

index abb7e94147def87841a22dceb68531c7d6255b49..295e16bfd1e98f6a137c8376da31ef8af112433a 100755 (executable)
@@ -2,7 +2,24 @@
 
 set -eu
 
-PEERTUBE_PATH=/var/www/peertube/
+PEERTUBE_PATH=${1:-/var/www/peertube/}
+
+if [ ! -e "$PEERTUBE_PATH" ]; then
+  echo "Error - path \"$PEERTUBE_PATH\" wasn't found"
+  echo ""
+  echo "If peertube was installed in another path, you can specify it with"
+  echo "    ./upgrade.sh <PATH>"
+  exit 1
+fi
+
+if [ ! -e "$PEERTUBE_PATH/versions" -o ! -e "$PEERTUBE_PATH/config/production.yaml" ]; then
+  echo "Error - Couldn't find peertube installation in \"$PEERTUBE_PATH\""
+  echo ""
+  echo "If peertube was installed in another path, you can specify it with"
+  echo "    ./upgrade.sh <PATH>"
+  exit 1
+fi
+
 
 # Backup database
 SQL_BACKUP_PATH="$PEERTUBE_PATH/backup/sql-peertube_prod-$(date +"%Y%m%d-%H%M").bak"