From e6bdbbf9c8194584c8cbc413fc6f41f4e4ec2b30 Mon Sep 17 00:00:00 2001 From: rhatto Date: Thu, 5 Apr 2007 17:20:49 +0000 Subject: common.sh: small changes git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@246 04377dda-e619-0410-9926-eae83683ac58 --- trunk/lib/common.sh | 68 +++++++++++++++++++++++++-------------------------- trunk/src/jail-update | 4 ++- 2 files changed, 37 insertions(+), 35 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 + + 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 - - local cwd - - cwd="`pwd`" - cd `dirname $1` - - if [ "`svn status $1 | awk '{ print $1 }'`" == "?" ]; then - return 1 - else - return 0 - fi - - cd $cwd - -} - diff --git a/trunk/src/jail-update b/trunk/src/jail-update index 471591b..4a557f3 100755 --- a/trunk/src/jail-update +++ b/trunk/src/jail-update @@ -21,6 +21,7 @@ BASENAME="`basename $0`" if [ -f "$COMMON" ]; then source $COMMON + eval_config $BASENAME else echo "error: file $COMMON found, check your $BASENAME installation" exit 1 @@ -44,9 +45,10 @@ else template_name="$2" fi -search_template `basename $1` --update +search_template $template_name --update if [ "$?" != "0" ]; then + echo $BASENAME: template $template_name not found exit 1 fi -- cgit v1.2.3