Marcel Telka
2024-04-07 00fdc1139b715cf3833e0c7fda58e0e112e5be2f
tools/userland-unpack
@@ -1,4 +1,4 @@
#!/usr/bin/python3.5
#!/usr/bin/python3.9
#
# CDDL HEADER START
#
@@ -44,7 +44,7 @@
   elif (re.search("(\.Z)$", filename) != None):
      uncompress = "/usr/bin/uncompress -c"
   elif (re.search("(\.7z)$", filename) != None):
      uncompress = "/usr/bin/7z --s"
      uncompress = "/usr/bin/7z x"
   elif (re.search("(\.lz)$", filename) != None):
      uncompress = "/usr/bin/lzip -dc"
   elif (re.search("(\.xz)$", filename) != None):
@@ -59,9 +59,13 @@
      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 = ""
@@ -71,7 +75,7 @@
      unpack = ""
   if (verbose == True):
      print("command: %s %s %s" % (uncompress, filename, unpack))
      print("command: %s %s%s" % (uncompress, filename, unpack))
   return uncompress, unpack
@@ -114,6 +118,9 @@
   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"])