2019-05-25 | Paul Boddie | file changeset files shortlog | Moved common routines into a separate file. |
paul@7 | 1 | #!/bin/sh |
paul@7 | 2 | |
paul@7 | 3 | # Common routines. |
paul@7 | 4 | |
paul@7 | 5 | # Test for a selected device. |
paul@7 | 6 | |
paul@7 | 7 | check_device() |
paul@7 | 8 | { |
paul@7 | 9 | if [ ! "$DEV" ] ; then |
paul@7 | 10 | cat 1>&2 <<EOF |
paul@7 | 11 | No device specified. Use the DEV environment variable to indicate a device. |
paul@7 | 12 | EOF |
paul@7 | 13 | exit 1 |
paul@7 | 14 | fi |
paul@7 | 15 | |
paul@7 | 16 | if [ ! -e "$DEV" ] ; then |
paul@7 | 17 | cat 1>&2 <<EOF |
paul@7 | 18 | Device not found: $DEV |
paul@7 | 19 | EOF |
paul@7 | 20 | exit 1 |
paul@7 | 21 | fi |
paul@7 | 22 | } |
paul@7 | 23 | |
paul@7 | 24 | # Process partition field values in summary tables. |
paul@7 | 25 | |
paul@7 | 26 | read_fields() |
paul@7 | 27 | { |
paul@7 | 28 | OLDIFS=$IFS |
paul@7 | 29 | IFS=`echo -n '\t'` read START SIZE TYPE |
paul@7 | 30 | STATUS=$? |
paul@7 | 31 | IFS=$OLDIFS |
paul@7 | 32 | return $STATUS |
paul@7 | 33 | } |