# HG changeset patch # User Paul Boddie # Date 1558715222 -7200 # Node ID ad94fc90209636628c8892c95dacc459d6814e8d # Parent 2e760d4f76f1b9debbf4e9899468980fd3632ce0 Make cylinder alignment optional. diff -r 2e760d4f76f1 -r ad94fc902096 makesd-partition-table --- a/makesd-partition-table Fri May 24 18:26:28 2019 +0200 +++ b/makesd-partition-table Fri May 24 18:27:02 2019 +0200 @@ -153,6 +153,11 @@ align_cylinder() { + if [ ! "$ALIGN_CYLINDER" ] ; then + echo $1 + return + fi + # Round up to the nearest cylinder. CYLINDER=$((($1 + $CYLINDER_SIZE - 1) / $CYLINDER_SIZE)) @@ -174,8 +179,10 @@ # Find the cylinder-addressable size. - CYLINDERS=$(($DEVSIZE / $CYLINDER_SIZE)) - DEVSIZE=$(($CYLINDERS * $CYLINDER_SIZE)) + if [ "$ALIGN_CYLINDER" ] ; then + CYLINDERS=$(($DEVSIZE / $CYLINDER_SIZE)) + DEVSIZE=$(($CYLINDERS * $CYLINDER_SIZE)) + fi } @@ -184,7 +191,7 @@ if [ "$1" = '--help' ] ; then cat 1>&2 < | -p | -s )... +Usage: $PROGNAME [ --align ] ( -f | -p | -s )... Produce partition descriptions, indicating partition type, start position and size for each partition. Each occurrence of the -f option starts a new partition @@ -196,11 +203,24 @@ remainder of the device will be used. Types recognised include ext, ext2, ext3, ext4, fat and swap. Other types are -interpreted as Linux partitions. +interpreted as Linux partitions. + +If the --align option is specified, align partitions to cylinders for the +satisfaction of earlier sfdisk versions that are obsessed with cylinders, heads +and sectors. EOF exit 0 fi +# Test for the cylinder alignment option. + +if [ "$1" = '--align' ] ; then + ALIGN_CYLINDER="$1" + shift 1 +else + ALIGN_CYLINDER= +fi + # Obtain details of the selected device. if [ ! "$DEV" ] ; then @@ -210,6 +230,13 @@ exit 1 fi +if [ ! -e "$DEV" ] ; then + cat 1>&2 <