1 #!/bin/sh 2 3 # Prepare a disk for booting a specific hardware device. 4 5 PROGNAME=`basename "$0"` 6 THISDIR=`dirname "$0"` 7 8 COMMON="$THISDIR/makesd-common" 9 EXPAND="$THISDIR/makesd-expand-def" 10 FORMAT="$THISDIR/makesd-format" 11 PARTSUMMARY="$THISDIR/makesd-partition-summary" 12 PARTITION="$THISDIR/makesd-partition" 13 14 . "$COMMON" 15 16 17 18 # Emit the help message if requested. 19 20 if [ "$1" = '--help' ] ; then 21 cat 1>&2 <<EOF 22 Usage: $PROGNAME [ --align ] <definition name> 23 24 Partition, format, populate and initialise a device for use with a particular 25 kind of hardware. The given definition name is used to search the database of 26 supported hardware devices and to configure the different preparation 27 activities. 28 29 $(align_cylinder_description) 30 EOF 31 exit 0 32 fi 33 34 # Obtain details of the selected device. 35 36 check_device 37 38 SUMMARY="`basename "$DEV"`.summary" 39 40 # Test for the cylinder alignment option. 41 42 if test_align_cylinder $* ; then shift 1 ; fi 43 44 # Obtain the definition name. 45 46 DEF="$1" 47 48 if [ ! "$DEF" ] ; then 49 cat 1>&2 <<EOF 50 No definition specified. 51 EOF 52 exit 1 53 fi 54 55 shift 1 56 57 # Expand the definition to partitioning options. 58 59 if ! ARGS=`"$EXPAND" "$DEF"` ; then 60 cat 1>&2 <<EOF 61 Device definition not found: $DEF 62 EOF 63 exit 1 64 fi 65 66 # Use the options to generate a partition summary. 67 68 "$PARTSUMMARY" $ARGS \ 69 > "$SUMMARY" 70 71 # Partition the given device. 72 73 "$PARTITION" $ALIGN_CYLINDER < "$SUMMARY" 74 75 # Format the given device. 76 77 "$FORMAT" < "$SUMMARY"