diff options
Diffstat (limited to 'trunk/src/templatepkg')
-rwxr-xr-x | trunk/src/templatepkg | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/trunk/src/templatepkg b/trunk/src/templatepkg index f56dc95..4f2592f 100755 --- a/trunk/src/templatepkg +++ b/trunk/src/templatepkg @@ -91,7 +91,10 @@ function display_help { echo " jail-root: the jail under file-name is located" ;; "-d" | "--delete") - echo " $BASENAME $option <template> <file-name>" + echo " $BASENAME $option <template> <file-name> [jail-root]" + echo "" + echo " file-name: the file or directory to be removed" + echo " jail-root: if specified, the file is also removed from the jail" ;; "-s" | "--sync") echo " $BASENAME $option" @@ -358,7 +361,7 @@ function template_create { fi if [ "$info_commit" == "yes" ] && [ -z "$SILENT" ]; then - echo "$BASENAME: please run 'jail-commit --all' to add files under $file into the svn repository" + echo "Please run 'jail-commit --all' to add files under $file into the svn repository" fi } @@ -461,7 +464,7 @@ function template_add { done if [ "$info_commit" == "yes" ] && [ -z "$SILENT" ]; then - echo "$BASENAME: please run 'jail-commit --all' to add files under `slash $file` into the svn repository" + echo "Please run 'jail-commit --all' to add files under `slash $file` into the svn repository" fi else @@ -491,7 +494,7 @@ function template_add { echo $BASENAME: error adding `slash $candidate` into the revision system else if [ -z "$SILENT" ]; then - echo "$BASENAME: please run 'jail-commit --all' to add `slash $file` into the svn repository" + echo "Please run 'jail-commit --all' to add `slash $file` into the svn repository" fi fi @@ -558,7 +561,7 @@ function check_template_exist { done if [ "$info_commit" == "yes" ] && [ -z "$SILENT" ]; then - echo "$BASENAME: please run 'jail-commit --all' to add new files in the svn repository" + echo "Please run 'jail-commit --all' to add new files in the svn repository" fi } @@ -566,25 +569,40 @@ function check_template_exist { function template_delete { # delete a file from a template - # usage: template_delete <file> + # usage: template_delete <file> [jail-root] if [ -e "$TEMPLATE_BASE.d/$1" ]; then + + # first try to remove the file from the template if use_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then cd $TEMPLATE_BASE.d svn del --force ./$1 || rm -rf ./$1 if [ -z "$SILENT" ]; then - echo "$BASENAME: please run 'jail-commit --all' to del $1 in the svn repository" + echo "Please run 'jail-commit --all' to del $1 in the svn repository" fi else rm -rf $TEMPLATE_BASE.d/$1 echo Removed $1 from $TEMPLATE_BASE.d fi + + # then, if requested, remove the file from the jail + if [ ! -z "$2" ]; then + if [ ! -d "$2" ]; then + echo $BASENAME: jail not found: $2 + elif [ -e "$2/$1" ]; then + rm -rf $2/$1 + echo Removed $1 from jail $2 + else + echo $BASENAME: file not found: $2/$1 + fi + fi + elif [ -e "$TEMPLATE_BASE.s/$1" ]; then if use_svn && [ -d "$TEMPLATE_BASE.s/.svn" ]; then cd $TEMPLATE_BASE.s svn del --force ./$1 || rm -rf ./$1 if [ -z "$SILENT" ]; then - echo "$BASENAME: please run 'jail-commit --all' to del $1 in the svn repository" + echo "Please run 'jail-commit --all' to del $1 in the svn repository" fi else rm -rf $TEMPLATE_BASE.s/$1 @@ -705,7 +723,7 @@ function template_post_install_edit { fi if [ "$sha1sum" != "`sha1sum $TEMPLATE_BASE.s/$1`" ] && \ [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && [ -z "$SILENT" ]; then - echo "$BASENAME: please run 'jail-commit --all' to send changes to the repository" + echo "Please run 'jail-commit --all' to send changes to the repository" fi else @@ -722,7 +740,7 @@ function template_post_install_edit { cd $TEMPLATE_BASE.s svn add $1 if [ -z "$SILENT" ]; then - echo "$BASENAME: please run 'jail-commit --all' to send the script to the repository" + echo "Please run 'jail-commit --all' to send the script to the repository" fi fi @@ -750,7 +768,7 @@ function template_edit { fi if [ "$sha1sum" != "`sha1sum $TEMPLATE_BASE.template`" ] && \ [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && [ -z "$SILENT" ]; then - echo "$BASENAME: please run 'jail-commit --all' to send changes to the repository" + echo "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 @@ -907,7 +925,7 @@ elif [ "$1" == "-d" ] || [ "$1" == "--delete" ]; then if [ -z "$3" ]; then usage else - template_delete $3 + template_delete $3 $4 fi elif [ "$1" == "-s" ] || [ "$1" == "--sync" ]; then |