Fix growpart error when missing.

If the virtual machine don't have cloud-utils intalled this script print errors.
I test if growpart command is available before running the action
pull/15/head
Philippe Caseiro 9 years ago
parent 8669f28e45
commit 6e6e70e29f

@ -1,5 +1,10 @@
#!/bin/bash #!/bin/bash
GROWPART=$(which growpart)
if [[ ${?} -ne 0 ]]
then
echo "Skipping growfs, growpart command is missing"
else
MOUNT_LINE=$(cat /etc/mtab | grep ' / ' | grep -v '^rootfs') MOUNT_LINE=$(cat /etc/mtab | grep ' / ' | grep -v '^rootfs')
DEVICE=$(echo "$MOUNT_LINE" | cut -d' ' -f1) DEVICE=$(echo "$MOUNT_LINE" | cut -d' ' -f1)
@ -26,4 +31,4 @@ xfs)
xfs_growfs / xfs_growfs /
;; ;;
esac esac
fi

Loading…
Cancel
Save