Package: mtools
Version: 4.0.10-1ubuntu2~ppa2
Severity: wishlist

I created a small patch to mtools that enables support for zip-files for
uz/lz, which I find very handy as I now have one utility to look at and
extract archive files.

-- System Information:
Debian Release: squeeze/sid
  APT prefers lucid-updates
  APT policy: (500, 'lucid-updates'), (500, 'lucid-security'), (500, 
'lucid-backports'), (500, 'lucid')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-24-generic-tuxonice (SMP w/2 CPU cores)
Locale: LANG=de_AT.utf8, LC_CTYPE=de_AT.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mtools depends on:
ii  dpkg               1.15.5.6ubuntu4.4     Debian package management system
ii  install-info       4.13a.dfsg.1-5ubuntu1 Manage installed documentation in 
ii  libc6              2.11.1-0ubuntu7.6     Embedded GNU C Library: Shared lib

mtools recommends no packages.

Versions of packages mtools suggests:
pn  floppyd                       <none>     (no description available)

-- no debconf information
Index: mtools-4.0.10/scripts/uz
===================================================================
--- mtools-4.0.10.orig/scripts/uz	2010-04-13 22:55:33.000000000 +0200
+++ mtools-4.0.10/scripts/uz	2010-04-13 23:02:34.000000000 +0200
@@ -42,10 +42,12 @@
 case $0 in
 *uz)
 	tarparam="-pxvf"
+	zipparam=""
 	action="Extracting from "
 	;;
 *lz)
 	tarparam="-tvf"
+	zipparam="-l"
 	action="Reading directory of "
 	;;
 *)
@@ -64,23 +66,31 @@
 	echo >&2
 	found=
 
-	for suffix in "" .gz .tgz .tar.gz .z .tar.z .taz .tpz .Z .tar.Z .tar.bz2; do
+	for suffix in "" .gz .tgz .tar.gz .z .tar.z .taz .tpz .Z .tar.Z .tar.bz2 .zip .jar .war .ear .aar; do
 		if [ -r "${1}$suffix" ]; then
 			found=$1$suffix
 			break
 		fi
 	done
 
+	unzip=0
 	case $found in
 		*.tar.bz2 | *.tb2)
 			uzcmd='bzip2 -cd'
 			;;
+		*.zip | *.jar | *.war | *.ear | *.aar)
+			unzip=1
+			;;
 	esac
 	if [ -z "$found" ]; then
 		echo "$0: could not read \"$1\"." >&2
 	else
 		echo "$action \"$found\"." >&2
-		$uzcmd -- "$found" | tar "$tarparam" -
+		if [ $unzip = 1 ]; then
+			unzip $zipparam -- "$found"
+		else
+			$uzcmd -- "$found" | tar "$tarparam" -
+		fi
 	fi
 	shift
 done

Reply via email to