diff options
author | kx <kx@radix.pro> | 2023-03-24 02:53:04 +0300 |
---|---|---|
committer | kx <kx@radix.pro> | 2023-03-24 02:53:04 +0300 |
commit | 12c7b1c5658602269da2f5b75835ec0f5fab8890 (patch) | |
tree | 93f6f6b85830af69743d5ebda902d4305bf23f4f /auto-clean | |
parent | 4e72ffe940d9aff7c019d37a6459e765902c1fae (diff) | |
download | cscm-b6ef9c82891b3b15229b8b3eab67c69f854705c0.tar.xz |
Version 0.1.4HEADcscm-0.1.4trunk
Diffstat (limited to 'auto-clean')
-rwxr-xr-x | auto-clean | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/auto-clean b/auto-clean new file mode 100755 index 0000000..b100d64 --- /dev/null +++ b/auto-clean @@ -0,0 +1,40 @@ +#!/bin/bash + +CWD=`pwd` + +program=`basename $0` + +usage() { + cat << EOF + +Usage: $program [options] + +Options: + -h,--help Display this message. + +EOF +} + +if [ -f "${CWD}/Makefile" ] ; then + make distclean +fi + +svnignore='.svnignore' + +while read ln; do + line=`echo "${ln}" | sed 's,^[ \t],,' | sed 's,[ \t]$,,'` + if [ "x$line" != "x" -a "${line:0:1}" != "#" ] ; then + if `echo "${line}" | grep -q '\*~$'` ; then + find "`dirname "${line}"`" -type f -iname '*~' -print0 | while IFS= read -r -d '' file ; do + rm -f "$file" + done + elif `echo "${line}" | grep -q '\*'` ; then + find "`dirname "${line}"`" -type f -iname "`basename "${line}"`" -print0 | while IFS= read -r -d '' file ; do + rm -f "$file" + done + else + if [ -d "${line}" ] ; then rm -rf "${line}" ; fi + if [ -f "${line}" ] ; then rm -f "${line}" ; fi + fi + fi +done < ${CWD}/${svnignore} |