From 8331faf8f3c0705975d205c76fbb91c0f9887f32 Mon Sep 17 00:00:00 2001 From: Andrew Scheller Date: Mon, 22 Jan 2018 03:05:31 +0000 Subject: [PATCH] Check for additional required commands --- pishrink.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pishrink.sh b/pishrink.sh index 8b45879..0f63f18 100755 --- a/pishrink.sh +++ b/pishrink.sh @@ -29,11 +29,13 @@ if (( EUID != 0 )); then fi #Check that what we need is installed -which parted 2>&1 >/dev/null -if (( $? != 0 )); then - echo "ERROR: parted is not installed." - exit -4 -fi +for command in parted losetup tune2fs md5sum e2fsck resize2fs; do + which $command 2>&1 >/dev/null + if (( $? != 0 )); then + echo "ERROR: $command is not installed." + exit -4 + fi +done #Copy to new file if requested if [ -n "$2" ]; then