diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2010-12-13 13:37:12 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2010-12-13 13:37:12 +0100 |
commit | f522341aa5492bf62786a1bd7c473ef1fe045f4e (patch) | |
tree | 6b8f70f20ef5e60a11772aae8178fbd8385838dd /src | |
parent | 8823aaa20db357cf3e1ebc50a0b43254a8090868 (diff) |
properly show partition info in "Manage filesystems"
this was broken since 6d8f39a5e114755b67b86529e6f16b7d9ee752df
also, partinfo gathering is now in lib-blockdevices-filesystems.sh
Diffstat (limited to 'src')
-rw-r--r-- | src/core/libs/lib-blockdevices-filesystems.sh | 16 | ||||
-rw-r--r-- | src/core/libs/lib-ui-interactive.sh | 11 |
2 files changed, 18 insertions, 9 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index f688789..37aff4a 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -446,6 +446,22 @@ process_disk () partition $1 "$2" } +# fills variables with info found in $TMP_BLOCKDEVICES +# $1 partition to look for +# $2 value to replace "no_foo" values with (optional) (can be '') +getpartinfo () { + part=$1 + declare part_escaped=${part//\//\\/} # escape all slashes otherwise awk complains + declare part_escaped=${part_escaped/+/\\+} # escape the + sign too + part_type=$( awk "/^$part_escaped / {print \$2}" $TMP_BLOCKDEVICES) + part_label=$(awk "/^$part_escaped / {print \$3}" $TMP_BLOCKDEVICES) + fs=$( awk "/^$part_escaped / {print \$4}" $TMP_BLOCKDEVICES) + if [ -n "${2+2}" ]; then # checking if a var is defined, in bash. + [ "$part_label" = no_label ] && part_label=$2 + [ "$fs" = no_fs ] && fs=$2 + fi +} + # $1 fs_string # $2 value to replace "no_foo" values with (optional) (can be '') # when given, __ will be translated to ' ' as well diff --git a/src/core/libs/lib-ui-interactive.sh b/src/core/libs/lib-ui-interactive.sh index 4230fde..4d3a141 100644 --- a/src/core/libs/lib-ui-interactive.sh +++ b/src/core/libs/lib-ui-interactive.sh @@ -609,15 +609,8 @@ device type label size type create? mountpoint options label params" required "$ [ $? -gt 0 ] && return 1 [ "$ANSWER_OPTION" == DONE ] && USERHAPPY=1 && break - part=$ANSWER_OPTION - - declare part_escaped=${part//\//\\/} # escape all slashes otherwise awk complains - declare part_escaped=${part_escaped/+/\\+} # escape the + sign too - part_type=$( awk "/^$part_escaped / {print \$2}" $TMP_BLOCKDEVICES) - part_label=$(awk "/^$part_escaped / {print \$3}" $TMP_BLOCKDEVICES) - fs=$( awk "/^$part_escaped / {print \$4}" $TMP_BLOCKDEVICES) - [ "$part_label" == no_label ] && part_label= - [ "$fs" == no_fs ] && fs= + part=$(echo $ANSWER_OPTION | cut -d ' ' -f1) + getpartinfo $part '' if [ $part_type = lvm-vg ] # one lvm VG can host multiple LV's so that's a bit a special blockdevice... then |