no need to run as root on macOS, cause we're installing the needed ext2 tools in a user readable path

This commit is contained in:
Simone Karin Lehmann 2018-03-13 20:36:14 +01:00 committed by Simone Karin Lehmann
parent b4cd7ec07a
commit afe05729d8
1 changed files with 0 additions and 13 deletions

View File

@ -2,14 +2,6 @@
usage() { echo "Usage: $0 imagefile.img [newimagefile.img]"; exit -1; } usage() { echo "Usage: $0 imagefile.img [newimagefile.img]"; exit -1; }
while getopts ":s" opt; do
case "${opt}" in
s) should_skip_autoexpand=true ;;
*) usage ;;
esac
done
shift $((OPTIND-1))
#Args #Args
img="$1" img="$1"
@ -21,10 +13,6 @@ if [[ ! -f "$img" ]]; then
echo "ERROR: $img is not a file..." echo "ERROR: $img is not a file..."
exit -2 exit -2
fi fi
if (( EUID != 0 )); then
echo "ERROR: You need to be running as root."
exit -3
fi
#Check that what we need is installed #Check that what we need is installed
for command in parted losetup tune2fs md5sum e2fsck resize2fs; do for command in parted losetup tune2fs md5sum e2fsck resize2fs; do
@ -58,7 +46,6 @@ tune2fs_output=$(tune2fs -l "$loopback")
currentsize=$(echo "$tune2fs_output" | grep '^Block count:' | tr -d ' ' | cut -d ':' -f 2) currentsize=$(echo "$tune2fs_output" | grep '^Block count:' | tr -d ' ' | cut -d ':' -f 2)
blocksize=$(echo "$tune2fs_output" | grep '^Block size:' | tr -d ' ' | cut -d ':' -f 2) blocksize=$(echo "$tune2fs_output" | grep '^Block size:' | tr -d ' ' | cut -d ':' -f 2)
#Make sure filesystem is ok #Make sure filesystem is ok
e2fsck -p -f "$loopback" e2fsck -p -f "$loopback"
minsize=$(resize2fs -P "$loopback" | cut -d ':' -f 2 | tr -d ' ') minsize=$(resize2fs -P "$loopback" | cut -d ':' -f 2 | tr -d ' ')