]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
common.sh: small changes
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Thu, 5 Apr 2007 17:20:49 +0000 (17:20 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Thu, 5 Apr 2007 17:20:49 +0000 (17:20 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@246 04377dda-e619-0410-9926-eae83683ac58

trunk/lib/common.sh
trunk/src/jail-update

index 7d9444b4da38a7e9ee3556cbf4b706d33754ceed..4b648dfea9ba8cd933756c62d952df9f1e1183a8 100644 (file)
@@ -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
-
-}
-
index 471591b51bd629d2bcfed9fed20bdbca6efccb8c..4a557f3003a1ad09b447c913d5af19dbfa6fe4a7 100755 (executable)
@@ -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