+partition_drive()
+{
+ echo -n > $menufile
+ for i in /sys/block/[shv]d[a-z] /sys/block/mmcblk?; do
+ if [ ! -d $i ]; then # pathname expansion failed
+ continue
+ fi
+ echo -n `basename $i` >> $menufile
+ if [ -f $i/removable -a `cat $i/removable` -eq 0 ]; then
+ echo -n ' "Harddisk ' >> $menufile
+ else
+ echo -n ' "Removable' >> $menufile
+ fi
+ if [ -f $i/size ]; then
+ echo -n " (" `cat $i/size` "blocks)" >> $menufile
+ fi
+ echo '"' >> $menufile
+ done
+ count=`wc -l $menufile | awk '{ print $1 }'`
+ if [ $count -eq 0 ]; then
+ dialog --title " Error " --msgbox \
+ "\nOK. There is no hard drive to edit partitions." 8 49
+ return 255
+ fi
+ if [ $count -eq 1 ]; then
+ choice=`awk '{ print $1 }' $menufile`
+ retval=0
+ else
+ choose "Choose Drive" "Please select a drive to edit partitions:"
+ fi
+ if [ $retval -eq 0 ]; then
+ cfdisk /dev/$choice
+ if [ $? -eq 0 ]; then
+ retval=1
+ else
+ retval=255
+ fi
+ fi
+ return $retval
+}
+