forked from mirrored-repos/manjaro-tools
[util-mount] fix chroot -a
- patch by Christian Finnberg
This commit is contained in:
parent
ce4a92f362
commit
204ae9004f
1 changed files with 21 additions and 23 deletions
|
@ -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
|
||||
done
|
||||
i=0
|
||||
msg "Detected systems:"
|
||||
local i=0
|
||||
for os in ${os_list[@]}; do
|
||||
info "$i) $(get_os_name $os)"; i=$((i+1))
|
||||
done
|
||||
msg "Select system to mount [0-%s] : " "$((count-1))"
|
||||
read select
|
||||
else
|
||||
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(){
|
||||
|
|
Loading…
Reference in a new issue