9 $0 -o difference.zip -f from.zip -t to.zip
10 $0 -f from.zip -t to.zip
25 zip $zipflags "$archive" "$@" || true
26 advzip -z -4 "$archive"
29 while [ $# -gt 0 ]; do
46 excludes="$excludes $1"
59 [ -n "$from" ] || usage
62 case "$output" in '') ;; /*) ;; *) output=`pwd`/$output ;; esac
63 case "$from" in /*) ;; *) from=`pwd`/$from ;; esac
64 case "$to" in /*) ;; *) to=`pwd`/$to ;; esac
70 echo >&2 "$type: $source"
78 echo >&2 " * Sorry, can't handle deletion of $source."
83 tempdir=`mktemp -d -t zipdiff.XXXXXX`
87 fromlist="$(zipinfo -1 "$from" | grep -v /\$)"
88 tolist="$(zipinfo -1 "$to" | grep -v /\$)"
92 echo "$fromlist" | while IFS= read -r line; do
93 case "$newline$tolist$newline" in
94 *$newline$line$newline*)
99 for P in $excludes; do
102 found excluded "$line"
109 if ! $isexcluded; then
110 found deleted "$line"
115 echo "$tolist" | while IFS= read -r line; do
116 case "$newline$fromlist$newline" in
117 *$newline$line$newline*)
121 for P in $excludes; do
124 found excluded "$line"
131 if ! $isexcluded; then
132 unzip -p "$from" "$line" > "$tempdir/v1"
133 unzip -p "$to" "$line" > "$tempdir/v2"
134 if ! diff --brief "$tempdir/v1" "$tempdir/v2" >/dev/null 2>&1; then
135 found changed "$line"
145 for P in $excludes; do
148 found excluded "$line"
155 if ! $isexcluded; then
170 if [ -n "$result" ]; then
172 echo "$result" | while IFS= read -r line; do
173 echo >&2 "extracting $line..."
175 mkdir -p "$tempdir/${dline%/*}"