diff options
author | P. J. McDermott <pj@pehjota.net> | 2014-10-06 17:23:00 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2014-10-06 17:23:00 (EDT) |
commit | 5e3b8b78930d61d6f380edb84652f3a679dd9ffa (patch) | |
tree | 55a352afad317b61ffc8640a4a1fc21f692c7524 /lib | |
parent | 7fb9b7d3665726dc4c86d1a476e4b13dd41c4981 (diff) |
session: Run commands in a "wd" subdirectory
Diffstat (limited to 'lib')
-rw-r--r-- | lib/session.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/session.sh b/lib/session.sh index e745822..f0ec186 100644 --- a/lib/session.sh +++ b/lib/session.sh @@ -71,9 +71,10 @@ session_begin() # Register the session. mkdir "${session_root}/prokit/sessions/${session_id}" + mkdir "${session_root}/prokit/sessions/${session_id}/wd" profile_bind_mount "${session_arch}" "${session_plat}" \ "${session_mountdir}" \ - "${session_root}/prokit/sessions/${session_id}" + "${session_root}/prokit/sessions/${session_id}/wd" mutex_unlock "${session_root}/prokit/sessions.lock" } @@ -83,7 +84,8 @@ session_end() # Unregister the session. profile_bind_umount "${session_arch}" "${session_plat}" \ "${session_mountdir}" \ - "${session_root}/prokit/sessions/${session_id}" + "${session_root}/prokit/sessions/${session_id}/wd" + rmdir "${session_root}/prokit/sessions/${session_id}/wd" rmdir "${session_root}/prokit/sessions/${session_id}" if ! mutex_lock_timeout "${session_root}/prokit/sessions.lock" 5; then @@ -121,7 +123,7 @@ session_exec() arg="'$(printf '%s\n' "${arg}" | sed "s/'/'\\\\''/g")'" args="${args} ${arg}" done - session_dir="/prokit/sessions/${session_id}" + session_dir="/prokit/sessions/${session_id}/wd" chroot "${session_root}" /bin/sh -c "cd ${session_dir}; ${args}" } |