diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-04-05 16:51:05 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-04-05 16:51:05 +0000 |
commit | 76941b67c4039a85c49e9b29aa033cfc176e835c (patch) | |
tree | c926836bb63255755bfef5b55935b2ff29acfc51 /trunk/src | |
parent | 20cad7040b05e4a124437d28eefb284821af7b39 (diff) | |
download | simplepkg-76941b67c4039a85c49e9b29aa033cfc176e835c.tar.gz simplepkg-76941b67c4039a85c49e9b29aa033cfc176e835c.tar.bz2 |
templatepkg: added function template_delete
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@245 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/src')
-rwxr-xr-x | trunk/src/templatepkg | 42 |
1 files changed, 29 insertions, 13 deletions
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 <file> + + 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 |