From 35ae0168bbdae2eb7029262f49d394046a67860f Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Fri, 15 Jan 2016 18:56:25 +0100 Subject: utils/settrans: improve --chroot functionality Add an option '--chroot-chdir' to settrans and make it chdir to this directory before executing the target program. Also, look up the executable in PATH. With these changes we no longer need to use the shell inside the chroot in the convenience scripts, and hence do not require it to be installed inside the chroot. * utils/fakeroot.sh: Simplify using the new option. * utils/remap.sh: Likewise. * utils/settrans.c (OPT_CHROOT_CHDIR): New constant. (options): New option 'chroot-chdir'. (main): Handle new option. Search for target executable in PATH. * utils/fakeauth.c (main): Likewise. --- utils/fakeroot.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'utils/fakeroot.sh') diff --git a/utils/fakeroot.sh b/utils/fakeroot.sh index 6993365d..7bc5dc73 100644 --- a/utils/fakeroot.sh +++ b/utils/fakeroot.sh @@ -54,12 +54,9 @@ if [ $# -eq 0 ]; then set -- ${SHELL:-/bin/sh} fi -# We exec settrans, which execs the "fakeauth" command in the chroot context. -# The `pwd` is evaluated here and now, and that result interpreted inside -# the shell running under fakeauth to chdir there inside the chroot world. -# That shell then execs our arguments as a command line. -exec /bin/settrans --chroot \ - /bin/fakeauth \ - /bin/sh -c 'cd "$1" || exit ; shift ; exec "$@"' \ - "$1" "$PWD" "$@" \ - -- / /hurd/fakeroot +# We exec settrans, which execs the "fakeauth" command in the chroot +# context provided by /hurd/fakeroot. +exec /bin/settrans \ + --chroot-chdir "$PWD" \ + --chroot /bin/fakeauth "$@" -- \ + / /hurd/fakeroot -- cgit v1.2.3