From 33aeacb3756d89a6c29136cf8fc7af23ad57bcaa Mon Sep 17 00:00:00 2001 From: Drew Bonasera Date: Tue, 26 Apr 2016 12:03:43 -0400 Subject: [PATCH] Add checks for parted and bc being installed. These are most likely to be missing on distros. --- pishrink.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pishrink.sh b/pishrink.sh index 78ccc6b..efb29de 100755 --- a/pishrink.sh +++ b/pishrink.sh @@ -16,6 +16,18 @@ if (( EUID != 0 )); then exit -3 fi +#Check that what we need is installed +A=`which parted 2>&1` +if (( $? != 0 )); then + echo "ERROR: parted is not installed." + exit -4 +fi +A=`which bc 2>&1` +if (( $? != 0 )); then + echo "ERROR: bc is not installed." + exit -5 +fi + #Gather info beforesize=`ls -lah $img | cut -d ' ' -f 5` partinfo=`parted -m $img unit B print`