From: Felix Ableitner Date: Sat, 1 Dec 2018 13:00:07 +0000 (+0100) Subject: Check if awk and sed are executable X-Git-Tag: v1.2.0-rc.1~118 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5c94c38d18a02864b6f384bcd829a0d3f2d86c4a;p=oweals%2Fpeertube.git Check if awk and sed are executable --- diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index 0a9ce1dab..4f7c58edd 100755 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -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