summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-10-05 13:48:30 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-10-05 13:48:30 (EDT)
commit330c70e06f98665f17bf23dbfb6988c6367ded7b (patch)
treebd4b25367fc96c914995c650a281669f2c3aad77 /lib
parentecd02e3b8aa47fc1b31bea4f170775ec5b44b08d (diff)
session_exec(): New function
Diffstat (limited to 'lib')
-rw-r--r--lib/session.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/session.sh b/lib/session.sh
index e189277..0a18f68 100644
--- a/lib/session.sh
+++ b/lib/session.sh
@@ -105,6 +105,20 @@ session_id()
return 0
}
+session_exec()
+{
+ local args=
+ local session_dir=
+
+ args=''
+ for arg in "${@}"; do
+ arg="'$(printf '%s\n' "${arg}" | sed "s/'/'\\\\''/g")'"
+ args="${args} ${arg}"
+ done
+ session_dir="/prokit/sessions/${session_id}"
+ chroot "${session_root}" /bin/sh -c "cd ${session_dir}; ${args}"
+}
+
session_mount()
{
local fs=