1 #!/bin/sh 2 3 # Support partitioning of a device using sfdisk. This program accepts a 4 # partitioning summary on standard input. 5 # 6 # Important tasks: 7 # 8 # Erase bootloader blocks. 9 # Perform partitioning using sfdisk. 10 11 PROGNAME=`basename "$0"` 12 THISDIR=`dirname "$0"` 13 14 COMMON="$THISDIR/makesd-common" 15 PARTTABLE="$THISDIR/makesd-partition-table" 16 SFDISK="/sbin/sfdisk" 17 18 . "$COMMON" 19 20 21 22 # Test sfdisk behaviour and obtain useful information. 23 24 init_sfdisk() 25 { 26 if "$SFDISK" -uS -s "$1" > /dev/null 2>&1 ; then 27 SFDISK_OPTIONS="-uS -L" 28 else 29 SFDISK_OPTIONS= 30 fi 31 } 32 33 34 35 # Obtain details of the selected device. 36 37 check_device 38 39 # Initialise sfdisk usage. 40 41 init_sfdisk "$DEV" 42 43 # Convert the partitioning summary into a partition table description. 44 # Present the table to sfdisk. 45 46 "$PARTTABLE" $* \ 47 | "$SFDISK" $SFDISK_OPTIONS "$DEV"