* updated konsole (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / misc / archive / findorphans.sh
blobc0b912b404a878b94add830b1152c9460d793ffc
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 ---
16 config=default
17 root=
18 folders=
20 usage() {
21 echo "usage: $0 [-cfg <config>|-root <root>|-system]"
24 while [ $# -gt 0 ]; do
25 case "$1" in
26 -cfg) config="$2"
27 root= ; shift ;;
28 -root) root="$2"; shift ;;
29 -system) root=/ ;;
30 -just) shift; folders="$@"; break ;;
31 -help) usage; exit 0 ;;
32 *) echo "ERROR: unknown argument '$1'"
33 usage; exit 1 ;;
34 esac
35 shift
36 done
38 if [ -z "$root" ]; then
39 if [ ! -f config/$config/config ]; then
40 echo "ERROR: '$config' is not a valid config"
41 exit 2
42 else
43 root="build/`grep ' SDECFG_ID=' \
44 config/$config/config | cut -d\' -f2`"
48 if [ ! -d "$root/var/adm/flists" ]; then
49 echo "ERROR: '$root' is not a valid T2 box/sandbox root"
50 exit 3
51 fi
53 flists=$( cd "$root"; echo var/adm/flists/* )
54 realroot=$( cd "$root"; pwd )
56 findroot=
57 for f in $folders; do
58 findroot="$findroot $realroot/${f#/}"
59 done
60 [ "$findroot" ] || findroot="$realroot"
62 pushd "$realroot" > /dev/null
63 find $findroot -mindepth 1 \
64 \( -path "$realroot/TOOLCHAIN" -o \
65 -path "$realroot/proc" -o \
66 -path "$realroot/tmp" -o \
67 -path '*/.svn' \) -prune \
68 -o -print | sed -e "s,^$realroot/,," |
69 while read file; do
70 if ! grep -q -l "^[^ ]*: ${file}\$" $flists; then
71 echo "$file"
73 done
74 popd > /dev/null