[manjaro-chroot] fix run_args

This commit is contained in:
udeved 2015-07-03 11:08:09 +02:00
parent 1326a239e4
commit 783ec43fb1

View file

@ -26,7 +26,7 @@ display_settings(){
msg "ARGS:" msg "ARGS:"
msg2 "automount: ${automount}" msg2 "automount: ${automount}"
msg2 "chroot_args: $@" msg2 "run_args: ${run_args}"
msg "PATHS:" msg "PATHS:"
msg2 "chrootdir: ${chrootdir}" msg2 "chrootdir: ${chrootdir}"
@ -71,22 +71,22 @@ ${pretend} && display_settings && exit 1
if ${automount};then if ${automount};then
chrootdir=${chroots_dir}/manjaro-chroot chrootdir=${chroots_dir}/manjaro-chroot
prepare_dir ${chrootdir} prepare_dir ${chrootdir}
run_args=/bin/bash
for os in $(get_os);do for os in $(get_os);do
case "${os##*:}" in case "${os##*:}" in
'linux') 'linux') chroot_mount_partitions ${chrootdir} ${os} ;;
msg "Detected OS: $(get_os_name $os)"
chroot_mount_partitions ${chrootdir} ${os}
;;
esac esac
done done
SHELL=/bin/sh unshare --fork --pid chroot "${chrootdir}" "/bin/bash"
else else
chrootdir=$1 chrootdir=$1
shift shift
run_args=$@
[[ -d ${chrootdir} ]] || die "Can't create chroot on non-directory %s" "${chrootdir}" [[ -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_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
chroot_mount /etc/resolv.conf "${chrootdir}/etc/resolv.conf" --bind chroot_mount /etc/resolv.conf "${chrootdir}/etc/resolv.conf" --bind
SHELL=/bin/sh unshare --fork --pid chroot "${chrootdir}" "$@"
fi fi
SHELL=/bin/sh unshare --fork --pid chroot "${chrootdir}" "${run_args}"