Codebase list magicrescue / debian/1.1.9-4 recipes / zip
debian/1.1.9-4

Tree @debian/1.1.9-4 (Download .tar.gz)

zip @debian/1.1.9-4raw · history · blame

# Extracts PKZIP files, including OpenOffice.org and StarOffice 6+ documents.
# Depends on Info-ZIP from http://www.info-zip.org
#
# Files that seem to be OpenOffice.org or StarOffice documents will be renamed
# to *.ooo

# magic
0 string PK\x03\x04
# high byte of "version made by"
5 char \x00
# high byte of "version needed to extract"
#7 char \x00

extension zip

# This command takes a 50MB chunk of the file and tries to repair it. If the
# zip files you are looking for are less than 50MB, you can lower the value of
# the count= parameter for performance.
command dd bs=1024k count=50 of="$1.tmp" 2>/dev/null; zip -qF "$1.tmp" --out "$1" ; rm -f "$1.tmp"

# Try to guess if it's a JAR archive or an OpenOffice.org file, and rename
# accordingly
rename if unzip -l "$1"|grep META-INF/MANIFEST.MF >/dev/null 2>&1; then echo "RENAME jar"; elif unzip -p "$1" content.xml >/dev/null 2>&1; then echo "RENAME ooo"; fi