1.1 --- a/makesd-format Tue May 28 00:30:18 2019 +0200
1.2 +++ b/makesd-format Mon Jun 10 01:37:46 2019 +0200
1.3 @@ -62,9 +62,12 @@
1.4 cat 1>&2 <<EOF
1.5 Usage: $PROGNAME
1.6
1.7 -The input for this program is supplied via standard input as a list of partition
1.8 -types, one per line. Types recognised include ext, ext2, ext3, ext4, fat and
1.9 -swap.
1.10 +The input for this program is supplied via standard input as partition
1.11 +definitions employing the following pertinent properties:
1.12 +
1.13 +type: <type>
1.14 +
1.15 +Types recognised include ext, ext2, ext3, ext4, fat and swap.
1.16 EOF
1.17 exit 0
1.18 fi
1.19 @@ -75,10 +78,25 @@
1.20
1.21 # Read partition types, one per line.
1.22
1.23 -PARTNUM=1
1.24 +PARTNUM=0
1.25 +SECTION=
1.26 +
1.27 +while read LINE ; do
1.28 +
1.29 + if [ "$LINE" ] && [ ! "$SECTION" ] ; then
1.30 + SECTION=$LINE
1.31 + PARTNUM=$(($PARTNUM + 1))
1.32
1.33 -while read TYPE ; do
1.34 - DEVICE="${DEV}${PARTNUM}"
1.35 - format "$DEVICE" "$TYPE"
1.36 - PARTNUM=$(($PARTNUM + 1))
1.37 + elif [ ! "$LINE" ] ; then
1.38 + SECTION=
1.39 +
1.40 + elif [ "$SECTION" ] ; then
1.41 + FIELD=`get_field "$LINE"`
1.42 + VALUE=`get_value "$LINE"`
1.43 +
1.44 + if [ "$FIELD" = 'type' ] ; then
1.45 + DEVICE="${DEV}${PARTNUM}"
1.46 + format "$DEVICE" "$TYPE"
1.47 + fi
1.48 + fi
1.49 done