diffmar.sh 1.2 KB

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