aboutsummaryrefslogtreecommitdiff
path: root/trunk/src
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-04-04 16:40:21 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-04-04 16:40:21 +0000
commit2d979f783b11c05450d449633ba55e6702b4e798 (patch)
tree1acb8f30b97b36dac3571486fe45d0c9fd0f3ac2 /trunk/src
parentab73923798c319034802451de269ba08f8c81b51 (diff)
downloadsimplepkg-2d979f783b11c05450d449633ba55e6702b4e798.tar.gz
simplepkg-2d979f783b11c05450d449633ba55e6702b4e798.tar.bz2
templatepkg: added function check_template_exist
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@232 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/src')
-rwxr-xr-xtrunk/src/templatepkg34
1 files changed, 26 insertions, 8 deletions
diff --git a/trunk/src/templatepkg b/trunk/src/templatepkg
index e2feaa7..b0afb3b 100755
--- a/trunk/src/templatepkg
+++ b/trunk/src/templatepkg
@@ -214,14 +214,7 @@ function template_update {
# update the template package list
- components="$TEMPLATE_BASE.template $TEMPLATE_BASE.perms $TEMPLATE_BASE.d $TEMPLATE_BASE.s"
- for component in $components; do
- if [ ! -e "$component" ]; then
- echo $BASENAME: template component not found: $component
- echo $BASENAME: please run $BASENAME -c before update a template
- exit 1
- fi
- done
+ check_template_exist
if [ ! -d "$ROOT/var/log/packages" ]; then
echo $ROOT/var/log/packages: directory not found
@@ -279,6 +272,8 @@ function template_add {
return 1
fi
+ check_template_exist
+
jail="/$1"
file="$2"
@@ -363,6 +358,29 @@ function slash {
}
+function check_template_exist {
+
+ # check if a template exists
+
+ local components
+
+ components="$TEMPLATE_BASE.template $TEMPLATE_BASE.perms $TEMPLATE_BASE.d $TEMPLATE_BASE.s"
+
+ if [ ! -d "`dirname $TEMPLATE_BASE`" ]; then
+ echo $BASENAME: template not found
+ exit 1
+ fi
+
+ for component in $components; do
+ if [ ! -e "$component" ]; then
+ echo $BASENAME: template component not found: $component
+ echo $BASENAME: please run $BASENAME -c before update a template
+ exit 1
+ fi
+ done
+
+}
+
# command line parsing
if [ -z "$2" ]; then