diff options
Diffstat (limited to 'install-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:])) |