]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/zipdiff
rename all the configs
[xonotic/xonotic.git] / misc / tools / zipdiff
index d0e5acfb11836f545c0d195cc0b0f694df2f12b3..661d9a2d677b3fcf3c583f5ae4b924b36405497c 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+set -e
+
 usage()
 {
        cat <<EOF
@@ -19,13 +21,9 @@ ziptool="mkzip"
 mkzip()
 {
        archive=$1; shift
-       sevenzipflags=-mx=9
-       zipflags=-9
-       ziplist=`mktemp`
-       find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
-       7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
-       zip         $zipflags -y   -@<"$ziplist" "$archive"      || true
-       rm -f "$ziplist"
+       zipflags=-1ry
+       zip $zipflags "$archive" "$@" || true
+       advzip -z -4 "$archive"
 }
 
 while [ $# -gt 0 ]; do
@@ -61,6 +59,10 @@ done
 [ -n "$from" ] || usage
 [ -n "$to" ] || usage
 
+case "$output" in '') ;; /*) ;; *) output=`pwd`/$output ;; esac
+case "$from" in /*) ;; *) from=`pwd`/$from ;; esac
+case "$to" in /*) ;; *) to=`pwd`/$to ;; esac
+
 found()
 {
        type=$1
@@ -166,22 +168,14 @@ case "$output" in
        *)
                rm -f "$output"
                if [ -n "$result" ]; then
+                       cd "$tempdir"
                        echo "$result" | while IFS= read -r line; do
                                echo >&2 "extracting $line..."
                                dline=./$line
                                mkdir -p "$tempdir/${dline%/*}"
-                               unzip -p "$to" "$line" > "$tempdir/$line" # this may create an empty file - don't care, DP handles this as deletion
-                               # FIXME permissions
+                               unzip "$to" "$line"
                        done
-                       case "$output" in
-                               /*)
-                                       ;;
-                               *)
-                                       output=`pwd`/$output
-                                       ;;
-                       esac
-                       cd "$tempdir"
-                       $ziptool "$output" .
+                       $ziptool "$output" *
                        cd ..
                fi
                ;;