[manjaro-chroot] add os detect here

This commit is contained in:
udeved 2015-07-02 22:54:24 +02:00
parent 0e7d92f262
commit 00679f5bb7

View file

@ -69,19 +69,24 @@ check_root "$0" "${orig_argv[@]}"
${pretend} && display_settings && exit 1
if ${automount};then
chrootdir=${chroots_dir}/manjaro-chroot
prepare_dir ${chrootdir}
chroot_mount_partitions ${chrootdir}
chrootdir=${chroots_dir}/manjaro-chroot
prepare_dir ${chrootdir}
for os in $(get_os);do
case "${os##*:}" in
'linux')
msg "Detected OS: $(get_os_name $os)"
chroot_mount_partitions ${chrootdir} ${os}
;;
esac
done
SHELL=/bin/sh unshare --fork --pid chroot "${chrootdir}" "/bin/bash"
else
chrootdir=$1
shift
[[ -d ${chrootdir} ]] || die "Can't create chroot on non-directory %s" "${chrootdir}"
chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
chroot_mount /etc/resolv.conf "${chrootdir}/etc/resolv.conf" --bind
SHELL=/bin/sh unshare --fork --pid chroot "${chrootdir}" "$@"
fi