aboutsummaryrefslogtreecommitdiff
path: root/trunk/lib
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-11-28 03:30:14 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-11-28 03:30:14 +0000
commitdf955f1cdf74d0580e0622d7b260d7ae91607357 (patch)
treeb30cd9d2a81ef93c871dea7faa7a125791f2b668 /trunk/lib
parent4034db0b36181430815acb9c740ffc13f0ef6ce3 (diff)
downloadsimplepkg-df955f1cdf74d0580e0622d7b260d7ae91607357.tar.gz
simplepkg-df955f1cdf74d0580e0622d7b260d7ae91607357.tar.bz2
new function svn_remove_empty_folders
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@582 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/lib')
-rw-r--r--trunk/lib/common.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index 368cbd1..27d329f 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -589,7 +589,7 @@ function svn_del {
chown_svn $file && chgrp_svn $file
( cd $folder && su_svn del --force `basename $file` )
else
- rm -f $file
+ rm -rf $file
fi
}
@@ -671,6 +671,26 @@ function chgrp_svn {
}
+function svn_remove_empty_folders {
+
+ if [ -z "$1" ]; then
+ return 1
+ fi
+
+ main_folder="$1"
+ search="`find $main_folder -type d | grep -v '/.svn' | sed '1d'`"
+ results="`echo $search | wc -l`"
+
+ if [ "$results" -eq "0" ]; then
+ svn_del $folder
+ else
+ for folder in $search; do
+ svn_remove_empty_folders $folder
+ done
+ fi
+
+}
+
# -----------------------------------------------
# update jail functions
# -----------------------------------------------