From 330c70e06f98665f17bf23dbfb6988c6367ded7b Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 05 Oct 2014 13:48:30 -0400 Subject: session_exec(): New function --- (limited to 'lib') 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= -- cgit v0.9.1