]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
lots of changes, se file doc/CHANGELOG for info
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sat, 7 Apr 2007 18:14:39 +0000 (18:14 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sat, 7 Apr 2007 18:14:39 +0000 (18:14 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@303 04377dda-e619-0410-9926-eae83683ac58

trunk/doc/CHANGELOG
trunk/lib/common.sh
trunk/simplepkg.SlackBuild
trunk/src/jail-commit
trunk/src/templatepkg

index 4cdbd8a53a905a42002c3f09c621f05b778addaf..023450762904f4fbfeea0cce5bc2e12989c58b5e 100644 (file)
@@ -1,8 +1,25 @@
 simplepkg changelog
 ===================
 
+0.5pre4
+=======
+
+  - templatepkg:
+    - help usage summary improvements
+    - now using variable TEMPLATE_FOLDER
+    - SILENT env variable to decrease verbosity
+    - option -p | --post-install renamed to -b | --batch-edit
+    - option -p | --post-install now used to build a package from a template
+    - option -d | --delete now can also remove post-install scripts
+
+  - common.sh
+    - now using variable TEMPLATE_FOLDER
+
+  - jail-commit:
+    - calling templatepkg silently
+
 0.5pre3
--------
+=======
 
   - again, lots of bugfixes
 
index cb88ec71a0c34ee6589edad28092ffe65b95e583..275c355d82e9c9aefddad457ce7a2c6614d5ffdb 100644 (file)
@@ -324,11 +324,11 @@ function search_default_template {
   if [ -e "$BASE_CONF/default.template" ]; then
     TEMPLATE_BASE="$BASE_CONF/default"
     echo $BASENAME using default template
-  elif [ -e "$BASE_CONF/templates/default.template" ]; then
-    TEMPLATE_BASE="$BASE_CONF/templates/default"
+  elif [ -e "$TEMPLATE_FOLDER/default.template" ]; then
+    TEMPLATE_BASE="$TEMPLATE_FOLDER/default"
     echo $BASENAME: using default template
-  elif [ -e "$BASE_CONF/templates/default/default.template" ]; then
-    TEMPLATE_BASE="$BASE_CONF/templates/default/default"
+  elif [ -e "$TEMPLATE_FOLDER/default/default.template" ]; then
+    TEMPLATE_BASE="$TEMPLATE_FOLDER/default/default"
     echo $BASENAME: using default template
   elif [ -e "$BASE_CONF/defaults/templates/default/default.template" ]; then
     TEMPLATE_BASE="$BASE_CONF/defaults/templates/default"
@@ -350,8 +350,8 @@ function search_template {
   # templates can be stored either on
   #
   # - $BASE_CONF/template_name.template
-  # - $BASE_CONF/templates/template_name.template
-  # - $BASE_CONF/templates/template_name/template_name.template
+  # - $TEMPLATE_FOLDER/template_name.template
+  # - $TEMPLATE_FOLDER/template_name/template_name.template
   #
   # also, there's a folder for "oficial" simplepkg templates,
   # $BASE_CONF/defaults/templates/ and you can override any template
@@ -361,10 +361,10 @@ function search_template {
 
   if [ -f "$BASE_CONF/$1.template" ]; then
     TEMPLATE_BASE="$BASE_CONF/$1"
-  elif [ -f "$BASE_CONF/templates/$1.template" ]; then
-    TEMPLATE_BASE="$BASE_CONF/templates/$1"
-  elif [ -f "$BASE_CONF/templates/$1/$1.template" ]; then
-    TEMPLATE_BASE="$BASE_CONF/templates/$1/$1"
+  elif [ -f "$TEMPLATE_FOLDER/$1.template" ]; then
+    TEMPLATE_BASE="$TEMPLATE_FOLDER/$1"
+  elif [ -f "$TEMPLATE_FOLDER/$1/$1.template" ]; then
+    TEMPLATE_BASE="$TEMPLATE_FOLDER/$1/$1"
   elif [ -f "$BASE_CONF/defaults/templates/$1/$1.template" ]; then
     TEMPLATE_BASE="$BASE_CONF/defaults/templates/$1/$1"
   else
@@ -373,9 +373,9 @@ function search_template {
       if [ "$TEMPLATE_STORAGE_STYLE" == "simplepkg-folder" ]; then
         TEMPLATE_BASE="$BASE_CONF/$1"
       elif [ "$TEMPLATE_STORAGE_STYLE" == "templates-folder" ]; then
-        TEMPLATE_BASE="$BASE_CONF/templates/$1"
+        TEMPLATE_BASE="$TEMPLATE_FOLDER/$1"
       else
-        TEMPLATE_BASE="$BASE_CONF/templates/$1/$1"
+        TEMPLATE_BASE="$TEMPLATE_FOLDER/$1/$1"
       fi
     elif [ "$2" == "--update" ]; then
       return 1
index ee79b1c158e22a909a31b9484162c97b43982786..7bf5a6ac1606af4f454918b91e57731c04fea9aa 100755 (executable)
@@ -1,12 +1,12 @@
 #!/bin/bash
 #
-# constroi o pacote do simplepkg
+# SlackBuild script for simplepkg
 #
 
 PACKAGE="simplepkg"
 PACK_DIR="package-$PACKAGE"
 BUILD=${BUILD:=1rha}
-VERSION="0.5pre3"
+VERSION="0.5pre4"
 ARCH="noarch"
 LIBEXEC="/usr/libexec/$PACKAGE"
 BINDIR="/usr/bin"
@@ -47,7 +47,6 @@ for file in $DOC_LIST; do
  cp doc/$file $PACK_DIR/$DOC_DIR/$PACKAGE-$VERSION/
 done
 
-# especifico do simplepkg
 mkdir -p $PACK_DIR/etc/$PACKAGE/{defaults,templates}
 rsync -av --exclude=.svn templates/* $PACK_DIR/etc/$PACKAGE/defaults/templates/
 chmod +x $PACK_DIR/etc/$PACKAGE/defaults/templates/vserver/vserver.s/*.sh
index 84748aa2df0273eab8e6c52e8d27fa42c77f9224..50bc6ae8c66ed2b6923eb94acb275895c42efa62 100755 (executable)
@@ -131,7 +131,7 @@ function do_commit {
       echo Updating $jailpath...
     fi
     if [ -d "$TEMPLATE_BASE.d" ] || [ -a "$TEMPLATE_BASE.template" ]; then
-      templatepkg -u $template $jailpath
+      SILENT=yes templatepkg -u $template $jailpath
       template_merge $jailpath
     fi
   fi
index df6467fb48075353716812828e14cc17f246416b..6a3b57dd5e072e5f4420ea44a1224a51aae0313c 100755 (executable)
@@ -28,67 +28,115 @@ else
   exit 1
 fi
 
-function usage {
+function usage_summary {
 
-  echo "usage: $BASENAME <option> <template> [arguments]"
   echo "options are:"
   echo ""
-  echo "  -c | --create: create a template from a jail or existing template:"
-  echo ""
-  echo "      $BASENAME -c <template> [jail-root|template-name]"
-  echo ""
-  echo "  -u | --update: update a template from a jail:"
-  echo ""
-  echo "      $BASENAME -u <template> [jail-root]"
-  echo ""
-  echo "  -a | --add: add files into a template:"
-  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 "  -d | --delete: delete files or folders from a template:"
-  echo ""
-  echo "      $BASENAME -d <template> <file-name>"
-  echo ""
-  echo "  -s | --sync: sync $BASE_CONF/templates working copy:"
-  echo ""
-  echo "      $BASENAME -s"
-  echo ""   
-  echo "  -e | --export: export $BASE_CONF/templates to a svn repository:"
-  echo ""   
-  echo "      $BASENAME -e <svn-repository>"
-  echo ""   
-  echo "  -i | --import: grab $BASE_CONF/templates from a svn repository:"   
-  echo ""   
-  echo "      $BASENAME -i <svn-repository>"
-  echo ""   
-  echo "  -r | --remove: remove a template:"   
-  echo ""   
-  echo "      $BASENAME -r <template-name>"
-  echo ""   
-  echo "  -l | --list: list templates:"   
-  echo ""   
-  echo "      $BASENAME -l [template-name]"
-  echo ""   
-  echo "  -p | --post-install: add or edit post-installation scripts:"
-  echo ""   
-  echo "      $BASENAME -p <template-name> <script-name>"
-  echo ""   
-  echo "  -t | --template-edit: edit template package list:"
+  echo "  -c | --create: create a template from a jail or existing template"
+  echo "  -u | --update: update a template from a jail"
+  echo "  -a | --add: add files into a template"
+  echo "  -d | --delete: delete files or folders from a template"
+  echo "  -s | --sync: sync $TEMPLATE_FOLDER working copy"
+  echo "  -e | --export: export $TEMPLATE_FOLDER to a svn repository"
+  echo "  -i | --import: grab $TEMPLATE_FOLDER from a svn repository"   
+  echo "  -r | --remove: remove a template"
+  echo "  -l | --list: list templates"
+  echo "  -b | --batch-edit: add or edit post-installation scripts"
+  echo "  -p | --pack: create a package from a template"
+  echo "  -t | --template-edit: edit template package list"
+  echo "  -h | --help: display this summary"   
   echo ""   
-  echo "      $BASENAME -t <template-name>"
-  echo ""   
-  echo "  -h | --help: display this summary."   
-  echo ""   
-  echo "  for -c, -u and -a jail-root defaults to / if ommited"
+
+}
+
+function display_help {
+
+  # display help
+  # usage: help [help-topic]
+
+  local option
+
+  if [ -z "$1" ]; then
+    echo "type $BASENAME --help <option> for aditional help"
+    usage_summary
+    exit
+  fi
+
+  option="$1"
+
+  if ! echo $option | grep -q -e "^-"; then
+    option="-`echo $option | sed -e 's/--/-/' -e 's/\(.\).*/\1/'`"
+  else
+    option="`echo $option | sed -e 's/--/-/' -e 's/\(..\).*/\1/'`"
+  fi
+
+  usage_summary | grep -e "^  $option"
+
   echo ""
-  exit
+  case $option in
+
+    "-c" | "--create")
+      echo "      $BASENAME $option <template> [jail-root|template-name]"
+      ;;
+    "-u" | "--update")
+      echo "      $BASENAME $option <template> [jail-root]"
+      ;;
+    "-a" | "--add")
+      echo "      $BASENAME $option <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"
+      ;;
+    "-d" | "--delete")
+      echo "      $BASENAME $option <template> <file-name>"
+      ;;
+    "-s" | "--sync")
+      echo "      $BASENAME $option"
+      ;;
+    "-e" | "--export")
+      echo "      $BASENAME $option <svn-repository>"
+      ;;
+    "-i" | "--import")
+      echo "      $BASENAME $option <svn-repository>"
+      ;;
+    "-r" | "--remove")
+      echo "      $BASENAME $option <template-name>"
+      ;;
+    "-l" | "--list")
+      echo "      $BASENAME $option [template-name]"
+      ;;
+    "-b" | "--batch-edit")
+      echo "      $BASENAME $option <template-name> <script-name>"
+      ;;
+    "-p" | "--pack")
+      echo "      $BASENAME $option <template-name> [version] [build] [arch]"
+      ;;
+    "-t" | "--template-edit")
+      echo "      $BASENAME $option <template-name>"
+      ;;
+    "-h" | "--help")
+      echo "  -h | --help: display this help."   
+      ;;
+    *)
+      echo $BASENAME: invalid help option $option
+  esac
+
+  case $option in
+    "-c" | "-u" | "-a")
+      echo ""
+      echo "  if ommited, jail-root defaults to /"
+      ;;
+  esac
+
+  echo ""
+
+}
+
+function usage {
 
-  # TODO: opcao para apagar script de pos-instalacao ou integrar no -d
-  # TODO: opcao para criar um pacote a partir de um template
-  # TODO: TEMPLATE_FOLDER
+  echo "usage: $BASENAME <option> [<template> [arguments]]"
+  usage_summary
+  exit
 
 }
 
