#!/bin/sh function usage() { echo "$0 [xmlfile]" } function extract() { # First unzip all mkdir -p $2 unzip $1 -d $2 >/dev/null 2>&1 # Then convert the XML files to PYX find $2 -type f | while read F do mime=`file -b --mime-type $F` if [ "z$mime" = "zapplication/xml" ] then python `dirname $0`/xml2pyx.py $F $F.pyx mv $F.pyx $F fi done } if [ $# != 2 -a $# != 3 ] then usage exit 1 fi FILE1=$1 FILE2=$2 TMP=/tmp/ooxmldiff # Extract both files TMP1=$TMP/`basename $FILE1`1 extract $FILE1 $TMP1 TMP2=$TMP/`basename $FILE2`2 extract $FILE2 $TMP2 if [ $# == 3 ] then TMP1=$TMP1$3 TMP2=$TMP2$3 diff -u $TMP1 $TMP2 else diff -ru $TMP1 $TMP2 fi # Clean up the whole place rm -r $TMP exit 0