diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2015-06-09 14:46:09 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-06-22 14:03:44 +0000 |
commit | d383ae96a0300f43f5a22040e2f2420677307eef (patch) | |
tree | bb0b78486ac303df18d0d080ead6b41f1a669a77 /install-files/essential-files | |
parent | dde310007c20d2df36dbebe4bdb10f44529e74ac (diff) | |
download | definitions-d383ae96a0300f43f5a22040e2f2420677307eef.tar.gz |
essential-files: Install brpaste by default
This script helps developers to share logs via paste.baserock.org
Change-Id: I22b255c90e0b42a4b65dea41ec196ae92577a7f8
Diffstat (limited to 'install-files/essential-files')
-rw-r--r-- | install-files/essential-files/manifest | 2 | ||||
-rw-r--r-- | install-files/essential-files/usr/bin/brpaste | 29 |
2 files changed, 31 insertions, 0 deletions
diff --git a/install-files/essential-files/manifest b/install-files/essential-files/manifest index 2b77c237..4ef270d2 100644 --- a/install-files/essential-files/manifest +++ b/install-files/essential-files/manifest @@ -3,6 +3,8 @@ overwrite 0100644 0 0 /etc/os-release overwrite 0100644 0 0 /etc/profile overwrite 0100644 0 0 /etc/inputrc 0040755 0 0 /usr +0040755 0 0 /usr/bin +0100755 0 0 /usr/bin/brpaste 0040755 0 0 /usr/lib 0040755 0 0 /usr/lib/tmpfiles.d 0100644 0 0 /usr/lib/tmpfiles.d/shutdownramfs.conf diff --git a/install-files/essential-files/usr/bin/brpaste b/install-files/essential-files/usr/bin/brpaste new file mode 100644 index 00000000..15f976b9 --- /dev/null +++ b/install-files/essential-files/usr/bin/brpaste @@ -0,0 +1,29 @@ +#!/usr/bin/python + +import urllib2 +import os +import json + +URL = 'http://paste.baserock.org/documents' + +def run(*args): + if args: + content = [open(x).read() for x in args] + extensions = [os.path.splitext(x)[1] for x in args] + else: + content = [sys.stdin.read()] + extensions = [None] + + for i, each in enumerate(content): + req = urllib2.Request(URL, each) + response = urllib2.urlopen(req) + the_page = response.read() + key = json.loads(the_page)['key'] + url = "http://paste.baserock.org/%s" % key + if extensions[i]: + url += extensions[i] + print url + +if __name__ == '__main__': + import sys + sys.exit(run(*sys.argv[1:])) |