|
|
@ -23,11 +23,36 @@ |
|
|
|
|
|
|
|
. $SDEROOT/lib/libsde.in |
|
|
|
|
|
|
|
if [ $# -ne 0 ]; then |
|
|
|
echo "Usage: sde cleanup linger" |
|
|
|
exit 1 |
|
|
|
cleanup_usage() { |
|
|
|
local progname="${0##*/}" |
|
|
|
cat <<EOT |
|
|
|
Usage: $progname [--dry-run] |
|
|
|
EOT |
|
|
|
} |
|
|
|
|
|
|
|
shortopts='d' |
|
|
|
longopts='dry-run' |
|
|
|
options=$( getopt -o "$shortopts" -l "$longopts" -- "$@" ) |
|
|
|
|
|
|
|
if [ $? -ne 0 ]; then |
|
|
|
cleanup_usage |
|
|
|
exit -1 |
|
|
|
fi |
|
|
|
|
|
|
|
# load new arguments list |
|
|
|
eval set -- "$options" |
|
|
|
|
|
|
|
dryrun= |
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do |
|
|
|
case "$1" in |
|
|
|
--) shift; break ;; |
|
|
|
-d|--dry-run) |
|
|
|
dryrun=yes ;; |
|
|
|
esac |
|
|
|
shift |
|
|
|
done |
|
|
|
|
|
|
|
cd "$SDEROOT" |
|
|
|
|
|
|
|
echo_info "Searching for lingering temp/backup files (this may take some time) ..." |
|
|
@ -44,7 +69,16 @@ files_warn="-name DEADJOE -o -name *-[xX] \ |
|
|
|
|
|
|
|
# Remove temp/backup files |
|
|
|
# |
|
|
|
( bin/find $sderootdirs target/. -type f \( $files_remove \) | xargs rm -vf ) & |
|
|
|
remove() { |
|
|
|
if [ "x-d" = "x${1:-}" ]; then |
|
|
|
shift |
|
|
|
bin/find $sderootdirs target/. -type f \( "$@" \) |
|
|
|
else |
|
|
|
bin/find $sderootdirs target/. -type f \( "$@" \) -print0 | xargs -r0 rm -vf |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
remove ${dry_run:+-d} $files_remove |
|
|
|
|
|
|
|
# Print warnings for 'lingering' files |
|
|
|
# |
|
|
|