# HG changeset patch # User Paul Boddie # Date 1558994508 -7200 # Node ID 075e1897863f9c1d9f2ab6caecc915a6f479f09e # Parent 31eb4b5f87a546c9ef4c75f26babfb3d1450a928 Filter summary columns for scripts, the formatter accepting one value per line. diff -r 31eb4b5f87a5 -r 075e1897863f makesd --- a/makesd Mon May 27 23:58:01 2019 +0200 +++ b/makesd Tue May 28 00:01:48 2019 +0200 @@ -92,13 +92,15 @@ # Use the options to generate a partition summary. - "$PARTSUMMARY" $ARGS \ + "$PARTSUMMARY" $ARGS \ > "$SUMMARY" -# Partition the given device. +# Partition the given device, passing only partition details to the script. -"$PARTITION" $ALIGN_CYLINDER < "$SUMMARY" + cut -f 1,2,3 "$SUMMARY" \ +| "$PARTITION" $ALIGN_CYLINDER -# Format the given device. +# Format the given device, passing only partition types to the script. -"$FORMAT" < "$SUMMARY" + cut -f 3 "$SUMMARY" \ +| "$FORMAT" diff -r 31eb4b5f87a5 -r 075e1897863f makesd-format --- a/makesd-format Mon May 27 23:58:01 2019 +0200 +++ b/makesd-format Tue May 28 00:01:48 2019 +0200 @@ -62,14 +62,9 @@ cat 1>&2 < - -Only the type value is employed by this program. Types recognised include ext, -ext2, ext3, ext4, fat and swap. +The input for this program is supplied via standard input as a list of partition +types, one per line. Types recognised include ext, ext2, ext3, ext4, fat and +swap. EOF exit 0 fi @@ -78,9 +73,11 @@ check_device +# Read partition types, one per line. + PARTNUM=1 -while read_fields ; do +while read TYPE ; do DEVICE="${DEV}${PARTNUM}" format "$DEVICE" "$TYPE" PARTNUM=$(($PARTNUM + 1))