[early] Improved init script to not activate mdadm and lvm volumes if {lvm,mdadm...
[opensde-nopast.git] / bin / sde-cleanup-linger
blobf11a9b2e65faf8232841a3252b36c63f8ce07318
1 #!/bin/sh
2 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # Filename: bin/sde-cleanup-linger
6 # Copyright (C) 2006 - 2008 The OpenSDE Project
7 # Copyright (C) 2004 - 2006 The T2 SDE Project
8 # Copyright (C) 1998 - 2003 Clifford Wolf
10 # More information can be found in the files COPYING and README.
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 ---
18 #Description: Removes temp files and search for lingering files
19 #Alias: lingering
21 [ -n "$SDEROOT" ] ||
22 export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
24 . $SDEROOT/lib/libsde.in
26 if [ $# -ne 0 ]; then
27 echo "Usage: sde cleanup linger"
28 exit 1
31 cd "$SDEROOT"
33 echo_info "Searching for lingering temp/backup files (this may take some time) ..."
35 sderootdirs="scripts/. bin/. etc/. lib/. doc/. src/. package/. architecture/." # target/.
37 files_remove="-name *~ -o -name a.out -o -name core.* -o -name core"
38 files_warn="-name DEADJOE -o -name *-[xX] \
39 -o -name *.orig -o -name *.rej -o -name *#* \
40 -o -name *.mine -o -name *.r[1-9][0-9]* \
41 -o -name TRANS.TBL -o -name *.cksum-err -o -name x \
42 -o -name *[.-]old -o -name a.out -o -name *~ \
43 -o -name *.incomplete -o -name *.ckext-err"
45 # Remove temp/backup files
47 ( bin/find $sderootdirs target/. -type f \( $files_remove \) | xargs rm -vf ) &
49 # Print warnings for 'lingering' files
51 ( bin/find ${sderootdirs} \( \
52 \( $files_warn -o -name '.[^.]*' \) \
53 -printf 'WARNING: Found %p\n' \
54 \) -o \( \
55 \( ! -type d ! -type f \) \
56 -printf 'WARNING: Neither a dir nor a regular file: %p\n' \
57 \) ) &
59 # for targets we tolerate .files
60 ( bin/find target/. \( \
61 \( $files_warn \) \
62 -printf 'WARNING: Found %p\n' \
63 \) -o \( \
64 \( ! -type d ! -type f \) \
65 -printf 'WARNING: Neither a dir nor a regular file: %p\n' \
66 \) ) &
68 wait
69 exit 0