diff options
author | Sascha Silbe <sascha-pgp@silbe.org> | 2010-07-21 17:30:43 (GMT) |
---|---|---|
committer | Sascha Silbe <sascha-pgp@silbe.org> | 2010-07-21 17:30:43 (GMT) |
commit | 5ab8ddb8ddb8dc6925cb3bb5f52e0a06b7a1c439 (patch) | |
tree | 01e6ca6d9d6eaa54052480200f039c8e50f0166f /bin/rainbow-resume | |
parent | d4fe57f377d8f78f02a9e5f6d9c201b4e9eb86f4 (diff) |
rearrange source tree to match that of the tarball
Diffstat (limited to 'bin/rainbow-resume')
-rwxr-xr-x | bin/rainbow-resume | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/rainbow-resume b/bin/rainbow-resume new file mode 100755 index 0000000..2af756f --- /dev/null +++ b/bin/rainbow-resume @@ -0,0 +1,26 @@ +#!/bin/bash + +function usage() { + echo "sudo $0 RESUME_UID /path/to/program" + echo "ex: sudo $0 banking /bin/bash" + exit 1 +} + +if [ -z "$1" ] || [ -z "$SUDO_USER" ]; then usage || exit 1; fi + +RESUME_UID="$1"; shift + +if [ -z "$DISPLAY" ]; then + DISPLAY=`python <<EOF +import os +from os.path import join + +ppid = os.getppid() +env = open(join('/proc', str(ppid),'environ')).read().split('\0') +for kv in env: + if kv.startswith("DISPLAY="): + print kv[len("DISPLAY="):] +EOF` +fi + +exec rainbow-run -s /var/spool/rainbow/2 -u "$SUDO_USER" -c "`pwd`" -f 0 -f 1 -f 2 -E "DISPLAY=$DISPLAY" -E "XAUTHORITY=$XAUTHORITY" -a /usr/bin/rainbow-xify -o audio -o network -r "$RESUME_UID" -- "$@" |