From 709087a903ffea5d108a1ea80f14c644b46a1449 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 21 Feb 2013 16:09:17 -0800 Subject: Remove format operational mode commands Bug 8311 Get rid of floppy configuration support --- templates/format/disk/node.def | 1 - templates/format/disk/node.tag/like/node.def | 1 - .../format/disk/node.tag/like/node.tag/node.def | 61 ---------------------- templates/format/disk/node.tag/node.def | 6 --- templates/format/node.def | 1 - templates/format/system-floppy/node.def | 2 - 6 files changed, 72 deletions(-) delete mode 100644 templates/format/disk/node.def delete mode 100644 templates/format/disk/node.tag/like/node.def delete mode 100644 templates/format/disk/node.tag/like/node.tag/node.def delete mode 100644 templates/format/disk/node.tag/node.def delete mode 100644 templates/format/node.def delete mode 100644 templates/format/system-floppy/node.def diff --git a/templates/format/disk/node.def b/templates/format/disk/node.def deleted file mode 100644 index 97df9b7..0000000 --- a/templates/format/disk/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Format a disk drive diff --git a/templates/format/disk/node.tag/like/node.def b/templates/format/disk/node.tag/like/node.def deleted file mode 100644 index c4a5126..0000000 --- a/templates/format/disk/node.tag/like/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Format this disk the same as another disk diff --git a/templates/format/disk/node.tag/like/node.tag/node.def b/templates/format/disk/node.tag/like/node.tag/node.def deleted file mode 100644 index a98cbcc..0000000 --- a/templates/format/disk/node.tag/like/node.tag/node.def +++ /dev/null @@ -1,61 +0,0 @@ -help: Name of disk drive to partition it like - -allowed: - local -a disks ; - proto_disk=${COMP_WORDS[2]} - disks=`cat /proc/partitions | awk '{ if ($4!="name") { print $4 } }' | egrep -v "[0-9]"` - disks=`echo $disks | sed -e s/$proto_disk//g` - echo -n $disks - -run: - proto_disk=$5 - format_disk=$3 - backup_dir=/var/tmp - eligible_format_disks=`cat /proc/partitions | awk '{ if ($4!="name") { print $4 } }' | egrep -v "[0-9]"` - eligible_proto_disks=`echo $eligible_format_disks | sed -e s/$format_disk//g` - proto_eligible=`echo $eligible_proto_disks | grep $proto_disk` - format_eligible=`echo $eligible_format_disks | grep $format_disk` - busy_check=`sudo /sbin/sfdisk -R /dev/$format_disk 2>&1` - - if [ $proto_disk = $format_disk ]; then - echo "The two disk drives must be different." - elif [ ! -b /dev/$proto_disk ]; then - echo "Device /dev/$proto_disk does not exist" - elif [ ! -b /dev/$format_disk ]; then - echo "Device /dev/$format_disk does not exist" - elif [ -z "$format_eligible" ]; then - echo "Device $format_disk can not be formatted" - elif [ -z "$proto_eligible" ]; then - echo "Device $proto_disk can not be used as a prototype for $format_disk" - elif [ -n "$busy_check" ]; then - echo "Disk device $format_disk is busy. Can't format it now." - elif [ ! -r /dev/$format_disk ]; then - echo "Must be admin or root to format disk" - else - echo "This will re-format disk $format_disk so that it has the same disk" - echo "partion sizes and offsets as $proto_disk. This will not copy" - echo "data from $proto_disk to $format_disk. But this will erase all" - echo "data on $format_disk." - echo - echo -n "Do you wish to proceed (yes, NO)? " - read response - if [ "$response" = "yes" ]; then - echo "OK. Re-formating disk drive $format_disk..." - echo "Making backup copy of partitions..." - sudo /sbin/sfdisk -d /dev/$format_disk > $backup_dir/backup_$format_disk.`date +%F-%R` - sleep 1 - partitions=`cat /proc/partitions | grep $format_disk'[0-9]' | awk '{ print $4 }' | sed 's/[a-z]//g'` - if [ -n "$partitions" ]; then - echo -n "Deleting old partitions..." - for part in $partitions ; do - sudo /sbin/parted /dev/$format_disk rm $part - done - echo "" - fi - echo "Creating new partitions on $format_disk based on $proto_disk..." - sudo /sbin/sfdisk -d /dev/$proto_disk | sudo /sbin/sfdisk --force /dev/$format_disk - echo "Done." - else - echo "OK. Disk drive $format_drive will not be re-formated." - fi - fi diff --git a/templates/format/disk/node.tag/node.def b/templates/format/disk/node.tag/node.def deleted file mode 100644 index 2b77c5b..0000000 --- a/templates/format/disk/node.tag/node.def +++ /dev/null @@ -1,6 +0,0 @@ -help: Disk drive name - -allowed: - local -a array ; - array=`cat /proc/partitions | awk '{ if ($4!="name") { print $4 } }' | egrep -v "[0-9]"` - echo -n $array diff --git a/templates/format/node.def b/templates/format/node.def deleted file mode 100644 index 5775951..0000000 --- a/templates/format/node.def +++ /dev/null @@ -1 +0,0 @@ -help: Format a device diff --git a/templates/format/system-floppy/node.def b/templates/format/system-floppy/node.def deleted file mode 100644 index c897913..0000000 --- a/templates/format/system-floppy/node.def +++ /dev/null @@ -1,2 +0,0 @@ -help: Format and prepare a floppy to save the config.boot file -run: sudo /opt/vyatta/sbin/init-floppy -- cgit v1.2.3