summaryrefslogtreecommitdiff
path: root/utils/fakeroot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/fakeroot.sh')
-rw-r--r--utils/fakeroot.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/utils/fakeroot.sh b/utils/fakeroot.sh
index 1ace1cf7..a64e9631 100644
--- a/utils/fakeroot.sh
+++ b/utils/fakeroot.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Execute a command in an environment where it appears to be root.
#
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2013 Free Software Foundation, Inc.
#
# This file is part of the GNU Hurd.
#
@@ -54,10 +54,16 @@ if [ $# -eq 0 ]; then
set -- ${SHELL:-/bin/sh}
fi
+TARGET=
+until [ $# -eq 0 ]; do
+ TARGET="${TARGET} '$(echo "$1" | sed -e "s/'/'\\\\''/g")'"
+ shift
+done
+
# 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 `pwd`; $*" \
+ /bin/fakeauth /bin/sh -c "cd `pwd`; exec ${TARGET}" \
-- / /hurd/fakeroot