diff options
Diffstat (limited to 'trunk/lib')
-rw-r--r-- | trunk/lib/common.sh | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh index 7d9444b..4b648df 100644 --- a/trunk/lib/common.sh +++ b/trunk/lib/common.sh @@ -421,6 +421,39 @@ function get_group { } +function use_svn { + + # check if svn usage is enabled + + if [ "$TEMPLATES_UNDER_SVN" == "1" ] && \ + [ "$TEMPLATE_STORAGE_STYLE" == "own-folder" ]; then + return 0 + else + return 1 + fi + +} + +function svn_check { + + # check if a file is under svn + # usage: svn_check <file> + + local cwd + + cwd="`pwd`" + cd `dirname $1` + + if [ "`svn status $1 | awk '{ print $1 }'`" == "?" ]; then + return 1 + else + return 0 + fi + + cd $cwd + +} + function copy_template_files { # copy template files into jail @@ -429,7 +462,7 @@ function copy_template_files { if [ -d "$1" ]; then echo "$BASENAME: copying template files..." if [ -d "$TEMPLATE_BASE.d" ]; then - if [ "$TEMPLATES_UNDER_SVN" == "1" ]; then + if use_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then svn update rsync -av --exclude=.svn $TEMPLATE_BASE.d/ $JAIL_ROOT/$server/ else @@ -460,36 +493,3 @@ function set_jail_perms { } -function use_svn { - - # check if svn usage is enabled - - if [ "$TEMPLATES_UNDER_SVN" == "1" ] && \ - [ "$TEMPLATE_STORAGE_STYLE" == "own-folder" ]; then - return 0 - else - return 1 - fi - -} - -function svn_check { - - # check if a file is under svn - # usage: svn_check <file> - - local cwd - - cwd="`pwd`" - cd `dirname $1` - - if [ "`svn status $1 | awk '{ print $1 }'`" == "?" ]; then - return 1 - else - return 0 - fi - - cd $cwd - -} - |