diff options
author | Guillem Jover <guillem@debian.org> | 2009-05-24 21:13:26 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2009-05-24 21:20:04 +0200 |
commit | 885726e7585b081eca172df9cda2a57134564922 (patch) | |
tree | 9aee2c986d50f17be212f43f07956b48c8e07848 /dselect | |
parent | 93bb330136c95fd0f5e4ed1d29987dc64e4ba218 (diff) | |
download | dpkg-885726e7585b081eca172df9cda2a57134564922.tar.gz |
dselect: Refactor partition printing in disk setup method
Move code into its own function.
Diffstat (limited to 'dselect')
-rwxr-xr-x | dselect/methods/disk/setup | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/dselect/methods/disk/setup b/dselect/methods/disk/setup index be3b5650a..1da9b9d16 100755 --- a/dselect/methods/disk/setup +++ b/dselect/methods/disk/setup @@ -41,6 +41,13 @@ yesno () { done } +print_partition_table() +{ + device="$1" + + echo -e "p\nq\n" | fdisk "$device" 2>/dev/null +} + getblockdev () { mountpoint="$vardir/methods/mnt" if [ -z "$defaultdevice" ] @@ -72,7 +79,7 @@ getblockdev () { then blockbase="`echo \"$tryblockdevice\" | sed -e 's/[0-9]\{1,\}$//'`" set +e - echo -e "p\nq\n" | fdisk "$blockbase" 2>/dev/null >$tp.f + print_partition_table "$blockbase" >$tp.f set -e proposeddevice="$tryblockdevice" perl -ne ' next unless /^ *Device +Boot +Begin +Start +End +Blocks +Id +System *$/i .. !/\S/; @@ -285,10 +292,10 @@ fi if [ $option = harddisk ] then set +e - echo -e 'p\nq\n' | fdisk /dev/hda 2>/dev/null >$tp.f + print_partition_table /dev/hda >$tp.f if [ $? != 0 ] then - echo -e 'p\nq\n' | fdisk /dev/sda 2>/dev/null >$tp.f + print_partition_table /dev/sda >$tp.f fi set -e perl -ne ' |