aboutsummaryrefslogtreecommitdiff
path: root/utils/remap.sh
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2016-01-15 18:56:25 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2016-02-05 09:29:00 +0100
commit35ae0168bbdae2eb7029262f49d394046a67860f (patch)
treecefe363fd40828f561be6b978e4edd2024f21835 /utils/remap.sh
parent6e22fb5616dbacad58cc55544a00efece0477a9a (diff)
downloadhurd-35ae0168bbdae2eb7029262f49d394046a67860f.tar.gz
hurd-35ae0168bbdae2eb7029262f49d394046a67860f.tar.bz2
hurd-35ae0168bbdae2eb7029262f49d394046a67860f.zip
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.
Diffstat (limited to 'utils/remap.sh')
-rw-r--r--utils/remap.sh14
1 files changed, 6 insertions, 8 deletions
diff --git a/utils/remap.sh b/utils/remap.sh
index f24ed0e7..40c2d76e 100644
--- a/utils/remap.sh
+++ b/utils/remap.sh
@@ -57,11 +57,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/sh -c 'cd "$1" || exit ; shift ; exec "$@"' \
- "$1" "$PWD" "$@" \
- -- / /hurd/remap $MAPPED
+# We exec settrans, which execs the target command in the chroot
+# context provided by /hurd/remap.
+exec /bin/settrans \
+ --chroot-chdir "$PWD" \
+ --chroot "$@" -- \
+ / /hurd/remap $MAPPED