1 #!/bin/sh 2 3 # Common routines. 4 5 # Test for a selected device. 6 7 check_device() 8 { 9 if [ ! "$DEV" ] ; then 10 cat 1>&2 <<EOF 11 No device specified. Use the DEV environment variable to indicate a device. 12 EOF 13 exit 1 14 fi 15 16 if [ ! -e "$DEV" ] ; then 17 cat 1>&2 <<EOF 18 Device not found: $DEV 19 EOF 20 exit 1 21 fi 22 } 23 24 # Process partition field values in summary tables. 25 26 read_fields() 27 { 28 OLDIFS=$IFS 29 IFS=`echo -n '\t'` read START SIZE TYPE 30 STATUS=$? 31 IFS=$OLDIFS 32 return $STATUS 33 } 34 35 # test_align_cylinder <args> 36 # 37 # Test for the cylinder alignment option. 38 39 test_align_cylinder() 40 { 41 if [ "$1" = '--align' ] ; then 42 ALIGN_CYLINDER="$1" 43 return 0 44 else 45 ALIGN_CYLINDER= 46 return 1 47 fi 48 } 49 50 align_cylinder_description() 51 { 52 cat <<EOF 53 If the --align option is specified, align partitions to cylinders for the 54 satisfaction of earlier sfdisk versions that are obsessed with cylinders, heads 55 and sectors. 56 EOF 57 }