paul@12 | 1 | #!/bin/sh |
paul@12 | 2 | |
paul@12 | 3 | # Prepare a disk for booting a hardware device. |
paul@12 | 4 | |
paul@12 | 5 | PROGNAME=`basename "$0"` |
paul@12 | 6 | THISDIR=`dirname "$0"` |
paul@12 | 7 | |
paul@12 | 8 | COMMON="$THISDIR/makesd-common" |
paul@12 | 9 | EXPAND="$THISDIR/makesd-expand-def" |
paul@12 | 10 | FORMAT="$THISDIR/makesd-format" |
paul@12 | 11 | PARTSUMMARY="$THISDIR/makesd-partition-summary" |
paul@12 | 12 | PARTITION="$THISDIR/makesd-partition" |
paul@12 | 13 | |
paul@12 | 14 | . "$COMMON" |
paul@12 | 15 | |
paul@12 | 16 | |
paul@12 | 17 | |
paul@12 | 18 | # Obtain details of the selected device. |
paul@12 | 19 | |
paul@12 | 20 | check_device |
paul@12 | 21 | |
paul@12 | 22 | SUMMARY="`basename "$DEV"`.summary" |
paul@12 | 23 | |
paul@12 | 24 | # Test for the cylinder alignment option. |
paul@12 | 25 | |
paul@12 | 26 | if test_align_cylinder $* ; then shift 1 ; fi |
paul@12 | 27 | |
paul@12 | 28 | # Obtain the definition name. |
paul@12 | 29 | |
paul@12 | 30 | DEF="$1" |
paul@12 | 31 | |
paul@12 | 32 | if [ ! "$DEF" ] ; then |
paul@12 | 33 | cat 1>&2 <<EOF |
paul@12 | 34 | No definition specified. |
paul@12 | 35 | EOF |
paul@12 | 36 | exit 1 |
paul@12 | 37 | fi |
paul@12 | 38 | |
paul@12 | 39 | shift 1 |
paul@12 | 40 | |
paul@12 | 41 | # Expand the definition to partitioning options. |
paul@12 | 42 | |
paul@12 | 43 | if ! ARGS=`"$EXPAND" "$DEF"` ; then |
paul@12 | 44 | cat 1>&2 <<EOF |
paul@12 | 45 | Device definition not found: $DEF |
paul@12 | 46 | EOF |
paul@12 | 47 | exit 1 |
paul@12 | 48 | fi |
paul@12 | 49 | |
paul@12 | 50 | # Use the options to generate a partition summary. |
paul@12 | 51 | |
paul@12 | 52 | "$PARTSUMMARY" $ARGS \ |
paul@12 | 53 | > "$SUMMARY" |
paul@12 | 54 | |
paul@12 | 55 | # Partition the given device. |
paul@12 | 56 | |
paul@12 | 57 | "$PARTITION" $ALIGN_CYLINDER < "$SUMMARY" |
paul@12 | 58 | |
paul@12 | 59 | # Format the given device. |
paul@12 | 60 | |
paul@12 | 61 | "$FORMAT" < "$SUMMARY" |