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.

74 lines
1.8 KiB

  1. #!/bin/sh
  2. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # T2 SDE: misc/archive/findorphans.sh
  6. # Copyright (C) 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- T2-COPYRIGHT-NOTE-END ---
  15. config=default
  16. root=
  17. folders=
  18. usage() {
  19. echo "usage: $0 [-cfg <config>|-root <root>|-system]"
  20. }
  21. while [ $# -gt 0 ]; do
  22. case "$1" in
  23. -cfg) config="$2"
  24. root= ; shift ;;
  25. -root) root="$2"; shift ;;
  26. -system) root=/ ;;
  27. -just) shift; folders="$@"; break ;;
  28. -help) usage; exit 0 ;;
  29. *) echo "ERROR: unknown argument '$1'"
  30. usage; exit 1 ;;
  31. esac
  32. shift
  33. done
  34. if [ -z "$root" ]; then
  35. if [ ! -f config/$config/config ]; then
  36. echo "ERROR: '$config' is not a valid config"
  37. exit 2
  38. else
  39. root="build/`grep ' SDECFG_ID=' \
  40. config/$config/config | cut -d\' -f2`"
  41. fi
  42. fi
  43. if [ ! -d "$root/var/adm/flists" ]; then
  44. echo "ERROR: '$root' is not a valid T2 box/sandbox root"
  45. exit 3
  46. fi
  47. flists=$( cd "$root"; echo var/adm/flists/* )
  48. realroot=$( cd "$root"; pwd )
  49. findroot=
  50. for f in $folders; do
  51. findroot="$findroot $realroot/${f#/}"
  52. done
  53. [ "$findroot" ] || findroot="$realroot"
  54. pushd "$realroot" > /dev/null
  55. find $findroot -mindepth 1 \
  56. \( -path "$realroot/TOOLCHAIN" -o \
  57. -path "$realroot/proc" -o \
  58. -path "$realroot/tmp" -o \
  59. -path '*/.svn' \) -prune \
  60. -o -print | sed -e "s,^$realroot/,," |
  61. while read file; do
  62. if ! grep -q -l "^[^ ]*: ${file}\$" $flists; then
  63. echo "$file"
  64. fi
  65. done
  66. popd > /dev/null