Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
timbertson committed Jul 28, 2011
1 parent a2ba317 commit 168aae3
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 1 deletion.
1 change: 0 additions & 1 deletion bin/.gitignore

This file was deleted.

87 changes: 87 additions & 0 deletions bin/chrome-on-a-stick
@@ -0,0 +1,87 @@
#!/usr/bin/env python

from optparse import OptionParser
import os, sys
import shutil
import tempfile
import urllib2
import subprocess
import re
import stat

default_path = os.path.expanduser("~/.config/chromium")

def main():
p = OptionParser("Usage: %prog <action>")
p.add_option('-c', '--create', action='store_const', const='create', dest='action', default='run')
p.add_option('-r', '--run', action='store_const', const='run', dest='action')
p.add_option('--profile', default=None, dest='path')
p.add_option('-x', '--exec', default='google-chrome', help='browser executable')
p.add_option('--dump', action='store_true', help='dump payload')
p.add_option('--bootstrap', action='store_const', dest='action', const='bootstrap')
opts, args = p.parse_args()
assert len(args) == 0
opts.path = opts.path or default_path
import getpass
passwd = getpass.getpass("password:")
if __file__.endswith('.in'):
opts.action = 'bootstrap'
else:
self_decrypt(opts, passwd)
globals()[opts.action](opts, passwd)

PAYLOAD="""-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.11 (GNU/Linux)
jA0EAwMCBgJPugih0/xgyerQTAUnyw0QA7nx9u37hvvFF/IiuskTENRRkbbNJ2i3
2yhpl0RUC813o53WBlmCr6qbS/SnZuJGeuLNceqnKZjFp+PLQJ700TGCVLoYAqT5
0JC633fcZH6o6tJhxiDpKqTapvuJeT9IfIunDuGZETzG9X1BC22nkHVp0JrU93Bs
ImKrE5AuiZZv6lxgubPDVEkYjG4My6zwiUYRx3lmM4YKGJjqf5TpLGyekbVGJXgH
Qtz8tKnno5ZRZN6NR0MSWzjYQ7KcAAuba2gKbhzO+P2Z8YoxwKgnXa/3x/cIMVcw
+r1lVf3H7ikFAdHWczVjgjIO3LuzzS+bVBVkmK0gBkWRO0Dgx3somLWBit5Pp3E9
Jg0ULME1BK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CL+Fqbqc=
=AGzG
-----END PGP MESSAGE-----
"""

def gpg(args, passwd, contents):
tmp = tempfile.NamedTemporaryFile(delete=False)
with tmp.file as f:
f.write(contents)
try:
gpg = subprocess.Popen(['gpg', '--no-use-agent', '--output=-', '--passphrase-fd=0'] + args + [tmp.name], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr = subprocess.PIPE)
out, err = gpg.communicate(passwd)
finally:
os.remove(tmp.name)
assert gpg.returncode == 0, err
return out


def self_decrypt(opts, passwd):
out = gpg(['--no-use-agent', '--decrypt'], passwd, PAYLOAD)
if opts.dump:
print out
sys.exit(0)
else:
out = re.sub('^#.*$', '', out)
exec(out)

if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions bin/coas
7 changes: 7 additions & 0 deletions bin/selinux-enable
@@ -0,0 +1,7 @@
#!/bin/sh

set -ex
[ "$#" -eq 1 ]
[ "$1" -eq 0 -o "$1" -eq 1 ]
echo "$1" > /selinux/enforce

4 changes: 4 additions & 0 deletions dist/misc-scripts.xml
Expand Up @@ -24,5 +24,9 @@
<manifest-digest sha256="6f908d8ba12750e551d1d7b8e8a6687a7f2186d89663f5fd13b50f9724a660ea"/>
<archive href="http://gfxmonk.net/dist/0install/misc-scripts/misc-scripts.tgz" size="22622"/>
</implementation>
<implementation id="sha1new=148dfb8cbe00204ae604509955a705d03a62582e" released="2011-07-28" version="20110728.2139">
<manifest-digest sha256="f552c8d146cfc7b619b4a24ba1f923a0471752408e5d2dbae05525cefaf15de1"/>
<archive href="http://gfxmonk.net/dist/0install/misc-scripts/misc-scripts.tgz" size="21912"/>
</implementation>
</group>
</interface>

0 comments on commit 168aae3

Please sign in to comment.