From 0a74464a3dab5ae8ba3d8616cd2da1bd30b5f85d Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 30 Jan 2009 19:58:17 +0000 Subject: more wrapper svn functions git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@787 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/templatepkg | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'trunk/src/templatepkg') diff --git a/trunk/src/templatepkg b/trunk/src/templatepkg index 0eee075..ba5946b 100755 --- a/trunk/src/templatepkg +++ b/trunk/src/templatepkg @@ -174,7 +174,7 @@ function import_export_templates { if [ ! -z "$2" ]; then - if [ ! -d "$templates_folder/.svn" ]; then + if ! svn_folder $templates_folder; then cd $basedir @@ -225,7 +225,7 @@ function template_create { echo Creating template `basename $TEMPLATE_BASE`... - if templates_under_svn && [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then + if templates_under_svn && svn_folder `dirname $TEMPLATE_BASE`; then cd `dirname $TEMPLATE_BASE` svn mkdir `dirname $TEMPLATE_BASE` else @@ -240,7 +240,7 @@ function template_create { touch `template_perms` touch `template_packages` - if templates_under_svn && [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then + if templates_under_svn && svn_folder `dirname $TEMPLATE_BASE`; then cd `dirname $TEMPLATE_BASE` @@ -268,7 +268,7 @@ function template_create { info_commit="yes" fi - elif templates_under_svn && [ -d "$TEMPLATE_FOLDER/.svn" ]; then + elif templates_under_svn && svn_folder "$TEMPLATE_FOLDER"; then mkdir `template_files` `template_scripts` cd $TEMPLATE_FOLDER @@ -315,7 +315,7 @@ function template_create { cat $orig_packages > `template_packages` fi - if templates_under_svn && [ -d "$orig_template/.svn" ]; then + if templates_under_svn && svn_folder $orig_template; then cd `dirname $TEMPLATE_BASE` @@ -410,7 +410,7 @@ function template_update { done - if ! svn_check `template_packages` && [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then + if ! svn_check `template_packages` && svn_folder `dirname $TEMPLATE_BASE`; then cd `dirname $TEMPLATE_BASE` svn add `basedir $(template_packages)` fi @@ -443,7 +443,7 @@ function template_add { if [ ! -a "`template_files`/$candidate" ]; then mkdir -p `template_files`/`dirname $candidate` cp -a $jail/$candidate `template_files`/$candidate - if templates_under_svn && [ -d "`template_files`/.svn" ]; then + if templates_under_svn && svn_folder `template_files`; then cwd="`pwd`" cd `template_files` svn add ./$candidate @@ -472,15 +472,15 @@ function template_add { destination="`echo $(template_files)/$file | sed -e 's/\/$//'`" - if templates_under_svn && [ -d "`template_files`/.svn" ]; then + if templates_under_svn && svn_folder `template_files`; then candidate="./`dirname $file`" - if [ ! -d "`template_files`/$candidate/.svn" ]; then + if ! svn_folder `template_files`/$candidate; then mkdir -p `template_files`/$candidate cd `template_files`/`dirname $candidate` while true; do - if [ -d ".svn" ]; then + if svn_folder $(pwd); then svn add `basename $candidate` break else @@ -550,12 +550,12 @@ function check_template_exist { mkdir $component fi - if templates_under_svn && [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then + if templates_under_svn && svn_folder `dirname $TEMPLATE_BASE`; then svn add $component info_commit="yes" fi - elif templates_under_svn && [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && \ + elif templates_under_svn && svn_folder `dirname $TEMPLATE_BASE` && \ ! svn_check $component; then cd `dirname $TEMPLATE_BASE` @@ -580,7 +580,7 @@ function template_delete { if [ -e "`template_files`/$1" ]; then # first try to remove the file from the template - if templates_under_svn && [ -d "`template_files`/.svn" ]; then + if templates_under_svn && svn_folder `template_files`; then cd `template_files` svn del --force ./$1 || rm -rf ./$1 if [ -z "$SILENT" ]; then @@ -604,7 +604,7 @@ function template_delete { fi elif [ -e "`template_scripts`/$1" ]; then - if templates_under_svn && [ -d "`template_scripts`/.svn" ]; then + if templates_under_svn && svn_folder `template_scripts`; then cd `template_scripts` svn del --force ./$1 || rm -rf ./$1 if [ -z "$SILENT" ]; then @@ -640,7 +640,7 @@ function template_remove { exit 1 fi - if templates_under_svn && [ -d "$basedir/.svn" ]; then + if templates_under_svn && svn_folder $basedir; then cd $TEMPLATE_FOLDER svn update svn del --force $template @@ -729,7 +729,7 @@ function template_post_install_edit { vi `template_scripts`/$1 fi if [ "$sha1sum" != "`sha1sum $(template_scripts)/$1`" ] && \ - [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && [ -z "$SILENT" ]; then + svn_folder `dirname $TEMPLATE_BASE` && [ -z "$SILENT" ]; then echo "Please run 'jail-commit --all' to send changes to the repository" fi else @@ -743,7 +743,7 @@ function template_post_install_edit { touch `template_scripts`/$1 chmod +x `template_scripts`/$1 - if [ -d "`template_scripts`/.svn" ]; then + if svn_folder `template_scripts`; then cd `template_scripts` svn add $1 if [ -z "$SILENT" ]; then @@ -774,7 +774,7 @@ function template_edit { vi `template_packages` fi if [ "$sha1sum" != "`sha1sum $(template_packages)`" ] && \ - [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && [ -z "$SILENT" ]; then + svn_folder `dirname $TEMPLATE_BASE` && [ -z "$SILENT" ]; then echo "Please run 'jail-commit --all' to send changes to the repository" fi elif [ -e "`template_packages`" ]; then @@ -937,7 +937,7 @@ elif [ "$1" == "-d" ] || [ "$1" == "--delete" ]; then elif [ "$1" == "-s" ] || [ "$1" == "--sync" ]; then - if templates_under_svn && [ -d "$TEMPLATE_FOLDER/.svn" ]; then + if templates_under_svn && svn_folder $TEMPLATE_FOLDER; then ( cd $TEMPLATE_FOLDER && svn update ) true fi -- cgit v1.2.3