[util-mount] tweak select_os(); cosmetics

This commit is contained in:
udeved 2016-01-08 19:37:15 +01:00
parent d680ca366b
commit c28c2cde18

View file

@ -50,27 +50,27 @@ select_os(){
msg "Detected systems:" msg "Detected systems:"
local i=0 local i=0
for os in ${os_list[@]};do for os in ${os_list[@]};do
if [[ ${os##*:} == 'efi' ]];then local last=${os##*:}
count=$((count-1)) case $last in
else 'efi') count=$((count-1)) ;;
msg3 "$i) $(get_os_name $os)" *) msg3 "$i) $(get_os_name $os)"; i=$((i+1)) ;;
i=$((i+1)) esac
fi
done done
i=0 i=0
msg "Select system to mount [0-$((count-1))] : " msg "Select system to mount [0-$((count-1))] : "
read selected read select
else else
selected=0 select=0
fi fi
local os_str=${os_list[$selected]} type local os_str=${os_list[$select]} type
type=$os_str type=$os_str
root=${os_str%%:*} root=${os_str%%:*}
type=${type##*:} type=${type##*:}
if [[ "${type##*:}" == 'linux' ]];then if [[ "${type##*:}" == 'linux' ]];then
msg "Mounting ($(get_os_name $os_str)) [$root]"
chroot_mount_partitions "$1" "$root" chroot_mount_partitions "$1" "$root"
else else
die "You can't mount $selected!" die "You can't mount $select!"
fi fi
} }
@ -88,8 +88,7 @@ chroot_mount_partitions(){
for entry in ${mounts[@]}; do for entry in ${mounts[@]}; do
entry=${entry//UUID=} entry=${entry//UUID=}
local dev=${entry%:*} local dev=${entry%:*} mp=${entry#*:}
local mp=${entry#*:}
case "${entry#*:}" in case "${entry#*:}" in
'/'|'swap'|'none') continue ;; '/'|'swap'|'none') continue ;;
*) chroot_part_mount "/dev/disk/by-uuid/${dev}" "$1${mp}" ;; *) chroot_part_mount "/dev/disk/by-uuid/${dev}" "$1${mp}" ;;