[util-mount] fix chroot -a

- patch by Christian Finnberg
This commit is contained in:
Philip Müller 2020-09-02 20:33:52 +02:00
parent ce4a92f362
commit 204ae9004f

View file

@ -45,33 +45,31 @@ chroot_part_mount() {
}
select_os(){
local os_list=( $(detect) ) count=${#os_list[@]}
local detected_os_list=( $(detect) ) os_list=() count select os_str os_root
for os in ${detected_os_list[@]}; do
case ${os##*:} in
'linux') os_list+=($os)
esac
done
count=${#os_list[@]}
if [[ ${count} < 1 ]]; then
die "No Linux partitions detected!"
fi
if [[ ${count} > 1 ]]; then
msg "Detected systems:"
local i=0
for os in ${os_list[@]}; do
local last=${os##*:}
case $last in
'efi') count=$((count-1)) ;;
*) info "$i) $(get_os_name $os)"; i=$((i+1)) ;;
esac
info "$i) $(get_os_name $os)"; i=$((i+1))
done
i=0
msg "Select system to mount [0-%s] : " "$((count-1))"
read select
else
select=0
fi
local os_str=${os_list[$select]} type
type=$os_str
root=${os_str%%:*}
type=${type##*:}
if [[ "${type##*:}" == 'linux' ]]; then
msg "Mounting (%s) [%s]" "$(get_os_name $os_str)" "$root"
chroot_mount_partitions "$1" "$root"
else
die "You can't mount %s!" "$select"
fi
os_str=${os_list[$select]}
os_root=${os_str%%:*}
msg "Mounting (%s) [%s]" "$(get_os_name $os_str)" "$os_root"
chroot_mount_partitions "$1" "$os_root"
}
chroot_mount_partitions(){