]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
new 'compact' template format
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Thu, 4 Dec 2008 00:50:47 +0000 (00:50 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Thu, 4 Dec 2008 00:50:47 +0000 (00:50 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@634 04377dda-e619-0410-9926-eae83683ac58

89 files changed:
trunk/conf/simplepkg.conf
trunk/doc/CHANGELOG
trunk/lib/common.sh
trunk/src/createpkg
trunk/src/jail-commit
trunk/src/mkjail
trunk/src/templatepkg
trunk/templates/openoffice/files/etc/profile.d/lang.csh [moved from trunk/templates/openoffice/openoffice.d/etc/profile.d/lang.csh with 100% similarity]
trunk/templates/openoffice/files/etc/profile.d/lang.sh [moved from trunk/templates/openoffice/openoffice.d/etc/profile.d/lang.sh with 100% similarity]
trunk/templates/openoffice/files/opt/OpenOffice.org [moved from trunk/templates/openoffice/openoffice.d/opt/OpenOffice.org with 100% similarity]
trunk/templates/openoffice/packages [moved from trunk/templates/openoffice/openoffice.template with 100% similarity]
trunk/templates/openoffice/perms [moved from trunk/templates/openoffice/openoffice.perms with 100% similarity]
trunk/templates/openoffice/scripts/post-install.sh [moved from trunk/templates/openoffice/openoffice.s/post-install.sh with 100% similarity]
trunk/templates/slackware-12.1/packages [moved from trunk/templates/slackware-12.1/slackware-12.1.template with 100% similarity]
trunk/templates/slamd64-11.0/packages [moved from trunk/templates/slamd64-11.0/slamd64-11.0.template with 100% similarity]
trunk/templates/slamd64-11.0/scripts/post-install.sh [moved from trunk/templates/slamd64-11.0/slamd64-11.0.s/post-install.sh with 100% similarity]
trunk/templates/slamd64-12.0/packages [moved from trunk/templates/slamd64-12.0/slamd64-12.0.template with 100% similarity]
trunk/templates/slamd64-12.0/scripts/post-install.sh [moved from trunk/templates/slamd64-12.0/slamd64-12.0.s/post-install.sh with 100% similarity]
trunk/templates/slamd64-12.1/packages [moved from trunk/templates/slamd64-12.1/slamd64-12.1.template with 100% similarity]
trunk/templates/slamd64-12.1/perms [moved from trunk/templates/slamd64-12.1/slamd64-12.1.perms with 100% similarity]
trunk/templates/slamd64-12.1/scripts/post-install.sh [moved from trunk/templates/slamd64-12.1/slamd64-12.1.s/post-install.sh with 100% similarity]
trunk/templates/vserver-legacy/files/etc/apache/httpd.conf [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/apache/httpd.conf with 100% similarity]
trunk/templates/vserver-legacy/files/etc/apache/php.ini [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/apache/php.ini with 100% similarity]
trunk/templates/vserver-legacy/files/etc/apache/vhosts [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/apache/vhosts with 100% similarity]
trunk/templates/vserver-legacy/files/etc/hosts [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/hosts with 100% similarity]
trunk/templates/vserver-legacy/files/etc/logrotate.d/apache [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/logrotate.d/apache with 100% similarity]
trunk/templates/vserver-legacy/files/etc/profile [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/profile with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.0 [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.0 with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.4 [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.4 with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.6 [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.6 with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.K [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.K with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.M [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.M with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.S [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.S with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.httpd [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.httpd with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.inet2 [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.inet2 with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.inetd [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.inetd with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.ip_forward [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.ip_forward with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.local [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.local with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.mysqld [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.mysqld with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.postfix [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.postfix with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.sendmail [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.sendmail with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.serial [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.serial with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.sshd [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.sshd with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.syslog [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.syslog with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rc.d/rc.sysvinit [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rc.d/rc.sysvinit with 100% similarity]
trunk/templates/vserver-legacy/files/etc/rssh.conf [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/rssh.conf with 100% similarity]
trunk/templates/vserver-legacy/files/etc/ssh/sshd_config [moved from trunk/templates/vserver-legacy/vserver-legacy.d/etc/ssh/sshd_config with 100% similarity]
trunk/templates/vserver-legacy/files/var/www/htdocs/missing.html [moved from trunk/templates/vserver-legacy/vserver-legacy.d/var/www/htdocs/missing.html with 100% similarity]
trunk/templates/vserver-legacy/files/var/www/missing.html [moved from trunk/templates/vserver-legacy/vserver-legacy.d/var/www/missing.html with 100% similarity]
trunk/templates/vserver-legacy/packages [moved from trunk/templates/vserver-legacy/vserver-legacy.template with 100% similarity]
trunk/templates/vserver-legacy/perms [moved from trunk/templates/vserver-legacy/vserver-legacy.perms with 100% similarity]
trunk/templates/vserver-legacy/scripts/GPG-KEY [moved from trunk/templates/vserver-legacy/vserver-legacy.s/GPG-KEY with 100% similarity]
trunk/templates/vserver-legacy/scripts/devices.tar.gz [moved from trunk/templates/vserver-legacy/vserver-legacy.s/devices.tar.gz with 100% similarity]
trunk/templates/vserver-legacy/scripts/skel.conf [moved from trunk/templates/vserver-legacy/vserver-legacy.s/skel.conf with 100% similarity]
trunk/templates/vserver-legacy/scripts/vserver-legacy.sh [moved from trunk/templates/vserver-legacy/vserver-legacy.s/vserver-legacy.sh with 100% similarity]
trunk/templates/vserver/files/etc/apache/httpd.conf [moved from trunk/templates/vserver/vserver.d/etc/apache/httpd.conf with 100% similarity]
trunk/templates/vserver/files/etc/apache/php.ini [moved from trunk/templates/vserver/vserver.d/etc/apache/php.ini with 100% similarity]
trunk/templates/vserver/files/etc/apache/vhosts [moved from trunk/templates/vserver/vserver.d/etc/apache/vhosts with 100% similarity]
trunk/templates/vserver/files/etc/hosts [moved from trunk/templates/vserver/vserver.d/etc/hosts with 100% similarity]
trunk/templates/vserver/files/etc/logrotate.d/apache [moved from trunk/templates/vserver/vserver.d/etc/logrotate.d/apache with 100% similarity]
trunk/templates/vserver/files/etc/profile [moved from trunk/templates/vserver/vserver.d/etc/profile with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.0 [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.0 with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.4 [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.4 with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.6 [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.6 with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.K [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.K with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.M [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.M with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.S [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.S with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.httpd [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.httpd with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.inet2 [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.inet2 with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.inetd [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.inetd with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.ip_forward [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.ip_forward with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.local [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.local with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.mysqld [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.mysqld with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.postfix [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.postfix with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.sendmail [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.sendmail with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.serial [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.serial with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.sshd [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.sshd with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.syslog [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.syslog with 100% similarity]
trunk/templates/vserver/files/etc/rc.d/rc.sysvinit [moved from trunk/templates/vserver/vserver.d/etc/rc.d/rc.sysvinit with 100% similarity]
trunk/templates/vserver/files/etc/rssh.conf [moved from trunk/templates/vserver/vserver.d/etc/rssh.conf with 100% similarity]
trunk/templates/vserver/files/etc/ssh/sshd_config [moved from trunk/templates/vserver/vserver.d/etc/ssh/sshd_config with 100% similarity]
trunk/templates/vserver/files/var/www/htdocs/missing.html [moved from trunk/templates/vserver/vserver.d/var/www/htdocs/missing.html with 100% similarity]
trunk/templates/vserver/files/var/www/missing.html [moved from trunk/templates/vserver/vserver.d/var/www/missing.html with 100% similarity]
trunk/templates/vserver/packages [moved from trunk/templates/vserver/vserver.template with 100% similarity]
trunk/templates/vserver/perms [moved from trunk/templates/vserver/vserver.perms with 100% similarity]
trunk/templates/vserver/scripts/GPG-KEY [moved from trunk/templates/vserver/vserver.s/GPG-KEY with 100% similarity]
trunk/templates/vserver/scripts/devices.tar.gz [moved from trunk/templates/vserver/vserver.s/devices.tar.gz with 100% similarity]
trunk/templates/vserver/scripts/vserver.sh [moved from trunk/templates/vserver/vserver.s/vserver.sh with 100% similarity]

index b50372c8a5ccd6ec6564a159bbc07b3e8083375b..60c9ac748cc4befef6f72a15480ecd4dcb132b72 100644 (file)
@@ -202,11 +202,11 @@ TEMPLATE_FOLDER="/etc/simplepkg/templates"
 #
 # - simplepkg-folder: templates are stored at /etc/simplepkg
 # - templates-folder: templates are stored at /etc/simplepkg/templates
-# - own-folder: each template stored at its own folder
-#               at /etc/simplepkg/templates/template-name
+# - own-folder or compact: each template stored at its own folder
+#                          at /etc/simplepkg/templates/template-name
 #
 # This variable has backwards purposes only, so dont change it.
-TEMPLATE_STORAGE_STYLE="own-folder"
+TEMPLATE_STORAGE_STYLE="compact"
 
 #---------------------------------------------------------------------
 #                        MKJAIL SECTION
index c1e396f2e506a244f0d55b6f73496af833938068..ae694b7df0f8c7f7120caaa04d585ba5b0d9f4f5 100644 (file)
@@ -4,6 +4,7 @@ simplepkg changelog
 0.6pre31
 ========
 
+    - new "compact" template storage format
     - common.sh:
       - other minor changes
       - repository metainformationg is now added at svn control if applicable
@@ -12,7 +13,7 @@ simplepkg changelog
       - new config parameter "TMP" 
       - renamed function use_svn to templates_under_svn
     - simplaret: simplaret_search_and_process_patch do not donwload a package with the same
-                 package name twicce in any case
+                 package name twice in any case
     - default simplepkg.conf and repos.conf moved to default/ folder
     - templatepkg and mkjail: minor changes
     - templates:
index 4e73ea5ea93204942f418ad1ae000e60cf981c27..f9c115fe180ad68c48c0d9e4ddedec6c7654125e 100644 (file)
@@ -15,6 +15,8 @@
 #  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 #  Place - Suite 330, Boston, MA 02111-1307, USA
 #
+# $Rev$ - $Author$
+#
 
 BASE_CONF="/etc/simplepkg"
 CONF="$BASE_CONF/simplepkg.conf"
@@ -150,13 +152,13 @@ function eval_parameter {
 
 function set_constants {
 
-    # Set common constants
-    # on/off
-    on=1
-    off=0
-    # yes/no
-    yes=1
-    no=0
+  # Set common constants
+  # on/off
+  on=1
+  off=0
+  # yes/no
+  yes=1
+  no=0
 
 }
 
@@ -294,8 +296,9 @@ function eval_config {
 
   if [ "$TEMPLATE_STORAGE_STYLE" != "simplepkg-folder" ] && \
      [ "$TEMPLATE_STORAGE_STYLE" != "templates-folder" ] && \
-     [ "$TEMPLATE_STORAGE_STYLE" != "own-folder" ]; then
-    TEMPLATE_STORAGE_STYLE="own-folder"
+     [ "$TEMPLATE_STORAGE_STYLE" != "own-folder" ] && \
+     [ "$TEMPLATE_STORAGE_STYLE" != "compact" ]; then
+    TEMPLATE_STORAGE_STYLE="compact"
   fi
 
   if [ ! -z "$ROOT" ]; then
@@ -390,7 +393,13 @@ function search_default_template {
   elif [ -e "$TEMPLATE_FOLDER/default/default.template" ]; then
     TEMPLATE_BASE="$TEMPLATE_FOLDER/default/default"
     echo $BASENAME: using default template
+  elif [ -e "$TEMPLATE_FOLDER/default/packages" ]; then
+    TEMPLATE_BASE="$TEMPLATE_FOLDER/default"
+    echo $BASENAME: using default template
   elif [ -e "$BASE_CONF/defaults/templates/default/default.template" ]; then
+    TEMPLATE_BASE="$BASE_CONF/defaults/templates/default/default"
+    echo $BASENAME using default template
+  elif [ -e "$BASE_CONF/defaults/templates/default/packages" ]; then
     TEMPLATE_BASE="$BASE_CONF/defaults/templates/default"
     echo $BASENAME using default template
   else
@@ -425,6 +434,8 @@ function search_template {
     TEMPLATE_BASE="$TEMPLATE_FOLDER/$1"
   elif [ -f "$TEMPLATE_FOLDER/$1/$1.template" ]; then
     TEMPLATE_BASE="$TEMPLATE_FOLDER/$1/$1"
+  elif [ -f "$TEMPLATE_FOLDER/$1/packages" ]; then
+    TEMPLATE_BASE="$TEMPLATE_FOLDER/$1"
   elif [ -f "$BASE_CONF/defaults/templates/$1/$1.template" ] && \
        [ "$2" != "--update" ]; then
     TEMPLATE_BASE="$BASE_CONF/defaults/templates/$1/$1"
@@ -435,8 +446,12 @@ function search_template {
         TEMPLATE_BASE="$BASE_CONF/$1"
       elif [ "$TEMPLATE_STORAGE_STYLE" == "templates-folder" ]; then
         TEMPLATE_BASE="$TEMPLATE_FOLDER/$1"
-      else
+      elif [ "$TEMPLATE_STORAGE_STYLE" == "own-folder" ]; then
         TEMPLATE_BASE="$TEMPLATE_FOLDER/$1/$1"
+      elif [ "$TEMPLATE_STORAGE_STYLE" == "compact" ]; then
+        TEMPLATE_BASE="$TEMPLATE_FOLDER/$1"
+      else
+        TEMPLATE_BASE="$TEMPLATE_FOLDER/$1"
       fi
     elif [ "$2" == "--update" ]; then
       return 1
@@ -448,6 +463,46 @@ function search_template {
 
 }
 
+function template_packages {
+
+  if [ "$TEMPLATE_STORAGE_STYLE" == "compact" ]; then
+    echo $TEMPLATE_BASE/packages
+  else
+    echo $TEMPLATE_BASE.template
+  fi
+
+}
+
+function template_perms {
+
+  if [ "$TEMPLATE_STORAGE_STYLE" == "compact" ]; then
+    echo $TEMPLATE_BASE/perms
+  else
+    echo $TEMPLATE_BASE.perms
+  fi
+
+}
+
+function template_files {
+
+  if [ "$TEMPLATE_STORAGE_STYLE" == "compact" ]; then
+    echo $TEMPLATE_BASE/files
+  else
+    echo $TEMPLATE_BASE.d
+  fi
+
+}
+
+function template_scripts {
+
+  if [ "$TEMPLATE_STORAGE_STYLE" == "compact" ]; then
+    echo $TEMPLATE_BASE/scripts
+  else
+    echo $TEMPLATE_BASE.s
+  fi
+
+}
+
 # -----------------------------------------------
 #           unix permission functions
 # -----------------------------------------------
@@ -745,7 +800,7 @@ function update_template_files {
   # update template files from svn
   # usage: update_template_files
 
-  if templates_under_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then
+  if templates_under_svn && [ -d "`template_files`/.svn" ]; then
     echo Checking out last template revision from svn...
     cd `dirname $TEMPLATE_BASE`
     svn update
@@ -761,13 +816,13 @@ function update_jail_packages {
   # check if installed packages are listed in the template
   for pack in `ls -1 $1/var/log/packages/`; do
     pack=`package_name $pack`
-    if ! `grep -v -e "^#" $TEMPLATE_BASE.template | cut -d : -f 1 | awk '{ print $1 }' | grep -q -e "^$pack\$"`; then
+    if ! `grep -v -e "^#" $(template_packages) | cut -d : -f 1 | awk '{ print $1 }' | grep -q -e "^$pack\$"`; then
       ROOT=$1 removepkg $pack
     fi
   done
 
   # check if each package from the template is installed
-  grep -v -e "^#" $TEMPLATE_BASE.template | cut -d : -f 1 | awk '{ print $1 }' | while read pack; do
+  grep -v -e "^#" `template_packages` | cut -d : -f 1 | awk '{ print $1 }' | while read pack; do
 
     # check if the package is installed
     pack="`echo $pack | sed -e 's/\+/\\\+/'`"
@@ -788,12 +843,12 @@ function copy_template_files {
   # usage: copy_template_files <jail-path>
 
   if [ -d "$1" ]; then
-    if [ -d "$TEMPLATE_BASE.d" ]; then
+    if [ -d "`template_files`" ]; then
       echo "Copying template files to $1..."
-      if templates_under_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then
-        rsync -av --exclude=.svn $TEMPLATE_BASE.d/ $1/
+      if templates_under_svn && [ -d "`template_files`/.svn" ]; then
+        rsync -av --exclude=.svn `template_files`/ $1/
       else
-        rsync -av $TEMPLATE_BASE.d/ $1/
+        rsync -av `template_files`/ $1/
       fi
     fi
   fi
@@ -805,11 +860,11 @@ function set_jail_perms {
   # set template file permissions under a jail
   # usage: set_jail_perms <jail-path>
 
-  if [ -s "$TEMPLATE_BASE.perms" ]; then
+  if [ -s "`template_perms`" ]; then
     echo Setting jail $1 permissions...
-    cat $TEMPLATE_BASE.perms | while read entry; do
+    cat `template_perms` | while read entry; do
       file="`echo $entry | cut -d ";" -f 1`"
-      if [ -e "$TEMPLATE_BASE.d/$file" ] && [ -a "$1/$file" ]; then
+      if [ -e "`template_files`/$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`"
index 80f37fc55b01be9d8c949b97b0aa670657e30184..98dde1f3fe5cbd376ca0a7c0d2ee6065ad5c1b85 100644 (file)
@@ -16,9 +16,9 @@
 #  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 #  Place - Suite 330, Boston, MA 02111-1307, USA
 #
-# /etc/simplepkg/slackbuildrc parameters:
+# /etc/slackbuildrc parameters:
 #
-# SLACKBUILDS_DIR="/folder/to/place/slackbuilds", defaults to /var/slackbuilds
+# SLACKBUILDS_DIR="/path/to/slackbuilds", defaults to /var/simplepkg/slackbuilds
 # SVN="svn://repository", defaults do http://slack.sarava.org/slackbuilds
 # SYNC="yes|no", whether to always update the repository
 #
index 278d766740c606d744c3abc6a22fbbb4805ef0cd..d91a767534b48029b3c5b4ae03b5fe98c2a18b89 100755 (executable)
@@ -43,12 +43,12 @@ function template_merge {
 
   # usage: template_merge <jail-path>
 
-  if [ -z "$1" ] || [ ! -d "$TEMPLATE_BASE.d" ]; then
+  if [ -z "$1" ] || [ ! -d "`template_files`" ]; then
     return 1
   fi
 
-  echo "" > $TEMPLATE_BASE.perms.tmp
-  cd $TEMPLATE_BASE.d
+  echo "" > `template_perms`.tmp
+  cd `template_files`
 
   for file in `find | grep -v -e "/.svn$" | grep -v -e "/.svn/" | grep -v -e  "^\.$"`; do
 
@@ -71,10 +71,10 @@ function template_merge {
       group="`get_group $1/$file`"
 
       # secure the file
-      chown root.root $TEMPLATE_BASE.d/$file
-      chmod $perms $TEMPLATE_BASE.d/$file
+      chown root.root `template_files`/$file
+      chmod $perms `template_files`/$file
       
-      echo "$file;$owner;$group;$perms" >> $TEMPLATE_BASE.perms.tmp
+      echo "$file;$owner;$group;$perms" >> `template_perms`.tmp
 
     else
       if [ ! -e "$1/$file" ]; then
@@ -84,11 +84,11 @@ function template_merge {
 
   done
 
-  cat $TEMPLATE_BASE.perms.tmp | sed '/^$/d' > $TEMPLATE_BASE.perms
-  rm -f $TEMPLATE_BASE.perms.tmp
+  cat `template_perms`.tmp | sed '/^$/d' > `template_perms`
+  rm -f `template_perms`.tmp
 
-  if templates_under_svn && ! svn_check $TEMPLATE_BASE.perms; then
-    svn add $TEMPLATE_BASE.perms
+  if templates_under_svn && ! svn_check `template_perms`; then
+    svn add `template_perms`
   fi
 
 }
@@ -135,7 +135,7 @@ function do_commit {
     else
       echo Updating $jailpath...
     fi
-    if [ -d "$TEMPLATE_BASE.d" ] || [ -a "$TEMPLATE_BASE.template" ]; then
+    if [ -d "`template_files`" ] || [ -a "`template_packages`" ]; then
       SILENT=yes templatepkg -u $template $jailpath
       template_merge $jailpath
     fi
index 47930b2aa8ee87f883d1fe7eb7d8f1a72c4f00bc..4b00c3824f33f82d59986059d294eee83c5ac82b 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/bash
 #          
-# mkjail v0.4: chroot jail maker
-#
+# mkjail: chroot jail maker
 # feedback: rhatto at riseup.net | GPL
 #
 #  Mkjail is free software; you can redistribute it and/or modify it under the
@@ -16,6 +15,8 @@
 #  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 #  Place - Suite 330, Boston, MA 02111-1307, USA
 #
+# $Rev$ - $Author$
+#
 
 COMMON="/usr/libexec/simplepkg/common.sh"
 BASENAME="`basename $0`"
@@ -46,8 +47,8 @@ function exec_post_install_scripts {
   fi
 
   echo "$BASENAME: executing template scripts..."
-  if [ -d "$TEMPLATE_BASE.s" ]; then
-    for file in $TEMPLATE_BASE.s/*; do
+  if [ -d "`template_scripts`" ]; then
+    for file in `template_scripts`/*; do
       if [ -x "$file" ]; then
         $file $1 $2
       fi
@@ -89,7 +90,7 @@ if [ "$result" != "0" ]; then
   exit 1
 fi
 
-TEMPLATE="$TEMPLATE_BASE.template"
+TEMPLATE="`template_packages`"
 
 if [ ! -d "$JAIL_ROOT/$server" ]; then
   mkdir -p $JAIL_ROOT/$server
index e1533c709ae864c514f59f8143f37ec89a390690..2c8e367d7a2c56969ef124bad90e53fac8d6b56d 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/bash
 #
-# templatepkg v0.3: template maintenance script from simplepkg suite
-#
+# templatepkg: template maintenance script from simplepkg suite
 # feedback: rhatto at riseup.net | gpl
 # 
 #  Templatepkg is free software; you can redistribute it and/or modify it under the
@@ -16,6 +15,8 @@
 #  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 #  Place - Suite 330, Boston, MA 02111-1307, USA
 #
+# $Rev$ - $Author$
+#
 
 COMMON="/usr/libexec/simplepkg/common.sh"
 BASENAME="`basename $0`"
@@ -237,6 +238,7 @@ function template_create {
   # create a new template
 
   local template_base info_commit orig_template list
+  local orig_packages orig_perms orig_scripts orig_files
 
   if [ ! -d "`dirname $TEMPLATE_BASE`" ]; then
 
@@ -254,46 +256,46 @@ function template_create {
     exit 1
   fi
 
-  touch $TEMPLATE_BASE.perms
-  touch $TEMPLATE_BASE.template
+  touch `template_perms`
+  touch `template_packages`
 
   if templates_under_svn && [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then
 
     cd `dirname $TEMPLATE_BASE`
 
-    if ! svn_check $TEMPLATE_BASE.d; then
-      svn mkdir $TEMPLATE_BASE.d
+    if ! svn_check `template_files`; then
+      svn mkdir `template_files`
       info_commit="yes"
     else
-      mkdir -p $TEMPLATE_BASE.d
+      mkdir -p `template_files`
     fi
 
-    if ! svn_check $TEMPLATE_BASE.s; then
-      svn mkdir $TEMPLATE_BASE.s
+    if ! svn_check `template_scripts`; then
+      svn mkdir `template_scripts`
       info_commit="yes"
     else
-      mkdir -p $TEMPLATE_BASE.s
+      mkdir -p `template_scripts`
     fi
 
-    if ! svn_check $TEMPLATE_BASE.template; then
-      svn add $TEMPLATE_BASE.template
+    if ! svn_check `template_packages`; then
+      svn add `template_packages`
       info_commit="yes"
     fi
 
-    if ! svn_check $TEMPLATE_BASE.perms; then
-      svn add $TEMPLATE_BASE.perms
+    if ! svn_check `template_perms`; then
+      svn add `template_perms`
       info_commit="yes"
     fi
 
   elif templates_under_svn && [ -d "$TEMPLATE_FOLDER/.svn" ]; then
 
-    mkdir $TEMPLATE_BASE.{d,s}
+    mkdir `template_files` `template_scripts`
     cd $TEMPLATE_FOLDER
     svn add `basename $TEMPLATE_BASE`
     info_commit="yes"
 
   else
-    mkdir $TEMPLATE_BASE.{d,s}
+    mkdir `template_files` `template_scripts`
   fi
 
   if [ -d "/$ROOT" ]; then
@@ -312,46 +314,58 @@ function template_create {
       return 1
     fi
 
-    if [ -f "$orig_template/$ROOT.perms" ]; then
-      cat $orig_template/$ROOT.perms > $TEMPLATE_BASE.perms
+    if [ -e "$orig_template/$ROOT/packages" ]; then
+      orig_packages="$orig_template/$ROOT/packages"
+      orig_perms="$orig_template/$ROOT/perms"
+      orig_scripts="$orig_template/$ROOT/scripts"
+      orig_files="$orig_template/$ROOT/files"
+    else
+      orig_packages="$orig_template/$ROOT.template"
+      orig_perms="$orig_template/$ROOT.perms"
+      orig_scripts="$orig_template/$ROOT.s"
+      orig_files="$orig_template/$ROOT.d"
+    fi
+
+    if [ -f "$orig_perms" ]; then
+      cat $orig_perms > `template_perms`
     fi
 
-    if [ -f "$orig_template/$ROOT.template" ]; then
-      cat $orig_template/$ROOT.template > $TEMPLATE_BASE.template
+    if [ -f "$orig_packages" ]; then
+      cat $orig_packages > `template_packages`
     fi
       
     if templates_under_svn && [ -d "$orig_template/.svn" ]; then
 
       cd `dirname $TEMPLATE_BASE`
 
-      list="`ls $orig_template/$ROOT.d/ 2> /dev/null`"
+      list="`ls $orig_files/ 2> /dev/null`"
       if [ ! -z "$list" ]; then
         echo Copying files to the new template...
-        rsync -av --exclude=.svn $orig_template/$ROOT.d/ $TEMPLATE_BASE.d/
-        svn add `basename $TEMPLATE_BASE`.d/*
+        rsync -av --exclude=.svn $orig_files/ `template_files`/
+        svn add `basename $(template_files)`/*
         info_commit="yes"
       fi
 
-      list="`ls $orig_template/$ROOT.s/ 2> /dev/null`"
+      list="`ls $orig_scripts/ 2> /dev/null`"
       if [ ! -z "$list" ]; then
         echo Copying scripts to the new template...
-        rsync -av --exclude=.svn $orig_template/$ROOT.s/ $TEMPLATE_BASE.s/
-        svn add `basename $TEMPLATE_BASE`.s/*
+        rsync -av --exclude=.svn $orig_scripts/ `template_scripts`/
+        svn add `basename $(template_scripts)`/*
         info_commit="yes"
       fi
 
     else
 
-      list="`ls $orig_template/$ROOT.d/ 2> /dev/null`"
+      list="`ls $orig_files/ 2> /dev/null`"
       if [ ! -z "$list" ]; then
         echo Copying files to the new template...
-        rsync -av $orig_template/$ROOT.d/ $TEMPLATE_BASE.d/
+        rsync -av $orig_files/ `template_files`/
       fi
 
-      list="`ls $orig_template/$ROOT.s/ 2> /dev/null`"
+      list="`ls $orig_scripts/ 2> /dev/null`"
       if [ ! -z "$list" ]; then
         echo Copying scripts to the new template...
-        rsync -av $orig_template/$ROOT.s/ $TEMPLATE_BASE.s/
+        rsync -av $orig_scripts/ `template_scripts`/
       fi
 
     fi
@@ -415,9 +429,9 @@ function template_update {
 
   done
 
-  if ! svn_check $TEMPLATE_BASE.template && [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then
+  if ! svn_check `template_packages` && [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then
     cd `dirname $TEMPLATE_BASE`
-    svn add `basedir $TEMPLATE_BASE`.template
+    svn add `basedir $(template_packages)`
   fi
 
 }
@@ -438,19 +452,19 @@ function template_add {
   jail="/$1" 
   file="$2"
 
-  if [ -a "$TEMPLATE_BASE.d/$file" ]; then
-    if [ -d "$TEMPLATE_BASE.d/$file" ]; then
+  if [ -a "`template_files`/$file" ]; then
+    if [ -d "`template_files`/$file" ]; then
 
-      echo $BASENAME: folder `slash $file` already on $TEMPLATE_BASE.d, checking for contents
+      echo $BASENAME: folder `slash $file` already on `template_files`, checking for contents
 
       cd $jail
       for candidate in `find $file`; do
-        if [ ! -a "$TEMPLATE_BASE.d/$candidate" ]; then
-          mkdir -p $TEMPLATE_BASE.d/`dirname $candidate`
-          cp -a $jail/$candidate $TEMPLATE_BASE.d/$candidate
-          if templates_under_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then
+        if [ ! -a "`template_files`/$candidate" ]; then
+          mkdir -p `template_files`/`dirname $candidate`
+          cp -a $jail/$candidate `template_files`/$candidate
+          if templates_under_svn && [ -d "`template_files`/.svn" ]; then
             cwd="`pwd`"
-            cd $TEMPLATE_BASE.d
+            cd `template_files`
             svn add ./$candidate
             if [ "$?" != "0" ]; then
               echo $BASENAME: error adding `slash $candidate` into the revision system
@@ -458,7 +472,7 @@ function template_add {
             cd $cwd
             info_commit="yes"
           else
-            echo Added `slash $jail/$candidate` on `slash $TEMPLATE_BASE.d/$candidate`
+            echo Added `slash $jail/$candidate` on `slash $(template_files)/$candidate`
           fi
         fi
       done
@@ -468,20 +482,20 @@ function template_add {
       fi
 
     else
-      echo $BASENAME: file `slash $file` already on $TEMPLATE_BASE.d
+      echo $BASENAME: file `slash $file` already on `template_files`
       exit 1
     fi
   else
 
     if [ -a "$jail/$file" ]; then
 
-      destination="`echo $TEMPLATE_BASE.d/$file | sed -e 's/\/$//'`"
+      destination="`echo `template_files`/$file | sed -e 's/\/$//'`"
 
-      if templates_under_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then
+      if templates_under_svn && [ -d "`template_files`/.svn" ]; then
 
         candidate="./`dirname $file`"
-        mkdir -p $TEMPLATE_BASE.d/$candidate
-        cd $TEMPLATE_BASE.d/$candidate
+        mkdir -p `template_files`/$candidate
+        cd `template_files`/$candidate
         while true; do
           if [ -d ".svn" ]; then
             svn add `basename $candidate`
@@ -495,7 +509,7 @@ function template_add {
         cp -a $jail/$file $destination
 
         cwd="`pwd`"
-        cd $TEMPLATE_BASE.d
+        cd `template_files`
         svn add ./$file
 
         if [ "$?" != "0" ]; then
@@ -510,7 +524,7 @@ function template_add {
 
       else
 
-        mkdir -p $TEMPLATE_BASE.d/`dirname $file`/
+        mkdir -p `template_files`/`dirname $file`/
         cp -a $jail/$file $destination
         echo Added `slash $jail/$file` on `slash $destination`
 
@@ -531,7 +545,7 @@ function check_template_exist {
 
   local components
 
-  components="template perms d s"
+  components="`template_packages` `template_perms` `template_files` `template_scripts`"
 
   if [ ! -d "`dirname $TEMPLATE_BASE`" ]; then
     echo $BASENAME: template not found
@@ -540,28 +554,28 @@ function check_template_exist {
 
   for component in $components; do
 
-    if [ ! -e "$TEMPLATE_BASE.$component" ]; then
+    if [ ! -e "$component" ]; then
 
-      echo "$BASENAME: template component not found: $TEMPLATE_BASE.$component; creating..."
+      echo "$BASENAME: template component not found: $component; creating..."
 
       cd `dirname $TEMPLATE_BASE`
 
       if [ "$component" == "perms" ] || [ "$component" == "template" ]; then
-        touch $TEMPLATE_BASE.$component
+        touch $component
       else
-        mkdir $TEMPLATE_BASE.$component
+        mkdir $component
       fi
 
       if templates_under_svn && [ -d "`dirname $TEMPLATE_BASE`/.svn" ]; then
-        svn add $TEMPLATE_BASE.$component
+        svn add $component
         info_commit="yes"
       fi
 
     elif templates_under_svn && [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && \
-         ! svn_check $TEMPLATE_BASE.$component; then
+         ! svn_check $component; then
 
       cd `dirname $TEMPLATE_BASE`
-      svn add $TEMPLATE_BASE.$component
+      svn add $component
       info_commit="yes"
 
     fi
@@ -579,18 +593,18 @@ function template_delete {
   # delete a file from a template
   # usage: template_delete <file> [jail-root]
 
-  if [ -e "$TEMPLATE_BASE.d/$1" ]; then
+  if [ -e "`template_files`/$1" ]; then
 
     # first try to remove the file from the template
-    if templates_under_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then
-      cd $TEMPLATE_BASE.d
+    if templates_under_svn && [ -d "`template_files`/.svn" ]; then
+      cd `template_files`
       svn del --force ./$1 || rm -rf ./$1
       if [ -z "$SILENT" ]; then
         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
+      rm -rf `template_files`/$1
+      echo Removed $1 from `template_files`
     fi
 
     # then, if requested, remove the file from the jail
@@ -605,22 +619,22 @@ function template_delete {
       fi
     fi
 
-  elif [ -e "$TEMPLATE_BASE.s/$1" ]; then
-    if templates_under_svn && [ -d "$TEMPLATE_BASE.s/.svn" ]; then
-      cd $TEMPLATE_BASE.s
+  elif [ -e "`template_scripts`/$1" ]; then
+    if templates_under_svn && [ -d "`template_scripts`/.svn" ]; then
+      cd `template_scripts`
       svn del --force ./$1 || rm -rf ./$1
       if [ -z "$SILENT" ]; then
         echo "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
+      rm -rf `template_scripts`/$1
+      echo Removed $1 from `template_scripts`
     fi
   else
-    if [ ! -d "$TEMPLATE_BASE.d" ]; then
-      echo $BASENAME: template folder $TEMPLATE_BASE.d not found
+    if [ ! -d "`template_files`" ]; then
+      echo $BASENAME: template folder `template_files` not found
     else
-      echo $BASENAME: file $1 not found at $TEMPLATE_BASE.d
+      echo $BASENAME: file $1 not found at `template_files`
     fi
     exit 1
   fi
@@ -722,30 +736,30 @@ function template_post_install_edit {
     echo $BASENAME: error: invalid script name $1
   fi
 
-  if [ -f "$TEMPLATE_BASE.s/$1" ]; then
-    sha1sum="`sha1sum $TEMPLATE_BASE.s/$1`"
+  if [ -f "`template_scripts`/$1" ]; then
+    sha1sum="`sha1sum $(template_scripts)/$1`"
     if [ ! -z "$EDITOR" ]; then
-      $EDITOR $TEMPLATE_BASE.s/$1
+      $EDITOR `template_scripts`/$1
     else
-      vi $TEMPLATE_BASE.s/$1
+      vi `template_scripts`/$1
     fi
-    if [ "$sha1sum" != "`sha1sum $TEMPLATE_BASE.s/$1`" ] && \
+    if [ "$sha1sum" != "`sha1sum $(template_scripts)/$1`" ] && \
        [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && [ -z "$SILENT" ]; then
       echo "Please run 'jail-commit --all' to send changes to the repository"
     fi    
   else
 
-    if [ -e "$TEMPLATE_BASE.s/$1" ]; then
+    if [ -e "`template_scripts`/$1" ]; then
 
-      echo $BASENAME: file $TEMPLATE_BASE.s/$1 not a regular file
+      echo $BASENAME: file `template_scripts`/$1 not a regular file
 
-    elif [ -d "$TEMPLATE_BASE.s" ]; then
+    elif [ -d "`template_scripts`" ]; then
 
-      touch $TEMPLATE_BASE.s/$1
-      chmod +x $TEMPLATE_BASE.s/$1
+      touch `template_scripts`/$1
+      chmod +x `template_scripts`/$1
 
-      if [ -d "$TEMPLATE_BASE.s/.svn" ]; then
-        cd $TEMPLATE_BASE.s
+      if [ -d "`template_scripts`/.svn" ]; then
+        cd `template_scripts`
         svn add $1
         if [ -z "$SILENT" ]; then
           echo "Please run 'jail-commit --all' to send the script to the repository"
@@ -755,7 +769,7 @@ function template_post_install_edit {
       echo "$BASENAME: script created; run templatepkg -p `basename $TEMPLATE_BASE` $1 again to edit it"
 
     else
-      echo $BASENAME: folder not found: $TEMPLATE_BASE.s
+      echo $BASENAME: folder not found: `template_scripts`
     fi
 
   fi
@@ -767,21 +781,21 @@ function template_edit {
   # edit a template package list
   # usage: template_edit
 
-  if [ -f "$TEMPLATE_BASE.template" ]; then
-    sha1sum="`sha1sum $TEMPLATE_BASE.template`"
+  if [ -f "`template_packages`" ]; then
+    sha1sum="`sha1sum $(template_packages)`"
     if [ ! -z "$EDITOR" ]; then
-      $EDITOR $TEMPLATE_BASE.template
+      $EDITOR `template_packages`
     else
-      vi $TEMPLATE_BASE.template
+      vi `template_packages`
     fi
-    if [ "$sha1sum" != "`sha1sum $TEMPLATE_BASE.template`" ] && \
+    if [ "$sha1sum" != "`sha1sum $(template_packages)`" ] && \
        [ -d "`dirname $TEMPLATE_BASE`/.svn" ] && [ -z "$SILENT" ]; then
       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
+  elif [ -e "`template_packages`" ]; then
+    echo $BASENAME: file `template_packages` not a regular file
   else
-    echo $BASENAME: file not found: $TEMPLATE_BASE.template
+    echo $BASENAME: file not found: `template_packages`
   fi
 
 }
@@ -812,16 +826,16 @@ function setroot {
 
 function create_doinst {
 
-  # create a doinst.sh from a template.perms file
+  # create a doinst.sh from a template perms file
   # usage: create_doinst <doinst-path>
 
   rm -f $1/doinst.sh
 
-  if [ -s "$TEMPLATE_BASE.perms" ]; then
+  if [ -s "`template_perms`" ]; then
     echo Creating doinst.sh...
-    cat $TEMPLATE_BASE.perms | while read entry; do
+    cat `template_perms` | while read entry; do
       file="`echo $entry | cut -d ";" -f 1`"
-      if [ -e "$TEMPLATE_BASE.d/$file" ]; then
+      if [ -e "`template_files`/$file" ]; then
         owner="`echo $entry | cut -d ";" -f 2`"
         group="`echo $entry | cut -d ";" -f 3`"
         perms="`echo $entry | cut -d ";" -f 4`"
@@ -842,8 +856,8 @@ function package_template {
 
   template="`basename $TEMPLATE_BASE`"
 
-  if [ ! -d "$TEMPLATE_BASE.d" ]; then
-    $BASENAME: folder not found: $TEMPLATE.base.d
+  if [ ! -d "`template_files`" ]; then
+    $BASENAME: folder not found: `template_files`
     return 1
   fi
 
@@ -871,7 +885,7 @@ function package_template {
   rm -rf $TMP/templatepkg
   mkdir -p $TMP/templatepkg
 
-  rsync -av --exclude=.svn $TEMPLATE_BASE.d/ $TMP/templatepkg/
+  rsync -av --exclude=.svn `template_files`/ $TMP/templatepkg/
   mkdir $TMP/templatepkg/install
   create_doinst $TMP/templatepkg/install
 
@@ -900,7 +914,7 @@ if [ ! -z "$2" ]; then
   search_template $2 --new
 fi
 
-TEMPLATE="$TEMPLATE_BASE.template"
+TEMPLATE="`template_packages`"
 
 if [ "$1" == "-u" ] || [ "$1" == "--update" ]; then