diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-02-09 20:51:49 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-02-09 20:51:49 +0000 |
commit | 445092e48149b74c5ec4e85a7c4b2a2d30f64cfa (patch) | |
tree | 365a72eedcf73b2aa05d453b661402a4b1830045 /src/templatepkg | |
parent | 16241a8f1f0e2aa159ee0e6401cdca6837ee6f62 (diff) | |
download | simplepkg-445092e48149b74c5ec4e85a7c4b2a2d30f64cfa.tar.gz simplepkg-445092e48149b74c5ec4e85a7c4b2a2d30f64cfa.tar.bz2 |
templatepkg: small fix
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@172 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'src/templatepkg')
-rwxr-xr-x | src/templatepkg | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/templatepkg b/src/templatepkg index fb22e62..84b2ac9 100755 --- a/src/templatepkg +++ b/src/templatepkg @@ -33,19 +33,22 @@ function usage { echo "usage: $BASENAME <option> <template> [arguments]" echo "options:" echo "" - echo " -u: update a template acording a jail; arguments:" + echo " -c | --create: create a template from a jail;" + echo " -u | --update: update a template from a jail." echo "" - echo " $BASENAME -u <template> [jail-root]" + echo " -c and -u are equivalent and their arguments are:" echo "" - echo " (if ommited, jail-root defaults to /)" + echo " $BASENAME -u <template> [jail-root]" echo "" - echo " -a: add files into a template; arguments:" + echo " -a | --add: add files into a template; arguments for -a are:" echo "" echo " $BASENAME -a <template> <file-name> [jail-root]" echo "" echo " file-name: the file or directory to be added" echo " jail-root: the jail under file-name is located" echo "" + echo " in all cases, jail-root defaults to / if ommited" + echo "" exit 1 } @@ -114,17 +117,16 @@ function template_add { if [ -d "$TEMPLATE_BASE.d/$file" ]; then echo $BASENAME: folder $file already on $TEMPLATE_BASE.d, checking for contents - cd $jail/$file - for candidate in `find`; do + + cd $jail + for candidate in `find $file`; do if [ ! -a "$TEMPLATE_BASE.d/$candidate" ]; then mkdir -p $TEMPLATE_BASE.d/`dirname $candidate` - cp -a $candidate $TEMPLATE_BASE.d/$candidate - + cp -a $jail/$candidate $TEMPLATE_BASE.d/$candidate if [ "$TEMPLATES_UNDER_SVN" == "1" ]; then ( cd $TEMPLATE_BASE.d && svn add $candidate ) info_commit="yes" fi - fi done @@ -164,7 +166,8 @@ fi search_template $2 --new TEMPLATE="$TEMPLATE_BASE.template" -if [ "$1" == "-u" ] || [ "$1" == "--update" ]; then +if [ "$1" == "-u" ] || [ "$1" == "--update" ] || \ + [ "$1" == "-c" ] || [ "$1" == "--create" ]; then if [ -z "$3" ]; then ROOT="/" |