diff options
author | P. 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) |
commit | 330c70e06f98665f17bf23dbfb6988c6367ded7b (patch) | |
tree | bd4b25367fc96c914995c650a281669f2c3aad77 | |
parent | ecd02e3b8aa47fc1b31bea4f170775ec5b44b08d (diff) |
session_exec(): New function
-rw-r--r-- | lib/session.sh | 14 |
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= |