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-easy | |
parent | d4fe57f377d8f78f02a9e5f6d9c201b4e9eb86f4 (diff) |
rearrange source tree to match that of the tarball
Diffstat (limited to 'bin/rainbow-easy')
-rwxr-xr-x | bin/rainbow-easy | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/rainbow-easy b/bin/rainbow-easy new file mode 100755 index 0000000..b5a5c34 --- /dev/null +++ b/bin/rainbow-easy @@ -0,0 +1,26 @@ +#!/bin/bash + +function usage() { + echo "sudo $0 ID /path/to/program" + echo "ex: sudo $0 banking /bin/bash" + exit 1 +} + +if [ -z "$1" ] || [ -z "$SUDO_USER" ]; then usage || exit 1; fi + +ID="$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 -i "${SUDO_USER}_${ID}" -E "DISPLAY=$DISPLAY" -E "XAUTHORITY=${XAUTHORITY:-${HOME}/.Xauthority}" -a /usr/bin/rainbow-xify -o audio -o network -- "$@" |