From 00679f5bb76149773c2fefcc35c8c8a9bad3790b Mon Sep 17 00:00:00 2001 From: udeved Date: Thu, 2 Jul 2015 22:54:24 +0200 Subject: [PATCH] [manjaro-chroot] add os detect here --- bin/manjaro-chroot.in | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bin/manjaro-chroot.in b/bin/manjaro-chroot.in index 5aad966..265fe6a 100644 --- a/bin/manjaro-chroot.in +++ b/bin/manjaro-chroot.in @@ -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