diff-tar-files 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #! /bin/sh
  2. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
  3. # This file is part of GNU Emacs.
  4. # GNU Emacs is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. # GNU Emacs is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  14. if [ $# != 2 ]; then
  15. cat <<EOF
  16. Usage: $0 OLD-TAR NEW-TAR
  17. Print a diff of the files in OLD-TAR and NEW-TAR. Used for checking
  18. the contents of Emacs tar files.
  19. EOF
  20. exit 1;
  21. fi
  22. old_tar=$1
  23. new_tar=$2
  24. old_tmp=/tmp/old.$$
  25. new_tmp=/tmp/new.$$
  26. trap "rm -f $old_tmp $new_tmp; exit 1" 1 2 15
  27. tar tzf $old_tar | sed -e 's,^[^/]*,,' | sort > $old_tmp
  28. tar tzf $new_tar | sed -e 's,^[^/]*,,' | sort > $new_tmp
  29. diff -u $old_tmp $new_tmp
  30. rm -f $new_tmp $old_tmp