From 71b612263868dfab888f31086ba85c9bdb73674c Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 6 Apr 2007 15:43:34 +0000 Subject: lots of bugfixes git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@290 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/jail-commit | 6 +++--- trunk/src/templatepkg | 41 ++++++++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 10 deletions(-) (limited to 'trunk/src') diff --git a/trunk/src/jail-commit b/trunk/src/jail-commit index d8cd987..f3d5f05 100755 --- a/trunk/src/jail-commit +++ b/trunk/src/jail-commit @@ -94,8 +94,10 @@ function template_svn_commit { # usage: template_svn_commit if use_svn && [ -d "$1/.svn" ]; then - echo Commiting changes to the repository... cd $1 + echo First checking out from the repository... + svn update + echo Commiting changes to the repository... svn commit -m "changes for `date`" if [ "$?" != "0" ]; then echo $BASENAME: commit error @@ -142,11 +144,9 @@ elif [ "$1" == "--all" ]; then elif echo $1 | grep -q -e "^--"; then usage elif [ ! -z "$1" ]; then - echo "This is jail-commit; Run \"$BASENAME --help\" for help" do_commit $1 $2 template_svn_commit `dirname $TEMPLATE_BASE` else - echo "This is jail-commit; Run \"$BASENAME --help\" for help" if [ -f $JAIL_LIST ]; then for jailpath in `cat $JAIL_LIST`; do do_commit $jailpath 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 -- cgit v1.2.3