userland-unpack: support decompression of non-archive files
| | |
| | | ruby_ver = os.getenv('RUBY_VERSION', '') |
| | | uncompress = "/usr/ruby/" + ruby_ver + "/bin/gem unpack" |
| | | |
| | | unpack = " | gtar -xf -" |
| | | # if the file is just compressed, redirect stdout to ./filename with |
| | | # one less extension. |
| | | unpack = " > ./" + '.'.join(os.path.basename(filename).split('.')[:-1]) |
| | | |
| | | if (re.search("(\.zip)$", filename) != None): |
| | | if (re.search("(\.tar\.[^\.]+|\.tgz|\.txz|\.tbz2?)$",filename) != None): |
| | | unpack = " | gtar -xf -" |
| | | elif (re.search("(\.zip)$", filename) != None): |
| | | unpack = "" |
| | | elif (re.search("(\.oxt)$", filename) != None): |
| | | unpack = "" |
| | |
| | | unpack = "" |
| | | |
| | | if (verbose == True): |
| | | print("command: %s %s %s" % (uncompress, filename, unpack)) |
| | | print("command: %s %s%s" % (uncompress, filename, unpack)) |
| | | |
| | | return uncompress, unpack |
| | | |
| | |
| | | permissions = None |
| | | relocate_to = None |
| | | |
| | | if len(sys.argv) == 1: |
| | | usage() |
| | | |
| | | try: |
| | | opts, args = getopt.getopt(sys.argv[1:], "fr:v", |
| | | ["fix-permissions", "relocate-to=", "verbose"]) |