Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stone <michael@laptop.org>2009-03-08 23:41:49 (GMT)
committer Michael Stone <michael@laptop.org>2009-03-08 23:58:03 (GMT)
commitf1d9d02869656af1d009b222518a9aea23783518 (patch)
tree6c451c5f57573aebc2e6f3f516225b8f8d236a04
parenta697f58276f7aabb872196366f989fc637a04503 (diff)
Firefox wants $HOME defined so add rainbow-xify for use with rainbow-easy.
-rw-r--r--rainbow/bin/Makefile12
-rwxr-xr-xrainbow/bin/rainbow-easy2
-rwxr-xr-xrainbow/bin/rainbow-xify76
-rwxr-xr-xrainbow/maintainer2
4 files changed, 86 insertions, 6 deletions
diff --git a/rainbow/bin/Makefile b/rainbow/bin/Makefile
index db34153..ee12760 100644
--- a/rainbow/bin/Makefile
+++ b/rainbow/bin/Makefile
@@ -1,5 +1,9 @@
+
install:
- install -D -m 0755 rainbow-run $(BINDIR)/rainbow-run
- install -D -m 0755 rainbow-easy $(BINDIR)/rainbow-easy
- install -D -m 0755 rainbow-sugarize $(BINDIR)/rainbow-sugarize
- install -D -m 0755 mkenvdir $(BINDIR)/mkenvdir
+ install -D -m 0755 rainbow-run $(BINDIR)/rainbow-run
+ install -D -m 0755 rainbow-easy $(BINDIR)/rainbow-easy
+ install -D -m 0755 rainbow-sugarize $(BINDIR)/rainbow-sugarize
+ install -D -m 0755 rainbow-xify $(BINDIR)/rainbow-xify
+ install -D -m 0755 mkenvdir $(BINDIR)/mkenvdir
+
+.PHONY: install
diff --git a/rainbow/bin/rainbow-easy b/rainbow/bin/rainbow-easy
index ecfa9ac..ac6381a 100755
--- a/rainbow/bin/rainbow-easy
+++ b/rainbow/bin/rainbow-easy
@@ -23,4 +23,4 @@ for kv in env:
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" -o audio -- $@
+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" -a /usr/bin/rainbow-xify -o audio -- $@
diff --git a/rainbow/bin/rainbow-xify b/rainbow/bin/rainbow-xify
new file mode 100755
index 0000000..aa34cd7
--- /dev/null
+++ b/rainbow/bin/rainbow-xify
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+
+import sys
+import pwd
+
+from os import getuid, getgid, environ, chmod, chown
+from os.path import join, isdir, dirname, exists
+from optparse import OptionParser
+from shutil import copyfile
+
+from rainbow.util import make_reporter, trace, make_dirs
+
+sys.excepthook = trace
+
+def main():
+ parser = OptionParser(version='0.1')
+ parser.add_option('-v', '--verbose', default=0, action='count',
+ help='Verbosity. Repeat for more verbose output.')
+ parser.add_option('-q', '--quiet', default=False, action='store_true',
+ help='Quiet. Disable all output.')
+ parser.add_option('-u', '--user', default=None,
+ help="Isolated user.")
+ parser.add_option('-e', '--envdir', default=None,
+ help="Envdir to be used for launching.")
+ opts, args = parser.parse_args()
+ if not opts.user or not opts.envdir:
+ parser.print_help()
+ exit(1)
+
+ report = make_reporter(opts.verbose, opts.quiet, sys.stdout)
+
+ def check_user(report, opts):
+ report(1, 'X-ifying isolated uid %s.', opts.user)
+ return opts.user
+
+ def check_envdir(report, envdir):
+ report(1, 'X-ifying envdir %s.', envdir)
+ assert isdir(envdir)
+ def write_envvar(k, v):
+ report(1, '-E %s=%s', k, v)
+ open(join(envdir, k), 'w').write(v)
+ return write_envvar
+
+ user = check_user(report, opts)
+ write_envvar = check_envdir(report, opts.envdir)
+
+ o = pwd.getpwuid(getuid())
+ i = pwd.getpwnam(user)
+ h_o = o.pw_dir
+ h_i = i.pw_dir
+
+ # XXX: Is it _always_ right to set these defaults? <MS>
+ environ.setdefault('XAUTHORITY', join(h_o, '.Xauthority'))
+ environ.setdefault('ICEAUTHORITY', join(h_o, '.ICEauthority'))
+
+ for cookie in ['XAUTHORITY', 'ICEAUTHORITY']:
+ if exists(environ[cookie]):
+ cookie_path = join(h_i, cookie)
+ make_dirs(dirname(cookie_path), getuid(), getgid(), 0777)
+ copyfile(environ[cookie], cookie_path)
+ chmod(cookie_path, 0666)
+ chown(cookie_path, o.pw_uid, i.pw_gid)
+ write_envvar(cookie, cookie_path)
+ else:
+ report(1, "Cookie %s -> %s which doesn't exist.", cookie, environ[cookie])
+
+ write_envvar('USER', i.pw_name)
+ write_envvar('HOME', h_i)
+ write_envvar('TMPDIR', join(h_i, 'tmp'))
+ if 'DISPLAY' in environ:
+ write_envvar('DISPLAY', environ['DISPLAY'])
+
+if __name__ == '__main__':
+ main()
+
+# vim : et sw=4 ts=4 sts=4 :
diff --git a/rainbow/maintainer b/rainbow/maintainer
index cd86f1a..607152c 100755
--- a/rainbow/maintainer
+++ b/rainbow/maintainer
@@ -25,7 +25,7 @@ commit:
git commit --allow-empty -a -m "$(NV)."
$(GITDIR)/refs/tags/$(NV):
- git tag -s -m "$(NV)" $(NV)
+ git tag -s -f -m "$(NV)" $(NV)
tag: $(GITDIR)/refs/tags/$(NV)