#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
#
# unpack.py - an archive unpack utility
#
# A simple program to uncompress and unpack source archive files into a target
# directory and fix permissions if requested.
#
uncompress = "/bin/cat"
uncompress = "/usr/bin/bzip2 -dc"
uncompress = "/usr/bin/gzip -dc"
uncompress = "/usr/bin/uncompress -c"
uncompress = "/usr/bin/7z --s"
uncompress = "/usr/bin/xz -dc"
uncompress = "/usr/bin/unzip -qo"
unpack = " | gtar -xf -"
unpack = ""
unpack = " | jar xf -"
unpack = ""
print "command: %s %s %s" % (uncompress, filename, unpack)
return uncompress, unpack
#
# recurse down a directory tree opening permissions so that others may access
# files in the tree.
#
print "Changing %s from %4.4o to %4.4o" % (path,
print "Usage: %s [-v|--verbose] [-f|--fix-permissions] [-r|--relocate-to (dir)] (file)" % (sys.argv[0].split('/')[-1])
sys.exit(1)
try:
["fix-permissions", "relocate-to=", "verbose"])
usage()
else:
# extract the archive contents
print "cd %s ; %s %s%s" % (tempdir, uncompress, filename,
# open up the permissions on what we extracted
if permissions:
if (relocate_to == None):
# move everything in the tempdir here
else:
# rename the tempdir and open it's permissions
os.chmod(relocate_to, 0755)
if __name__ == "__main__":
main()