OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.2 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: bin/sde-cleanup-linger
  6. # Copyright (C) 2006 - 2009 The OpenSDE Project
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2003 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. #Description: Removes temp files and search for lingering files
  18. #Alias: lingering
  19. [ -n "$SDEROOT" ] ||
  20. export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
  21. . $SDEROOT/lib/libsde.in
  22. if [ $# -ne 0 ]; then
  23. echo "Usage: sde cleanup linger"
  24. exit 1
  25. fi
  26. cd "$SDEROOT"
  27. echo_info "Searching for lingering temp/backup files (this may take some time) ..."
  28. sderootdirs="scripts/. bin/. etc/. lib/. doc/. src/. package/. architecture/." # target/.
  29. files_remove="-name *~ -o -name a.out -o -name core.* -o -name core"
  30. files_warn="-name DEADJOE -o -name *-[xX] \
  31. -o -name *.orig -o -name *.rej -o -name *#* \
  32. -o -name *.mine -o -name *.r[1-9][0-9]* \
  33. -o -name TRANS.TBL -o -name *.cksum-err -o -name x \
  34. -o -name *[.-]old -o -name a.out -o -name *~ \
  35. -o -name *.incomplete -o -name *.ckext-err"
  36. # Remove temp/backup files
  37. #
  38. ( bin/find $sderootdirs target/. -type f \( $files_remove \) | xargs rm -vf ) &
  39. # Print warnings for 'lingering' files
  40. #
  41. ( bin/find ${sderootdirs} \( \
  42. \( \( $files_warn -o -name '.[^.]*' \) -a ! -name '.gitignore' \) \
  43. -printf 'WARNING: Found %p\n' \
  44. \) -o \( \
  45. \( ! -type d ! -type f \) \
  46. -printf 'WARNING: Neither a dir nor a regular file: %p\n' \
  47. \) ) &
  48. # for targets we tolerate .files
  49. ( bin/find target/. \( \
  50. \( $files_warn \) \
  51. -printf 'WARNING: Found %p\n' \
  52. \) -o \( \
  53. \( ! -type d ! -type f \) \
  54. -printf 'WARNING: Neither a dir nor a regular file: %p\n' \
  55. \) ) &
  56. wait
  57. exit 0