usage() {
cat <<EOF
-Usage: ${0##*/} [-n] +/-SIZE[g] swap|boot
+Usage: ${0##*/} [OPTIONS] +/-SIZE[g] swap|boot
Assuming Ian Kelling's partition scheme,
Resize swap or boot, expanding or shrinking the root fs and partition to compensate.
-n Dry run
-r Reboot now if it's needed.
--h|--help Print help.
+-h|--help Print help and exit.
SIZE is MiB, or if g is specified, GiB.
If using multiple devices, SIZE is applied to each device, so total change is
SIZE * devices.
-
+Note: Uses GNU getopt options parsing style
EOF
exit $1
}
reboot_not=false
dry_run=false
+
+temp=$(getopt -l opt o "$@") || usage 1
+eval set -- "$temp"
while true; do
case $1 in
-r) reboot_now=true; shift ;;
-n) dry_run=true; shift ;;
-h|--help) usage ;;
- *) break ;;
+ --) shift; break ;;
+ *) echo "$0: Internal error!" ; exit 1 ;;
esac
done