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
parent: 4e72ffe940d9aff7c019d37a6459e765902c1fae
Commit Summary:
Diffstat:
1 file changed, 31 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}