2 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # Filename: bin/sde-cleanup
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: Cleanup the build environment
22 export SDEROOT
=$
( cd "${0%/*}/.."; pwd -P )
24 .
$SDEROOT/lib
/libsde.
in
33 Usage: sde cleanup [ -build ] [ -cache ] [ -full ] [ -nocheck ] [ -download ]
34 sde cleanup [ dir(s) ]
45 buildclean
=1 ; cacheclean
=1 ;;
58 # Cleanup download/* and quit
60 if [ $downclean -eq 1 ]; then
61 echo "Searching for obsolete downloads (this may take some time) ..."
62 $SDEROOT/bin
/sde-cleanup-download
67 for x
in tmp src.
* build
/*/TOOLCHAIN
/src.
*; do
68 if [ -d "$x" -o -L "$x" ] ; then
69 if [ "$#" != 0 ] ; then
71 for y
; do [ "${y%/}" = "$x" ] && delme
=1 ; done
72 [ "$delme" = 0 ] && continue
76 for y
in build.pid
; do
77 if [ $delme = 1 -a -f "$x/$y" ] ; then
78 if [ "`fuser "$x/$y"`" ] ; then
79 echo "Found active $y in $x: Not removing!"
85 if [ $delme = 1 ] ; then
97 if [ "$#" != 0 ] ; then
99 for y
; do [ "${y%/}" = "$x" ] && delme
=1 ; done
100 [ "$delme" = 0 ] && continue
103 # handle (c)cache pools first
104 if [ ${x/build\/ccache/} != $x ]; then
105 if [ $cacheclean = 1 ]; then
106 echo "removing $x ..."
109 echo "Not removing $x (cache)."
115 if [ $buildclean = 1 ] ; then
116 for y
in proc TOOLCHAIN
/loop TOOLCHAIN
/config TOOLCHAIN
/download
; do
117 umount
-d -f "$x/$y" > /dev
/null
2>&1
118 umount
-d -f -l "$x/$y" > /dev
/null
2>&1
119 rmdir "$x/$y" > /dev
/null
2>&1
120 if [ -d "$x/$y" ] ; then
121 echo "Found $y in $x: Not removing!"
125 if [ "$delme" != 0 ] ; then
126 echo "removing $x ..."
130 echo "Not removing $x (build)."
135 [ $fullhelp -eq 1 ] &&
136 echo -e "\nUse '$0 -build' to remove builds and '$0 -cache'
137 to also flush the cache."
139 [ "$nocheck" = 1 ] ||
exec $SDEROOT/bin
/sde-cleanup-linger