summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh19
-rw-r--r--src/core/libs/lib-ui-interactive.sh28
2 files changed, 27 insertions, 20 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index 2cb5652..8accfab 100644
--- a/src/core/libs/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
@@ -447,7 +447,8 @@ process_disk ()
}
# $1 fs_string
-# $2 decode yes/no
+# $2 value to replace "no_foo" values with (optional) (can be '')
+# when given, __ will be translated to ' ' as well
parse_filesystem_string ()
{
fs="$1"
@@ -458,15 +459,15 @@ parse_filesystem_string ()
fs_opts=` cut -d ';' -f 5 <<< $fs`
fs_label=` cut -d ';' -f 6 <<< $fs`
fs_params=` cut -d ';' -f 7 <<< $fs`
- if [ "$2" == 'yes' ]; then
+ if [ -n "${2+2}" ]; then # checking if a var is defined, in bash.
fs_opts="${fs_opts//__/ }"
fs_params="${fs_params//__/ }"
- [ "$fs_type" = no_type ] && fs_type=
- [ "$fs_mountpoint" = no_mountpoint ] && fs_mountpoint=
- [ "$fs_mount" = no_mount ] && fs_mount=
- [ "$fs_opts" = no_opts ] && fs_opts=
- [ "$fs_label" = no_label ] && fs_label=
- [ "$fs_params" = no_params ] && fs_params=
+ [ "$fs_type" = no_type ] && fs_type=$2
+ [ "$fs_mountpoint" = no_mountpoint ] && fs_mountpoint=$2
+ [ "$fs_mount" = no_mount ] && fs_mount=$2
+ [ "$fs_opts" = no_opts ] && fs_opts=$2
+ [ "$fs_label" = no_label ] && fs_label=$2
+ [ "$fs_params" = no_params ] && fs_params=$2
fi
}
@@ -750,7 +751,7 @@ process_filesystem ()
debug 'FS' "process_filesystem $@"
local ret=0
part=$1
- parse_filesystem_string "$2;$3;$4;$5;$6;$7;$8" yes
+ parse_filesystem_string "$2;$3;$4;$5;$6;$7;$8" ''
# Create the FS
if [ "$fs_create" = yes ]
diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh
index ca6ec97..77bc194 100644
--- a/src/core/libs/lib-ui-interactive.sh
+++ b/src/core/libs/lib-ui-interactive.sh
@@ -371,7 +371,7 @@ interactive_filesystem ()
NEW_FILESYSTEM=
if [ -n "$fs_string" ]
then
- parse_filesystem_string "$fs_string" yes
+ parse_filesystem_string "$fs_string" ''
local old_fs_type=$fs_type
local old_fs_create=$fs_create
local old_fs_mountpoint=$fs_mountpoint
@@ -589,22 +589,28 @@ interactive_filesystems() {
menu_list=()
while read part type label fs
do
- # leave out unneeded info from fs string
- fs_display=${fs//;yes/}
- fs_display=${fs//;target/}
- [ "$label" != no_label ] && label_display="($label)"
- [ "$label" = no_label ] && label_display=
+ parse_filesystem_string "$fs" '-'
+ fs_create_display=N
+ [ "fs_create" = yes ] && fs_create_display=Y
+ fs_display="$fs_type $fs_create_display $fs_mountpoint $fs_opts $fs_label fs_params"
+
+ part_label_display=-
+ part_size_display=-
+ [ "$label" != no_label ] && part_label_display="$label"
+ # add size in MiB for existing blockdevices (eg not for mapper devices that are not yet created yet)
if [ -b "${part/+/}" ] && get_blockdevice_size ${part/+/} MiB # test -b <-- exit's 0, test -b '' exits >0.
then
- 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"
+ part_size_display="${BLOCKDEVICE_SIZE}MiB"
fi
- menu_list+=("$part" "$infostring")
+ part_display="$part $type $part_label_display $part_size_display"
+ menu_list+=("$part_display" "$fs_display")
done < $TMP_BLOCKDEVICES
ask_option no "Manage filesystems" "Here you can manage your filesystems, block devices and virtual devices (device mapper). \
- Note that you don't *need* to specify opts, labels or extra params if you're not using lvm, dm_crypt, etc." required "${menu_list[@]}" DONE _
+ Note that you don't *need* to specify opts, labels or extra params if you're not using lvm, dm_crypt, etc.\
+ The display format is as follows:\n\
+Partition Filesystem\n\
+devicefile type label size type recreate(Y/N) mountpoint options label params [|...]" required "${menu_list[@]}" DONE _
[ $? -gt 0 ] && return 1
[ "$ANSWER_OPTION" == DONE ] && USERHAPPY=1 && break