# HG changeset patch # User Paul Boddie # Date 1558820284 -7200 # Node ID 80366ff873d6a1660d7ec6f5e9e44c9f58481376 # Parent 781f2c4f4724bf400931d42949c1146195106a20 Added hardware definition name output. Tidied up definitions file variables. diff -r 781f2c4f4724 -r 80366ff873d6 makesd --- a/makesd Sat May 25 18:20:40 2019 +0200 +++ b/makesd Sat May 25 23:38:04 2019 +0200 @@ -6,6 +6,7 @@ THISDIR=`dirname "$0"` COMMON="$THISDIR/makesd-common" +DEFS="$THISDIR/makesd-defs" EXPAND="$THISDIR/makesd-expand-def" FORMAT="$THISDIR/makesd-format" PARTSUMMARY="$THISDIR/makesd-partition-summary" @@ -20,17 +21,28 @@ if [ "$1" = '--help' ] ; then cat 1>&2 < + $PROGNAME -a | --all | --defs Partition, format, populate and initialise a device for use with a particular kind of hardware. The given definition name is used to search the database of supported hardware devices and to configure the different preparation activities. +If the -a, --all or --defs options are specified, all hardware definitions are +emitted and no further actions are taken. + $(align_cylinder_description) EOF exit 0 fi +# Test for the definition output options. + +if [ "$1" = '-a' ] || [ "$1" = '--all' ] || [ "$1" = '--defs' ] ; then + grep '^[[:alpha:]]' "$DEFS" | cut -f1 | sort + exit 0 +fi + # Obtain details of the selected device. check_device diff -r 781f2c4f4724 -r 80366ff873d6 makesd-expand-def --- a/makesd-expand-def Sat May 25 18:20:40 2019 +0200 +++ b/makesd-expand-def Sat May 25 23:38:04 2019 +0200 @@ -6,8 +6,7 @@ PROGNAME=`basename "$0"` THISDIR=`dirname "$0"` -DEFSFILE="makesd-defs" -DEFSPATH="$THISDIR/$DEFSFILE" +DEFS="$THISDIR/makesd-defs" @@ -30,7 +29,7 @@ Search for a definition of the given name in the definitions file: -$DEFSPATH +$DEFS If the definition can be found, the value of the definition is emitted and an exit value of 0 returned. Otherwise, no output is produced and an exit value of @@ -53,13 +52,13 @@ # Obtain the line number of the matching definition. - LINENUM=`grep -h -n "^$1\s" "$DEFSPATH" | cut -d: -f1` + LINENUM=`grep -h -n "^$1\s" "$DEFS" | cut -d: -f1` if [ "$LINENUM" ] ; then # Read from the definition line. Line continuations are observed. - tail -n "+$LINENUM" "$DEFSPATH" | if read LINE ; then + tail -n "+$LINENUM" "$DEFS" | if read LINE ; then echo "$LINE" break fi