diff options
-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 |