summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2009-02-22 20:33:08 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2009-02-22 20:33:08 +0100
commitb99b1a15867c7b10c65f19d2fd0683237a6195d5 (patch)
treec5dfb9081cd873730c15df099d4cc0dd15fbc015
parent857ede360d7877576fb146b3db5f7cccf2f7658a (diff)
blockdevice documentation cleanup + use MiB in interactive blockdevice things instead of MB. inspired by FS#12949 - "hdparm -I" fails in VMware 0002-Using-MiB-and-GiB-instead-of-MB-and-GB-respectively.patch
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh35
-rw-r--r--src/core/libs/lib-ui-interactive.sh21
2 files changed, 29 insertions, 27 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index 28fb51c..4400b8b 100644
--- a/src/core/libs/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
@@ -3,18 +3,23 @@
# FORMAT DEFINITIONS:
-# MAIN FORMAT FOR $TMP_BLOCKDEVICES (format used to interface with this library): one line per blockdevice, multiple fs'es in 1 'fs-string'
-# $TMP_BLOCKDEVICES entry.
-# <blockdevice> type label/no_label <FS-string>/no_fs
-# FS-string:
-# type;recreate(yes/no);mountpoint;mount?(target,runtime,no);opts;label;params[|FS-string|...] where opts/params have _'s instead of whitespace if needed
-# NOTE: the 'mount?' for now just matters for the location (if 'target', the target path gets prepended and mounted in the runtime system)
-# NOTE: filesystems that span multiple underlying filesystems/devices (eg lvm VG) should specify those in params, separated by colons. \
-# the <blockdevice> in the beginning doesn't matter much, it can be pretty much any device, or not existent, i think. But it's probably best to make it one of the devices listed in params
-# no '+' characters allowed for devices in $fs_params (eg use the real names)
-
-
-# ADDITIONAL INTERNAL FORMAT FOR $TMP_FILESYSTEMS: each filesystem on a separate line, so block devices can appear multiple times be on multiple lines (eg LVM volumegroups with more lvm LV's)
+# -- formats used to interface with this library --
+# $TMP_PARTITIONS
+# one line per partition, blockdevice + partioning string for sfdisk. See docs for function partition for more info.
+# $TMP_BLOCKDEVICES
+# one line per blockdevice, multiple fs'es in 1 'fs-string'
+# $TMP_BLOCKDEVICES entry.
+# <blockdevice> type label/no_label <FS-string>/no_fs
+# FS-string:
+# type;recreate(yes/no);mountpoint;mount?(target,runtime,no);opts;label;params[|FS-string|...] where opts/params have _'s instead of whitespace if needed
+# NOTE: the 'mount?' for now just matters for the location (if 'target', the target path gets prepended and mounted in the runtime system)
+# NOTE: filesystems that span multiple underlying filesystems/devices (eg lvm VG) should specify those in params, separated by colons. \
+# the <blockdevice> in the beginning doesn't matter much, it can be pretty much any device, or not existent, i think. But it's probably best to make it one of the devices listed in params
+# no '+' characters allowed for devices in $fs_params (eg use the real names)
+
+
+# -- ADDITIONAL INTERNAL FORMATS --
+# $TMP_FILESYSTEMS: each filesystem on a separate line, so block devices can appear multiple times be on multiple lines (eg LVM volumegroups with more lvm LV's)
# part part_type part_label fs_type fs_create fs_mountpoint fs_mount fs_opts fs_label fs_params
@@ -271,7 +276,7 @@ target_configure_fstab()
# partitions a disk. heavily altered
# $1 device to partition
-# $2 a string of the form: <partsize>:<fstype>[:+] (the + is bootable flag)
+# $2 a string of the form: <partsize in MiB>:<fstype>[:+] (the + is bootable flag)
partition()
{
debug "Partition called like: partition '$1' '$2'"
@@ -329,10 +334,6 @@ EOF
}
-# file layout:
-#TMP_PARTITIONS
-# disk partition-scheme
-
# go over each disk in $TMP_PARTITIONS and partition it
process_disks ()
{
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index 8076a0e..606a0e0 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -113,7 +113,7 @@ interactive_autoprepare()
DISC=${DISC// /} # strip all whitespace. we need this for some reason.TODO: find out why
- get_blockdevice_size $DISC MB
+ get_blockdevice_size $DISC MiB
FSOPTS=
which `get_filesystem_program ext2` &>/dev/null && FSOPTS="$FSOPTS ext2 Ext2"
which `get_filesystem_program ext3` &>/dev/null && FSOPTS="$FSOPTS ext3 Ext3"
@@ -123,12 +123,12 @@ interactive_autoprepare()
which `get_filesystem_program jfs` &>/dev/null && FSOPTS="$FSOPTS jfs JFS"
which `get_filesystem_program vfat` &>/dev/null && FSOPTS="$FSOPTS vfat VFAT"
- ask_number "Enter the size (MB) of your /boot partition. Recommended size: 100MB\n\nDisk space left: $BLOCKDEVICE_SIZE MB" 16 $BLOCKDEVICE_SIZE || return 1
+ ask_number "Enter the size (MiB) of your /boot partition. Recommended size: 100MiB\n\nDisk space left: $BLOCKDEVICE_SIZE MiB" 16 $BLOCKDEVICE_SIZE 100 || return 1
BOOT_PART_SIZE=$ANSWER_NUMBER
BLOCKDEVICE_SIZE=$(($BLOCKDEVICE_SIZE-$BOOT_PART_SIZE))
- ask_number "Enter the size (MB) of your swap partition. Recommended size: 256MB\n\nDisk space left: $BLOCKDEVICE_SIZE MB" 1 $BLOCKDEVICE_SIZE || return 1
+ ask_number "Enter the size (MiB) of your swap partition. Recommended size: 256MiB\n\nDisk space left: $BLOCKDEVICE_SIZE MiB" 1 $BLOCKDEVICE_SIZE 256 || return 1
SWAP_PART_SIZE=$ANSWER_NUMBER
BLOCKDEVICE_SIZE=$(($BLOCKDEVICE_SIZE-$SWAP_PART_SIZE))
@@ -136,9 +136,9 @@ interactive_autoprepare()
ROOT_PART_SET=""
while [ "$ROOT_PART_SET" = "" ]
do
- ask_number "Enter the size (MB) of your / partition. Recommended size:7500. The /home partition will use the remaining space.\n\nDisk space left: $BLOCKDEVICE_SIZE MB" 1 $BLOCKDEVICE_SIZE || return 1
+ ask_number "Enter the size (MiB) of your / partition. Recommended size:7500. The /home partition will use the remaining space.\n\nDisk space left: $BLOCKDEVICE_SIZE MiB" 1 $BLOCKDEVICE_SIZE 7500 || return 1
ROOT_PART_SIZE=$ANSWER_NUMBER
- ask_yesno "$(($BLOCKDEVICE_SIZE-$ROOT_PART_SIZE)) MB will be used for your /home partition. Is this OK?" yes && ROOT_PART_SET=1 #TODO: when doing yes, cli mode prints option JFS all the time, dia mode goes back to disks menu
+ ask_yesno "$(($BLOCKDEVICE_SIZE-$ROOT_PART_SIZE)) MiB will be used for your /home partition. Is this OK?" yes && ROOT_PART_SET=1 #TODO: when doing yes, cli mode prints option JFS all the time, dia mode goes back to disks menu
done
CHOSEN_FS=""
@@ -351,10 +351,11 @@ interactive_filesystem ()
fi
if [ "$fs_type" = lvm-lv ]
then
- [ -z "$fs_params" ] && default='5G'
+ [ -z "$fs_params" ] && default='5000'
[ -n "$fs_params" ] && default="$fs_params"
- ask_string "Enter the size for this $fs_type on $part (suffix K,M,G,T,P,E. default is M)" "$default" || return 1
- fs_params=$ANSWER_STRING
+ ask_number "Enter the size for this $fs_type on $part in MiB" 1 0 "$default" || return 1 #TODO: can we get the upperlimit from somewhere?
+ # Lvm tools use binary units but have their own suffixes ( K,M,G,T,P,E, but they mean KiB, MiB etc)
+ fs_params="${ANSWER_NUMBER}M"
fi
if [ "$fs_type" = dm_crypt ]
then
@@ -449,9 +450,9 @@ interactive_filesystems() {
fs_display=${fs//;target/}
[ "$label" != no_label ] && label_display="($label)"
[ "$label" = no_label ] && label_display=
- if [ -b "${part/+/}" ] && get_blockdevice_size ${part/+/} MB # test -b <-- exit's 0, test -b '' exits >0.
+ if [ -b "${part/+/}" ] && get_blockdevice_size ${part/+/} MiB # test -b <-- exit's 0, test -b '' exits >0.
then
- infostring="${type},${BLOCKDEVICE_SIZE}MB${label_display}->$fs_display" # add size in MB for existing blockdevices (eg not for mapper devices that are not yet created yet)
+ infostring="${type},${BLOCKDEVICE_SIZE}MiB${label_display}->$fs_display" # add size in MiB for existing blockdevices (eg not for mapper devices that are not yet created yet)
else
infostring="${type}${label_display}->$fs_display"
fi