@@ -115,10 +163,10 @@ function check_svn_repo {
 
 function import_export_templates {
 
-  # import from or export to $BASE_CONF in a svn repository
+  # import from or export to $TEMPLATE_FOLDER in a svn repository
   # usage: template_export <import|export> <repository>
 
-  local templates_folder basedir repository mode preposition
+  local templates templates_folder basedir repository mode preposition
 
   if [ "$?" != 0 ]; then
     usage
@@ -128,8 +176,9 @@ function import_export_templates {
     exit 1
   fi
 
-  templates_folder="$BASE_CONF/templates"
-  basedir="$BASE_CONF"
+  templates_folder="$TEMPLATE_FOLDER"
+  templates="`basename $TEMPLATE_FOLDER`"
+  basedir="`dirname $templates_folder`"
   mode="$1"
   repository="$2"
   preposition="from"
@@ -145,7 +194,7 @@ function import_export_templates {
       if [ "$mode" == "export" ]; then
         preposition="to"
         echo Exporting templates to $repository...
-        svn import templates/ $repository/ -m "initial import"
+        svn import $templates/ $repository/ -m "initial import"
         if [ "$?" != "0" ]; then
           echo $BASENAME: export failed
           exit 1
@@ -153,17 +202,17 @@ function import_export_templates {
       fi
 
       if [ -d "templates" ]; then
-        mv templates templates.old
+        mv $templates $templates.old
       fi
 
       echo Checking out templates from $repository...
-      svn checkout $repository templates
+      svn checkout $repository $templates
 
       if [ "$?" == "0" ]; then
-        rm -rf templates.old
+        rm -rf $templates.old
       else
-        rm -rf templates
-        mv templates.old templates
+        rm -rf $templates
+        mv $templates.old $templates
         echo $BASENAME: $mode failed
         exit 1
       fi
@@ -230,10 +279,10 @@ function template_create {
       info_commit="yes"
     fi
 
-  elif use_svn && [ -d "$BASE_CONF/templates/.svn" ]; then
+  elif use_svn && [ -d "$TEMPLATE_FOLDER/.svn" ]; then
 
     mkdir $TEMPLATE_BASE.{d,s}
-    cd $BASE_CONF/templates
+    cd $TEMPLATE_FOLDER
     svn add `basename $TEMPLATE_BASE`
     info_commit="yes"
 
@@ -247,7 +296,9 @@ function template_create {
 
     # copy from an existing template
 
-    if [ -d "$BASE_CONF/templates/$ROOT" ]; then
+    if [ -d "$TEMPLATE_FOLDER/$ROOT" ]; then
+      orig_template="$TEMPLATE_FOLDER/$ROOT"
+    elif [ -d "$BASE_CONF/templates/$ROOT" ]; then
       orig_template="$BASE_CONF/templates/$ROOT"
     elif [ -d "$BASE_CONF/defaults/templates/$ROOT" ]; then
       orig_template="$BASE_CONF/defaults/templates/$ROOT"
@@ -303,7 +354,7 @@ function template_create {
     echo $BASENAME: warning: no root directory defined
   fi
 
-  if [ "$info_commit" == "yes" ]; then
+  if [ "$info_commit" == "yes" ] && [ -z "$SILENT" ]; then
     echo "$BASENAME: please run 'jail-commit --all' to add files under $file into the svn repository"
   fi
 
@@ -405,7 +456,7 @@ function template_add {
         fi
       done
 
-      if [ "$info_commit" == "yes" ]; then
+      if [ "$info_commit" == "yes" ] && [ -z "$SILENT" ]; then
         echo "$BASENAME: please run 'jail-commit --all' to add files under `slash $file` into the svn repository"
       fi
 
@@ -435,7 +486,9 @@ function template_add {
         if [ "$?" != "0" ]; then
           echo $BASENAME: error adding `slash $candidate` into the revision system
         else
-          echo "$BASENAME: please run 'jail-commit --all' to add `slash $file` into the svn repository"
+          if [ -z "$SILENT" ]; then
+            echo "$BASENAME: please run 'jail-commit --all' to add `slash $file` into the svn repository"
+          fi
         fi
 
         cd $cwd
@@ -500,7 +553,7 @@ function check_template_exist {
 
   done
 
-  if [ "$info_commit" == "yes" ]; then
+  if [ "$info_commit" == "yes" ] && [ -z "$SILENT" ]; then
     echo "$BASENAME: please run 'jail-commit --all' to add new files in the svn repository"
   fi  
 
@@ -515,11 +568,24 @@ function template_delete {
     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 --all' to del $1 in the svn repository"
+      if [ -z "$SILENT" ]; then
+        echo "$BASENAME: 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
+  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"
+      fi
+    else
+      rm -rf $TEMPLATE_BASE.s/$1
+      echo Removed $1 from $TEMPLATE_BASE.s
+    fi
   else
     if [ ! -d "$TEMPLATE_BASE.d" ]; then
       echo $BASENAME: template folder $TEMPLATE_BASE.d not found
@@ -547,7 +613,7 @@ function template_remove {
   fi
 
   if use_svn && [ -d "$basedir/.svn" ]; then
-    cd $BASE_CONF/templates
+    cd $TEMPLATE_FOLDER
     svn update
     svn del --force $template
     if [ "$?" != "0" ]; then
@@ -569,10 +635,13 @@ function template_list {
   # list templates
   # usage: template_list [template_name]
 
-  # TODO: considerar outros valores de TEMPLATE_STORAGE_STYLE
-
   local list basedir template
 
+  if [ "$TEMPLATE_STORAGE_STYLE" != "own-folder" ]; then
+    echo "$BASENAME: option only available if TEMPLATE_STORAGE_STYLE configured as 'own-folder'"
+    return 1
+  fi
+
   if echo $1 | grep -q "/" || [ ! -z "$1" ]; then
 
     template="`echo $1 | cut -d "/" -f 1`"
@@ -585,8 +654,8 @@ function template_list {
       fi
     fi
 
-    if [ -e "$BASE_CONF/templates/$1" ]; then
-      list="`ls $BASE_CONF/templates/$1 2> /dev/null`"
+    if [ -e "$TEMPLATE_FOLDER/$1" ]; then
+      list="`ls $TEMPLATE_FOLDER/$1 2> /dev/null`"
       if [ "$?" == "0" ]; then
         list="`echo $list | xargs`"
         echo "In the custom template $template: $list"
@@ -601,7 +670,7 @@ function template_list {
       echo "Default templates: $list"
     fi
 
-    list="`ls $BASE_CONF/templates/$1 2> /dev/null`"
+    list="`ls $TEMPLATE_FOLDER/$1 2> /dev/null`"
     if [ "$?" == "0" ]; then
       list="`echo $list | xargs`"
       echo "Custom templates: $list"
@@ -631,7 +700,7 @@ function template_post_install_edit {
       vi $TEMPLATE_BASE.s/$1
     fi
     if [ "$sha1sum" != "`sha1sum $TEMPLATE_BASE.s/$1`" ] && \
-       [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then
+       [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && [ -z "$SILENT" ]; then
       echo "$BASENAME: please run 'jail-commit --all' to send changes to the repository"
     fi    
   else
@@ -648,7 +717,9 @@ function template_post_install_edit {
       if [ -d "$TEMPLATE_BASE.s/.svn" ]; then
         cd $TEMPLATE_BASE.s
         svn add $1
-        echo "$BASENAME: please run 'jail-commit --all' to send the script to the repository"
+        if [ -z "$SILENT" ]; then
+          echo "$BASENAME: please run 'jail-commit --all' to send the script to the repository"
+        fi
       fi
 
       echo "$BASENAME: script created; run templatepkg -p `basename $TEMPLATE_BASE` $1 again to edit it"
@@ -674,7 +745,7 @@ function template_edit {
       vi $TEMPLATE_BASE.template
     fi
     if [ "$sha1sum" != "`sha1sum $TEMPLATE_BASE.template`" ] && \
-       [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then
+       [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && [ -z "$SILENT" ]; then
       echo "$BASENAME: please run 'jail-commit --all' to send changes to the repository"
     fi
   elif [ -e "$TEMPLATE_BASE.template" ]; then
@@ -709,6 +780,74 @@ function setroot {
 
 }
 
+function create_doinst {
+
+  # create a doinst.sh from a template.perms file
+  # usage: create_doinst <doinst-path>
+
+  rm $1/doinst.sh
+
+  if [ -s "$TEMPLATE_BASE.perms" ]; then
+    echo Setting jail $1 permissions...
+    cat $TEMPLATE_BASE.perms | while read entry; do
+      file="`echo $entry | cut -d ";" -f 1`"
+      if [ -a "$TEMPLATE_BASE.d/$file" ] && [ -a "$1/$file" ]; then
+        owner="`echo $entry | cut -d ";" -f 2`"
+        group="`echo $entry | cut -d ";" -f 3`"
+        perms="`echo $entry | cut -d ";" -f 4`"
+        echo "( chmod $perms /$file )" >> $1/doinst.sh
+        chown "( $owner:$group /$file )" >> $1/doinst.sh
+      fi
+    done
+  fi
+
+}
+
+function package_template {
+
+  # make a package from a template
+  # usage: package_template [version] [build] [arch]
+
+  local template version build arch
+
+  template="`basename $TEMPLATE_BASE`"
+
+  if [ ! -d "$TEMPLATE_BASE.d" ]; then
+    $BASENAME: folder not found: $TEMPLATE.base.d
+    return 1
+  fi
+
+  echo Buiding package for template $template...
+
+  version=${1:=1}
+  build=${2:=1}
+  arch=${3:=noarch}
+
+  TMP=${TMP:=/tmp}
+  rm -rf $TMP/templatepkg
+  mkdir -p $TMP/templatepkg
+
+  rsync --exclude=.svn $TEMPLATE_BASE.d/ $TMP/templatepkg/
+  mkdir $TMP/templatepkg/install
+  create_doinst $TMP/templatepkg/install
+
+  echo "template-$template: template-$template" > $TMP/templatepkg/install/slack-desc
+  echo "template-$template: " >> $TMP/templatepkg/install/slack-desc
+  echo "template-$template: simplepkg template $template" >> $TMP/templatepkg/install/slack-desc
+
+  for ((n=1;n<=8;n++)); do
+    echo "template-$template: " >> $TMP/templatepkg/install/slack-desc
+  done
+
+  cd $TMP/templatepkg
+
+  makepkg -c n -l y $TMP/template-$template-$version-noarch-$build.tgz
+
+  cd $TMP
+  rm -rf templatepkg
+
+}
+
 # -----------------------------------------------------
 #                       main
 # -----------------------------------------------------
@@ -755,8 +894,8 @@ elif [ "$1" == "-d" ] || [ "$1" == "--delete" ]; then
 
 elif [ "$1" == "-s" ] || [ "$1" == "--sync" ]; then
 
-  if use_svn && [ -d "$BASE_CONF/templates/.svn" ]; then
-    ( cd $BASE_CONF/templates && svn update )
+  if use_svn && [ -d "$TEMPLATE_FOLDER/.svn" ]; then
+    ( cd $TEMPLATE_FOLDER && svn update )
     true
   fi
 
@@ -779,7 +918,7 @@ elif [ "$1" == "-l" ] || [ "$1" == "--list" ]; then
 
   template_list $2
 
-elif [ "$1" == "-p" ] || [ "$1" == "--post-install" ]; then
+elif [ "$1" == "-b" ] || [ "$1" == "--batch-edit" ]; then
 
   require $3
   template_post_install_edit $3
@@ -789,9 +928,15 @@ elif [ "$1" == "-t" ] || [ "$1" == "--template-edit" ]; then
   require $2
   template_edit
 
+elif [ "$1" == "-p" ] || [ "$1" == "--pack" ]; then
+
+  require $2
+  shift
+  package_template $*
+
 elif [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
 
-  usage
+  display_help $2 
 
 else
   usage