aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/templatepkg23
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="/"