diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-04-06 15:43:34 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-04-06 15:43:34 +0000 |
commit | 71b612263868dfab888f31086ba85c9bdb73674c (patch) | |
tree | e7bdf80ba72027ac7dcd2db0e096e7827a811ef6 /trunk/src/templatepkg | |
parent | 9abb526d0c1b359084b028161b881bd894c53877 (diff) | |
download | simplepkg-71b612263868dfab888f31086ba85c9bdb73674c.tar.gz simplepkg-71b612263868dfab888f31086ba85c9bdb73674c.tar.bz2 |
lots of bugfixes
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@290 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/src/templatepkg')
-rwxr-xr-x | trunk/src/templatepkg | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/trunk/src/templatepkg b/trunk/src/templatepkg index c218638..d1bffb6 100755 --- a/trunk/src/templatepkg +++ b/trunk/src/templatepkg @@ -86,6 +86,8 @@ function usage { echo "" exit + # TODO: opcao para apagar script de pos-instalacao + } function check_svn_repo { @@ -200,7 +202,7 @@ function template_create { if use_svn && [ -d "$TEMPLATE_BASE/.svn" ]; then - cd $TEMPLATE_BASE + cd `dirname $TEMPLATE_BASE` if ! svn_check $TEMPLATE_BASE.d; then svn mkdir $TEMPLATE_BASE.d @@ -455,10 +457,11 @@ function template_add { function check_template_exist { # check if a template exists + # and create missing components local components - components="$TEMPLATE_BASE.template $TEMPLATE_BASE.perms $TEMPLATE_BASE.d $TEMPLATE_BASE.s" + components="template perms d s" if [ ! -d "`dirname $TEMPLATE_BASE`" ]; then echo $BASENAME: template not found @@ -466,13 +469,30 @@ function check_template_exist { 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 + + if [ ! -e "$TEMPLATE_BASE.$component" ]; then + echo "$BASENAME: template component not found: $component; creating..." + + cd `dirname $TEMPLATE_BASE` + + if [ "$component" == "perms" ] || [ "$component" == "template" ]; then + touch $TEMPLATE_BASE.$component + else + mkdir $TEMPLATE_BASE.$component + fi + + if use_svn && [ -d "$TEMPLATE_BASE/.svn" ]; then + svn add $TEMPLATE_BASE.$component + info_commit="yes" + fi + fi done + if [ "$info_commit" == "yes" ]; then + echo "$BASENAME: please run 'jail-commit --all' to add new files in the svn repository" + fi + } function template_delete { @@ -517,6 +537,7 @@ function template_remove { if use_svn && [ -d "$basedir/.svn" ]; then cd $BASE_CONF/templates + svn update svn del --force $template if [ "$?" != "0" ]; then echo $BASENAME: error deleting template $template @@ -602,7 +623,11 @@ function template_post_install_edit { fi else - if [ -d "$TEMPLATE_BASE.s" ]; then + if [ -e "$TEMPLATE_BASE.s/$1" ]; then + + echo $BASENAME: file $TEMPLATE_BASE.s/$1 not a regular file + + elif [ -d "$TEMPLATE_BASE.s" ]; then touch $TEMPLATE_BASE.s/$1 chmod +x $TEMPLATE_BASE.s/$1 @@ -639,6 +664,8 @@ function template_edit { [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then echo "$BASENAME: please run 'jail-commit --all' to send changes to the repository" fi + elif [ -e "$TEMPLATE_BASE.template" ]; then + echo $BASENAME: file $TEMPLATE_BASE.template not a regular file else echo $BASENAME: file not found: $TEMPLATE_BASE.template fi |