From 76941b67c4039a85c49e9b29aa033cfc176e835c Mon Sep 17 00:00:00 2001 From: rhatto Date: Thu, 5 Apr 2007 16:51:05 +0000 Subject: templatepkg: added function template_delete git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@245 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/templatepkg | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) (limited to 'trunk/src/templatepkg') diff --git a/trunk/src/templatepkg b/trunk/src/templatepkg index b184720..1f10ebc 100755 --- a/trunk/src/templatepkg +++ b/trunk/src/templatepkg @@ -396,7 +396,34 @@ function check_template_exist { } -# command line parsing +function template_delete { + + # delete a file from a template + # usage: template_delete + + if [ -a "$TEMPLATE_BASE.d/$1" ]; then + if use_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then + cd $TEMPLATE_BASE.d + svn del --force ./$1 || rm -rf ./$1 + echo $BASENAME: please run jail-commit to del $1 in the svn repository + else + rm -rf $TEMPLATE_BASE.d/$1 + echo Removed $1 from $TEMPLATE_BASE.d + fi + else + if [ ! -d "$TEMPLATE_BASE.d" ]; then + echo $BASENAME: template folder $TEMPLATE_BASE.d not found + else + echo $BASENAME: file $1 not found at $TEMPLATE_BASE.d + fi + exit 1 + fi + +} + +# ----------------------------------------------------- +# main +# ----------------------------------------------------- if [ -z "$2" ]; then usage @@ -430,18 +457,7 @@ elif [ "$1" == "-d" ] || [ "$1" == "--delete" ]; then if [ -z "$3" ]; then usage else - - if [ -a "$TEMPLATE_BASE.d/$3" ]; then - if use_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then - cd $TEMPLATE_BASE.d - svn del --force ./$3 || rm -rf ./$3 - echo $BASENAME: please run jail-commit to del $3 in the svn repository - else - rm -rf $TEMPLATE_BASE.d/$3 - echo Removed $3 from $TEMPLATE_BASE.d - fi - fi - + template_delete $3 fi elif [ "$1" == "-s" ] || [ "$1" == "--sync" ]; then -- cgit v1.2.3