From 5e3b8b78930d61d6f380edb84652f3a679dd9ffa Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 06 Oct 2014 17:23:00 -0400 Subject: session: Run commands in a "wd" subdirectory --- (limited to 'lib') 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}" } -- cgit v0.9.1