summaryrefslogtreecommitdiff
path: root/auto-clean
diff options
context:
space:
mode:
authorkx <kx@radix.pro>2023-03-24 02:53:04 +0300
committerkx <kx@radix.pro>2023-03-24 02:53:04 +0300
commit12c7b1c5658602269da2f5b75835ec0f5fab8890 (patch)
tree93f6f6b85830af69743d5ebda902d4305bf23f4f /auto-clean
parent4e72ffe940d9aff7c019d37a6459e765902c1fae (diff)
downloadcscm-12c7b1c5658602269da2f5b75835ec0f5fab8890.tar.xz
Version 0.1.4HEADcscm-0.1.4trunk
Diffstat (limited to 'auto-clean')
-rwxr-xr-xauto-clean40
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}