1#!/bin/bash 2# Compares two mars 3 4marA="$1" 5marB="$2" 6testDir="$3" 7workdir="/tmp/diffmar/$testDir" 8fromdir="$workdir/0" 9todir="$workdir/1" 10 11# On Windows, creation time can be off by a second or more between the files in 12# the fromdir and todir due to them being extracted synchronously so use 13# time-style and exclude seconds from the creation time. 14lsargs="-algR" 15unamestr=`uname` 16if [ ! "$unamestr" = 'Darwin' ]; then 17 unamestr=`uname -o` 18 if [ "$unamestr" = 'Msys' -o "$unamestr" = "Cygwin" ]; then 19 lsargs="-algR --time-style=+%Y-%m-%d-%H:%M" 20 fi 21fi 22 23rm -rf "$workdir" 24mkdir -p "$fromdir" 25mkdir -p "$todir" 26 27cp "$1" "$fromdir" 28cp "$2" "$todir" 29 30cd "$fromdir" 31mar -x "$1" 32rm "$1" 33rm -f updatev2.manifest # Older files may contain this 34mv updatev3.manifest updatev3.manifest.xz 35xz -d updatev3.manifest.xz 36ls $lsargs > files.txt 37 38cd "$todir" 39mar -x "$2" 40rm "$2" 41mv updatev3.manifest updatev3.manifest.xz 42xz -d updatev3.manifest.xz 43ls $lsargs > files.txt 44 45echo "diffing $fromdir and $todir" 46echo "on linux shell sort and python sort return different results" 47echo "which can cause differences in the manifest files" 48diff -ru "$fromdir" "$todir" 49