]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Check if awk and sed are executable
authorFelix Ableitner <me@nutomic.com>
Sat, 1 Dec 2018 13:00:07 +0000 (14:00 +0100)
committerChocobozzz <me@florianbigard.com>
Tue, 4 Dec 2018 08:31:36 +0000 (09:31 +0100)
scripts/upgrade.sh

index 0a9ce1dabc81fc5c5af6a30cfa306f1c2d9213cd..4f7c58edda06cf3b285e4c230a8a2c35be788d79 100755 (executable)
@@ -20,13 +20,15 @@ if [ ! -e "$PEERTUBE_PATH/versions" -o ! -e "$PEERTUBE_PATH/config/production.ya
   exit 1
 fi
 
-REMAINING=$(df -k $PEERTUBE_PATH | awk '{ print $4}' | sed -n 2p)
-ONE_GB=$((1024 * 1024))
-if [ "$REMAINING" -lt "$ONE_GB" ]; then
-  echo "Error - not enough free space for upgrading"
-  echo ""
-  echo "Make sure you have at least 1 GB of free space in $PEERTUBE_PATH"
-  exit 1
+if [ -x "$(command -v awk)" ] && [ -x "$(command -v sed)" ] ; then
+    REMAINING=$(df -k $PEERTUBE_PATH | awk '{ print $4}' | sed -n 2p)
+    ONE_GB=$((1024 * 1024))
+    if [ "$REMAINING" -lt "$ONE_GB" ]; then
+    echo "Error - not enough free space for upgrading"
+    echo ""
+    echo "Make sure you have at least 1 GB of free space in $PEERTUBE_PATH"
+    exit 1
+    fi
 fi
 
 # Backup database