1.1 --- a/makesd-partition-table Fri May 24 18:26:28 2019 +0200
1.2 +++ b/makesd-partition-table Fri May 24 18:27:02 2019 +0200
1.3 @@ -153,6 +153,11 @@
1.4
1.5 align_cylinder()
1.6 {
1.7 + if [ ! "$ALIGN_CYLINDER" ] ; then
1.8 + echo $1
1.9 + return
1.10 + fi
1.11 +
1.12 # Round up to the nearest cylinder.
1.13
1.14 CYLINDER=$((($1 + $CYLINDER_SIZE - 1) / $CYLINDER_SIZE))
1.15 @@ -174,8 +179,10 @@
1.16
1.17 # Find the cylinder-addressable size.
1.18
1.19 - CYLINDERS=$(($DEVSIZE / $CYLINDER_SIZE))
1.20 - DEVSIZE=$(($CYLINDERS * $CYLINDER_SIZE))
1.21 + if [ "$ALIGN_CYLINDER" ] ; then
1.22 + CYLINDERS=$(($DEVSIZE / $CYLINDER_SIZE))
1.23 + DEVSIZE=$(($CYLINDERS * $CYLINDER_SIZE))
1.24 + fi
1.25 }
1.26
1.27
1.28 @@ -184,7 +191,7 @@
1.29
1.30 if [ "$1" = '--help' ] ; then
1.31 cat 1>&2 <<EOF
1.32 -Usage: $PROGNAME ( -f <type> | -p <start> | -s <size> )...
1.33 +Usage: $PROGNAME [ --align ] ( -f <type> | -p <start> | -s <size> )...
1.34
1.35 Produce partition descriptions, indicating partition type, start position and
1.36 size for each partition. Each occurrence of the -f option starts a new partition
1.37 @@ -196,11 +203,24 @@
1.38 remainder of the device will be used.
1.39
1.40 Types recognised include ext, ext2, ext3, ext4, fat and swap. Other types are
1.41 -interpreted as Linux partitions.
1.42 +interpreted as Linux partitions.
1.43 +
1.44 +If the --align option is specified, align partitions to cylinders for the
1.45 +satisfaction of earlier sfdisk versions that are obsessed with cylinders, heads
1.46 +and sectors.
1.47 EOF
1.48 exit 0
1.49 fi
1.50
1.51 +# Test for the cylinder alignment option.
1.52 +
1.53 +if [ "$1" = '--align' ] ; then
1.54 + ALIGN_CYLINDER="$1"
1.55 + shift 1
1.56 +else
1.57 + ALIGN_CYLINDER=
1.58 +fi
1.59 +
1.60 # Obtain details of the selected device.
1.61
1.62 if [ ! "$DEV" ] ; then
1.63 @@ -210,6 +230,13 @@
1.64 exit 1
1.65 fi
1.66
1.67 +if [ ! -e "$DEV" ] ; then
1.68 + cat 1>&2 <<EOF
1.69 +Device not found: $DEV
1.70 +EOF
1.71 + exit 1
1.72 +fi
1.73 +
1.74 # Initialise sfdisk usage.
1.75
1.76 init_sfdisk "$DEV"