diff --git a/CHANGES.txt b/CHANGES.txt
index b25752d6d773c5dd704a84e9164d3d2191f850b6..3b1c4a43d1489a7e29cfc57f784a538ec9b45341 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,12 +1,62 @@
 Changes
 =======
 
-0.32 (Unreleased)
+0.39 (unreleased)
 -----------------
 
-  * No change yet.
+ * No changes yet.
 
-0.31 (2011-10-06)
+0.38 (2011-12-05)
+-----------------
+
+ * erp5: Swtich to percona, as maatkit is obsoleted. [Sebastien Robin]
+ * erp5: Improve haproxy configuration. [Sebastien Robin]
+ * erp5: Support sphinxd. [Kazuhiko Shiozaki]
+ * erp5: Improve and make logging more usual. [Sebastien Robin]
+ * erp5: Allow mysql connection from localhost. [Romain Courteaud]
+ * erp5: Allow to control Zope/Zeo cache [Arnaud Fontaine]
+ * erp5: Increase precision in logs [Julien Muchembled]
+ * erp5: Improve erp5 update [Arnaud Fontaine, Rafael Monnerat]
+
+0.37 (2011-11-24)
+-----------------
+
+ * KVM : allow access to several KVM instances without SSL certificate duplicate
+   problem. [Cedric de Saint Martin]
+
+0.36 (2011-11-16)
+-----------------
+
+ * erp5testnode : the code of testnode is not in slapos repository anymore
+
+0.35 (2011-11-10)
+-----------------
+
+ * KVM : Promise are now working properly. [艁ukasz Nowak]
+ * KVM : Use NoVNC with automatic login. [Cedric de Saint Martin]
+ * KVM : Use websockify egg and remove numpy hack. [Cedric de Saint Martin]
+
+0.34 (2011-11-08)
+-----------------
+
+  * Any LAMP software can specify its own php.ini [Alain Takoudjou]
+  * LAMP : Fix bug where buildout does not has sufficient rights to update
+    application parts. [Alain Takoudjou]
+  * LAMP : Update formatting when returning list of renamed files.
+    [Alain Takoudjou]
+
+0.33 (2011-10-31)
+-----------------
+
+  * erp5 : use percona toolkit instead of maatkit [Sebastien Robin]
+
+0.32 (2011-10-28)
+-----------------
+
+  * LAMP : Recipe can now call lampconfigure from slapos.toolbox which will 
+   configure PHP application instance when needed. [Alain Takoudjou Kamdem]
+
+0.31 (2011-10-16)
 -----------------
 
  * Split big redundant recipes into small ones. In order to factorize the code
diff --git a/MANIFEST.in b/MANIFEST.in
index af62e6e688d64d3603711db1d2e1ce807427b484..b539622c6ba87c997b61b624d0c9e8b6745785ad 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,5 @@
 include CHANGES.txt
-include slapos/recipe/erp5/template/site.zcml
+include slapos/recipe/generic_zope/template/site.zcml
 recursive-include slapos/recipe *.in
 recursive-include slapos/recipe *.bin
 recursive-include slapos/recipe README.*.txt
diff --git a/component/apache/buildout.cfg b/component/apache/buildout.cfg
index 335e87046b48c54b261a22ab808b6a07cf8f1c3a..42d1c7162ba8b1965e77a6ba9a1ba43bc045771f 100644
--- a/component/apache/buildout.cfg
+++ b/component/apache/buildout.cfg
@@ -13,61 +13,23 @@ extends =
   ../sqlite3/buildout.cfg
   ../zlib/buildout.cfg
 
-[apache-no-ssl]
-# inspired on http://old.aclark.net/team/aclark/blog/a-lamp-buildout-for-wordpress-and-other-php-apps/
-recipe = hexagonit.recipe.cmmi
-url = http://mir2.ovh.net/ftp.apache.org/dist//httpd/httpd-2.2.21.tar.bz2
-md5sum = 1696ae62cd879ab1d4dd9ff021a470f2
-configure-options = --enable-authn-alias
-                    --enable-bucketeer
-                    --enable-cache
-                    --enable-case-filter
-                    --enable-case-filter-in
-                    --enable-cgid
-                    --enable-charset-lite
-                    --enable-disk-cache
-                    --enable-echo
-                    --enable-exception-hook
-                    --enable-mods-shared=all
-                    --enable-optional-fn-export
-                    --enable-optional-fn-import
-                    --enable-optional-hook-export
-                    --enable-optional-hook-import
-                    --enable-proxy
-                    --enable-proxy-ajp
-                    --enable-proxy-balancer
-                    --enable-proxy-connect
-                    --enable-proxy-ftp
-                    --enable-proxy-http
-                    --enable-proxy-scgi
-                    --enable-so
-                    --enable-dav
-                    --enable-dav-fs
-                    --disable-ssl
-                    --with-included-apr
-                    --with-z=${zlib:location}
-                    --with-expat=${libexpat:location}
-                    --with-pcre=${pcre:location}
-                    --with-sqlite3=${sqlite3:location}
-                    --with-gdbm=${gdbm:location}
-                    --without-ssl
-                    --without-lber
-                    --without-ldap
-                    --without-ndbm
-                    --without-berkeley-db
-                    --without-pgsql
-                    --without-mysql
-                    --without-sqlite2
-                    --without-oracle
-                    --without-freedts
-                    --without-odbc
-                    --without-iconv
+[apache-CVE-2011-3368.patch]
+recipe = hexagonit.recipe.download
+md5sum = 1ad598213480ddfc239ce6359b7b2c0b
+url = http://www.apache.org/dist/httpd/patches/apply_to_2.2.21/CVE-2011-3368.patch
+filename = ${:_buildout_section_name_}
+download-only = true
 
 [apache]
 # inspired on http://old.aclark.net/team/aclark/blog/a-lamp-buildout-for-wordpress-and-other-php-apps/
 recipe = hexagonit.recipe.cmmi
+depends =
+  ${gdbm:version}
 url = http://mir2.ovh.net/ftp.apache.org/dist//httpd/httpd-2.2.21.tar.bz2
 md5sum = 1696ae62cd879ab1d4dd9ff021a470f2
+patches =
+  ${apache-CVE-2011-3368.patch:location}/${apache-CVE-2011-3368.patch:filename}
+patch-options = -p1
 configure-options = --disable-static
                     --enable-authn-alias
                     --enable-bucketeer
diff --git a/component/cclient/buildout.cfg b/component/cclient/buildout.cfg
index a8095323436aa2915cd2536a3f0dcd3689149a9b..df52123e66d09c884560efcdd8a8cbec5427c268 100644
--- a/component/cclient/buildout.cfg
+++ b/component/cclient/buildout.cfg
@@ -12,16 +12,15 @@ parts =
 [cclient-patch]
 recipe = slapos.recipe.download
 url = ${:_profile_base_location_}/imap-2007f.patch
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
+md5sum = 42c77fdd5d7a976fc302b93aadb3da98
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
 filename = imap-2007f.patch
 
 [cclient]
 recipe = hexagonit.recipe.cmmi
 url = ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz
+md5sum = 2126fd125ea26b73b20f01fcd5940369
 configure-command = true
-keep-compile-dir = true
 # cclient does not support parallel compilation
 make-options = 
   slx
diff --git a/component/cclient/imap-2007f.patch b/component/cclient/imap-2007f.patch
index 50b64970cdb305698f305ab9bf83a9741b66023c..7460b9232a1bde1c98ec32ca394ab91d97eb9c51 100644
--- a/component/cclient/imap-2007f.patch
+++ b/component/cclient/imap-2007f.patch
@@ -1,6 +1,19 @@
 --- old/Makefile	2011-09-22 13:19:53.000000000 +0100
-+++ new/Makefile	2011-09-23 11:29:12.405271442 +0100
-@@ -580,7 +580,6 @@
++++ new/Makefile	2011-11-09 15:02:54.038306922 +0100
+@@ -280,7 +280,11 @@
+ SYSTEM=unix
+ TOOLS=tools
+ TOUCH=touch
+-
++IMAPDIR=$(CCLIENT)/cclient
++COMPILEDIR = $(CCLIENT)/cclient__compile__/imap-2007f
++CP=cp -r
++INSTALL=install
++FOR=for
+ 
+ # Primary build command
+ 
+@@ -580,7 +584,6 @@
  	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  	@echo
  	@echo Do you want to continue this build anyway?  Type y or n please:
@@ -8,7 +21,7 @@
  
  nounenc:
  	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-@@ -639,7 +638,7 @@
+@@ -639,7 +642,7 @@
  	@echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  	@echo
  	@echo Do you want to build with IPv6 anyway?  Type y or n please:
@@ -17,15 +30,27 @@
  	@echo OK, I will remember that you really want to build with IPv6.
  	@echo You will not see this message again.
  	@$(TOUCH) ip6
-@@ -731,6 +730,12 @@
+@@ -731,6 +734,24 @@
  	$(SH) -c '$(RM) an ua OSTYPE SPECIALS c-client mtest imapd ipopd mailutil mlock dmail tmail || true'
  	$(CD) tools;$(MAKE) clean
  
-+install:
-+	install -v -d $(CCLIENT)/cclient/include
-+	ln -svf $(CCLIENT)/cclient__compile__/imap-2007f/c-client $(CCLIENT)/cclient/include
-+	install -v -d $(CCLIENT)/cclient/lib
-+	ln -svf $(CCLIENT)/cclient__compile__/imap-2007f/c-client/c-client.a $(CCLIENT)/cclient/lib/libc-client.a
++install:	
++	$(INSTALL) -v -d $(IMAPDIR)/include
++	$(INSTALL) -v -d $(IMAPDIR)/lib
++	$(INSTALL) -v -m 644 $(COMPILEDIR)/c-client/*.h $(IMAPDIR)/include
++	$(INSTALL) -v -m 644 $(COMPILEDIR)/c-client/c-client.a $(IMAPDIR)/lib
++	$(CP) $(COMPILEDIR)/ipopd $(COMPILEDIR)/mailutil $(COMPILEDIR)/imapd \
++	$(COMPILEDIR)/dmail $(COMPILEDIR)/mlock $(COMPILEDIR)/mtest $(COMPILEDIR)/tmail $(IMAPDIR)
++	$(RM) $(IMAPDIR)/ipopd/*.h $(IMAPDIR)/ipopd/*.c $(IMAPDIR)/ipopd/Makefile;
++	$(RM) $(IMAPDIR)/mailutil/*.h $(IMAPDIR)/mailutil/*.c $(IMAPDIR)/mailutil/Makefile;
++	$(RM) $(IMAPDIR)/imapd/*.h $(IMAPDIR)/imapd/*.c $(IMAPDIR)/imapd/Makefile;
++	$(RM) $(IMAPDIR)/tmail/*.h $(IMAPDIR)/tmail/*.c $(IMAPDIR)/tmail/Makefile;
++	$(RM) $(IMAPDIR)/mlock/*.h $(IMAPDIR)/mlock/*.c $(IMAPDIR)/mlock/Makefile;
++	$(RM) $(IMAPDIR)/mtest/*.h $(IMAPDIR)/mtest/*.c $(IMAPDIR)/mtest/Makefile;
++	$(RM) $(IMAPDIR)/dmail/*.h $(IMAPDIR)/dmail/*.c $(IMAPDIR)/dmail/Makefile;
++	$(INSTALL) -v -m 644 $(COMPILEDIR)/ip6 $(IMAPDIR)
++	$(INSTALL) -v -m 644 $(COMPILEDIR)/OSTYPE $(IMAPDIR)
++	$(INSTALL) -v -m 644 $(COMPILEDIR)/SPECIALS $(IMAPDIR)
 +
  
  # A monument to a hack of long ago and far away...
diff --git a/component/fonts/buildout.cfg b/component/fonts/buildout.cfg
index 0a8a59c527feb748bb15d7ffb0631bc4d4d4ef67..a148657775cfe81feb8ffce88d170944d60df17e 100644
--- a/component/fonts/buildout.cfg
+++ b/component/fonts/buildout.cfg
@@ -2,6 +2,7 @@
 parts =
   liberation-fonts
   ipaex-fonts
+  ipa-fonts
 
 [fonts]
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
@@ -16,7 +17,7 @@ url = https://fedorahosted.org/releases/l/i/liberation-fonts/liberation-fonts-tt
 md5sum = 8150db1c6e27cacdfd524b563b85b69e
 destination = ${fonts:location}/${:_buildout_section_name_}
 
-# IPAex Font - Japanese fonts provided by IPA
+# IPAex and IPA Font - Japanese fonts provided by IPA
 # http://ossipedia.ipa.go.jp/ipafont/index.html
 [ipaex-fonts]
 recipe = hexagonit.recipe.download
@@ -24,3 +25,10 @@ strip-top-level-dir = true
 url = http://info.openlab.ipa.go.jp/ipafont/fontdata/IPAexfont00103.zip
 md5sum = ac67b2fc3aab7f683d89f0070df284e7
 destination = ${fonts:location}/${:_buildout_section_name_}
+
+[ipa-fonts]
+recipe = hexagonit.recipe.download
+strip-top-level-dir = true
+url = http://info.openlab.ipa.go.jp/ipafont/fontdata/IPAfont00303.zip
+md5sum = 39a828acf27790adbe4944dfb4d94bb1
+destination = ${fonts:location}/${:_buildout_section_name_}
diff --git a/component/freetype/buildout.cfg b/component/freetype/buildout.cfg
index 2ca184fa05b9b4145983a94c44f7e31210a82fb5..c358b3e996713b4d215af71d95eb238c3b9a318e 100644
--- a/component/freetype/buildout.cfg
+++ b/component/freetype/buildout.cfg
@@ -10,8 +10,8 @@ parts =
 
 [freetype]
 recipe = hexagonit.recipe.cmmi
-url = http://download.savannah.gnu.org/releases/freetype/freetype-2.4.6.tar.bz2
-md5sum = 5e6510613f612809d2d7862592b92ab7
+url = http://download.savannah.gnu.org/releases/freetype/freetype-2.4.8.tar.bz2
+md5sum = dbf2caca1d3afd410a29217a9809d397
 configure-options =
   --disable-static
 environment =
diff --git a/component/gcc/buildout.cfg b/component/gcc/buildout.cfg
index c53dcaca85da1caca4b2553c588828658f9210a2..86cde9fdb07ef242de88bc530413aa57f771a58a 100644
--- a/component/gcc/buildout.cfg
+++ b/component/gcc/buildout.cfg
@@ -3,26 +3,12 @@
 [buildout]
 extends =
   ../m4/buildout.cfg
+  ../gmp/buildout.cfg
   ../zip/buildout.cfg
 
 parts =
   gcc
 
-[gmp]
-recipe = hexagonit.recipe.cmmi
-# we should use version 4.x for ppl-0.10
-url = ftp://ftp.gmplib.org/pub/gmp-4.3.2/gmp-4.3.2.tar.bz2
-md5sum = dd60683d7057917e34630b4a787932e8
-# GMP does not correctly detect achitecture so it have to be given
-# as hexagonit.recipe.cmmi is using shell expansion in subproceses
-# backticks are working
-configure-options =
-  --build=`uname -m`-linux
-  --enable-cxx
-  --disable-static
-environment =
-  PATH=${m4:location}/bin:%(PATH)s
-
 [mpfr]
 recipe = hexagonit.recipe.cmmi
 url = http://www.mpfr.org/mpfr-3.0.1/mpfr-3.0.1.tar.bz2
diff --git a/component/gdbm/buildout.cfg b/component/gdbm/buildout.cfg
index c97171d9b97a8444d0d9ebd7a034f7e2fbb03ee6..d8d9105cd5f88e4bcb108f78b713d1f0e8c0b1a3 100644
--- a/component/gdbm/buildout.cfg
+++ b/component/gdbm/buildout.cfg
@@ -2,25 +2,18 @@
 parts =
   gdbm
 
-[gdbm-nochange-patch-download]
-recipe = hexagonit.recipe.download
-url = ${:_profile_base_location_}/${:filename}
-md5sum = fafa6cae0afbf2b5afb9ef3b8e3035a4
-download-only = true
-filename = gdbm-Makefile.in-nochange.patch
-
 [gdbm]
 recipe = hexagonit.recipe.cmmi
-url = ftp://ftp.gnu.org/gnu/gdbm/gdbm-1.8.3.tar.gz
-md5sum = 1d1b1d5c0245b1c00aff92da751e9aa1
-patches = ${gdbm-nochange-patch-download:location}/${gdbm-nochange-patch-download:filename}
+version = 1.10
+url = ftp://ftp.gnu.org/gnu/gdbm/gdbm-${:version}.tar.gz
+md5sum = 88770493c2559dc80b561293e39d3570
 configure-options =
   --disable-static
 # install as parts/gdbm/include/gdbm/*.h etc. because some softwares
 # (eg. python's dbmmodule.c extension) assume the location like this.
 includedir = ${buildout:parts-directory}/${:_buildout_section_name_}/include
 make-targets =
-  install install-compat includedir=${:includedir}/gdbm && rm -f ${:includedir}/*.h && ln -sf gdbm/gdbm.h ${:includedir}/gdbm.h
+  install includedir=${:includedir}/gdbm && rm -f ${:includedir}/*.h && ln -sf gdbm/gdbm.h ${:includedir}/gdbm.h
 # it seems that parallel build sometimes fails for gdbm.
 make-options =
   -j1
diff --git a/component/ghostscript/buildout.cfg b/component/ghostscript/buildout.cfg
index 90f4b639a6e3810106d3221e81b10eb61b2eadf7..85ff413060e3c14faf7a6ee981e0e5de3577f03a 100644
--- a/component/ghostscript/buildout.cfg
+++ b/component/ghostscript/buildout.cfg
@@ -7,16 +7,8 @@ extends =
 
 parts = ghostscript
 
-[ghostscript-hooks-download]
-recipe = hexagonit.recipe.download
-url = ${:_profile_base_location_}/${:filename}
-filename = ghostscript-hooks.py
-md5sum = 731475648c91507bd1dfe2a61ee84552
-download-only = true
-
 [ghostscript-common]
 recipe = hexagonit.recipe.cmmi
-pre-configure-hook = ${ghostscript-hooks-download:location}/${ghostscript-hooks-download:filename}:pre_configure_hook
 configure-options =
   --disable-cups
   --disable-cairo
@@ -32,17 +24,9 @@ environment =
   LD_LIBRARY_PATH=${fontconfig:location}/lib
 
 [ghostscript]
-# we prefer ghostscript-8 for now, because ghostscript-9.00 seems to have a
-# problem with Japanese fonts if -dTextAlphaBits=4 is specified by
-# imagemagick.
-<= ghostscript-8
+<= ghostscript-9
 
 [ghostscript-9]
 <= ghostscript-common
-url = http://ghostscript.com/releases/ghostscript-9.00.tar.gz
-md5sum = a402462478b4cdda3e1816899227b845
-
-[ghostscript-8]
-<= ghostscript-common
-url = http://www.nexedi.org/static/tarballs/ghostscript/ghostscript-8.71-no-looping-symlink.tar.bz2
-md5sum = 34639af3ffe8594f2c5ea944dfbe1d78
+url = http://downloads.ghostscript.com/public/ghostscript-9.04.tar.bz2
+md5sum = 9f6899e821ab6d78ab2c856f10fa3023
diff --git a/component/ghostscript/ghostscript-hooks.py b/component/ghostscript/ghostscript-hooks.py
deleted file mode 100644
index c39936894def08a085a2928ca03995464899e351..0000000000000000000000000000000000000000
--- a/component/ghostscript/ghostscript-hooks.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import os
-def pre_configure_hook(oprtions, buildout):
-  # fixes python bug related to not creating symlink contained in tarfiles
-  for missing in 'configure.ac', 'Makefile.in':
-    if not os.path.exists(os.path.join(os.path.curdir, missing)):
-      os.symlink(os.path.join(os.path.curdir, 'base', missing),
-          os.path.join(os.path.curdir, missing))
diff --git a/component/git/buildout.cfg b/component/git/buildout.cfg
index 9ff6bc1e69df7d302cd9b69298f1c36264f03874..bd82432e50ecc4990041cb24b88316ac0b3077df 100644
--- a/component/git/buildout.cfg
+++ b/component/git/buildout.cfg
@@ -15,8 +15,8 @@ parts =
 recipe = hexagonit.recipe.cmmi
 # url = http://kernel.org/pub/software/scm/git/git-1.7.4.5.tar.bz2
 # Circumvent kernel.org downtime
-url = http://ftp.free.fr/mirrors/ftp.kernel.org/software/scm/git/git-1.7.4.5.tar.bz2
-md5sum = 2fa6c4c847ed87523cf55de54af457eb
+url = http://git-core.googlecode.com/files/git-1.7.8.tar.gz
+md5sum = 4a3c03a04dbb857ecc875dae1278b76e
 configure-options =
   --with-curl=${curl:location}
   --with-openssl=${openssl:location}
diff --git a/component/gmp/buildout.cfg b/component/gmp/buildout.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..b47bfc8b155963d9fe9fa7e51c73eca1d1eec12f
--- /dev/null
+++ b/component/gmp/buildout.cfg
@@ -0,0 +1,23 @@
+[buildout]
+extends =
+  ../m4/buildout.cfg
+
+parts =
+  gmp
+
+[gmp]
+recipe = hexagonit.recipe.cmmi
+# we should use version 4.x for ppl-0.10
+url = ftp://ftp.gmplib.org/pub/gmp-4.3.2/gmp-4.3.2.tar.bz2
+md5sum = dd60683d7057917e34630b4a787932e8
+# GMP does not correctly detect achitecture so it have to be given
+# as hexagonit.recipe.cmmi is using shell expansion in subproceses
+# backticks are working
+configure-options =
+  --build=`uname -m`-linux
+  --enable-cxx
+  --disable-static
+environment =
+  PATH=${m4:location}/bin:%(PATH)s
+
+
diff --git a/component/gnutls/buildout.cfg b/component/gnutls/buildout.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..4bb35dd949bbca6932c0385928880cca3f4998e3
--- /dev/null
+++ b/component/gnutls/buildout.cfg
@@ -0,0 +1,34 @@
+[buildout]
+extends = 
+  ../readline/buildout.cfg
+  ../ncurses/buildout.cfg
+  ../zlib/buildout.cfg
+
+parts = gnutls
+
+[gpg-error]
+recipe = hexagonit.recipe.cmmi
+url = ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.10.tar.gz
+md5sum = 7c2710ef439f82ac429b88fec88e9a4c
+
+[gcrypt]
+recipe = hexagonit.recipe.cmmi
+url = ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.4.6.tar.gz
+md5sum = bfd45922eefb8a24d598af77366220d4
+configure-options =
+  --with-gpg-error-prefix=${gpg-error:location}
+environment =
+  CPPFLAGS=-I${gpg-error:location}/include
+  LDFLAGS=-Wl,-rpath -Wl,${gpg-error:location}/lib -Wl,${gpg-error:location}/lib/libgpg-error.so.0
+
+[gnutls]
+# XXX-Cedric : update to latest gnutls
+recipe = hexagonit.recipe.cmmi
+url = ftp://ftp.gnupg.org/gcrypt/gnutls/gnutls-2.8.6.tar.bz2
+md5sum = eb0a6d7d3cb9ac684d971c14f9f6d3ba
+configure-options =
+  --with-libgcrypt-prefix=${gcrypt:location}
+environment =
+  CPPFLAGS=-I${zlib:location}/include -I${readline:location}/include -I${ncurses:location}/include -I${ncurses:location}/include/ncursesw -I${gcrypt:location}/include -I${gpg-error:location}/include
+  LDFLAGS=-L${readline:location}/lib -L${ncurses:location}/lib -L${gcrypt:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -Wl,-rpath -Wl,${readline:location}/lib -Wl,-rpath -Wl,${ncurses:location}/lib -Wl,-rpath -Wl,${gcrypt:location}/lib -Wl,-rpath -Wl,${gpg-error:location}/lib -Wl,${gcrypt:location}/lib/libgcrypt.so.11
+  PKG_CONFIG=${zlib:location}/lib/pkgconfig
diff --git a/component/grep/buildout.cfg b/component/grep/buildout.cfg
index 589bb6cb490c4ba6dc5bf3742f91c4dc111b946b..231f7bca91a66dcc064f6b65318594a36bae8a2a 100644
--- a/component/grep/buildout.cfg
+++ b/component/grep/buildout.cfg
@@ -6,8 +6,8 @@ parts =
 
 [grep]
 recipe = hexagonit.recipe.cmmi
-url = http://ftp.gnu.org/gnu/grep/grep-2.8.tar.gz
-md5sum = cb2dfc502c5afc7a4a6e5f6cefd6850e
+url = http://ftp.gnu.org/gnu/grep/grep-2.9.tar.gz
+md5sum = 03e3451a38b0d615cb113cbeaf252dc0
 environment =
-  PKG_CONFIG_PATH=${pcre:location}/lib/pkgconfig
-  LDFLAGS =-Wl,--as-needed -Wl,-rpath=${pcre:location}/lib
+  CPPFLAGS=-I${pcre:location}/include
+  LDFLAGS=-L${pcre:location}/lib -Wl,-rpath=${pcre:location}/lib
diff --git a/component/groonga/buildout.cfg b/component/groonga/buildout.cfg
index 45608460ecf6affa1aa6219d7bc1be05539cf9a7..08b9496025940cd60cd506f5467116ba8bfb5568 100644
--- a/component/groonga/buildout.cfg
+++ b/component/groonga/buildout.cfg
@@ -3,14 +3,41 @@
 # http://groonga.org/
 
 [buildout]
+extends =
+  ../autoconf/buildout.cfg
+  ../automake/buildout.cfg
+  ../glib/buildout.cfg
+  ../libtool/buildout.cfg
+  ../pkgconfig/buildout.cfg
 parts =
   groonga
 
+[groonga-1.2.8-configure-Wno-cflags-patch]
+recipe = hexagonit.recipe.download
+url = ${:_profile_base_location_}/${:filename}
+md5sum = b48ac46c7de0ed4c0e632e06118b8a58
+filename = groonga-1.2.8-configure-Wno-cflags.patch
+download-only = true
+
 [groonga]
 recipe = hexagonit.recipe.cmmi
-url = http://packages.groonga.org/source/groonga/groonga-1.2.5.tar.gz
-md5sum = 7e608406677b7a3f91e287acc0c718c0
+url = http://packages.groonga.org/source/groonga/groonga-1.2.8.tar.gz
+md5sum = a319b1f3a55cbf250ef5255f5c51ff46
+patch-options = -p0
+patches =
+  ${groonga-1.2.8-configure-Wno-cflags-patch:location}/${groonga-1.2.8-configure-Wno-cflags-patch:filename}
+environment =
+  PATH =${autoconf:location}/bin:${automake-1.11:location}/bin:${libtool:location}/bin:%(PATH)s
+configure-command =
+  aclocal -I ${glib:location}/share/aclocal -I ${libtool:location}/share/aclocal -I ${pkgconfig:location}/share/aclocal -I .
+  libtoolize -c -f
+  autoheader
+  automake -c -a -f
+  autoconf
+  ./configure
 configure-options =
+  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
   --disable-static
   --disable-glibtest
+  --disable-benchmark
   --without-mecab
diff --git a/component/groonga/groonga-1.2.8-configure-Wno-cflags.patch b/component/groonga/groonga-1.2.8-configure-Wno-cflags.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4d479850093023f3daaa6de303b7d1912124217a
--- /dev/null
+++ b/component/groonga/groonga-1.2.8-configure-Wno-cflags.patch
@@ -0,0 +1,26 @@
+--- configure.ac.orig	2011-12-06 12:54:26.812408976 +0900
++++ configure.ac	2011-12-06 13:17:39.060465045 +0900
+@@ -70,9 +70,10 @@
+           m4_pattern_allow(PKG_CONFIG_LIBDIR)])
+ 
+ AC_DEFUN([CHECK_CFLAG], [
++  cflag=$(echo "$1" | sed -e 's,^-Wno-,-W,')
+   AC_MSG_CHECKING([if gcc supports $1])
+   old_CFLAGS=$CFLAGS
+-  CFLAGS="$CFLAGS $1 -Werror"
++  CFLAGS="$CFLAGS $cflag -Werror"
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+     [check_cflag=yes],
+     [check_cflag=no])
+@@ -84,9 +85,10 @@
+ ])
+ 
+ AC_DEFUN([CHECK_CXXFLAG], [
++  cxxflag=$(echo "$1" | sed -e 's,^-Wno-,-W,')
+   AC_MSG_CHECKING([if g++ supports $1])
+   old_CXXFLAGS=$CXXFLAGS
+-  CXXFLAGS="$CXXFLAGS $1 -Werror"
++  CXXFLAGS="$CXXFLAGS $cxxflag -Werror"
+   AC_LANG_PUSH([C++])
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+     [check_cxxflag=yes],
diff --git a/component/handlersocket/HandlerSocket-Plugin-for-MySQL-1.0.6-mariadb.patch b/component/handlersocket/HandlerSocket-Plugin-for-MySQL-1.0.6-mariadb.patch
deleted file mode 100644
index a3d817294cb2d09d989283e34efaf000fcde6bf0..0000000000000000000000000000000000000000
--- a/component/handlersocket/HandlerSocket-Plugin-for-MySQL-1.0.6-mariadb.patch
+++ /dev/null
@@ -1,37 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -28,7 +28,7 @@
-         MYSQL_INC="$MYSQL_INC -I$ac_mysql_source_dir/regex"
-         MYSQL_INC="$MYSQL_INC -I$ac_mysql_source_dir"
-         AC_SUBST(MYSQL_INC)
--        MYSQL_SOURCE_VERSION=`cat $ac_mysql_source_dir/configure.in | grep "\[[MySQL Server\]]" | sed -e "s|.*\([[0-9]]\+\.[[0-9]]\+\.[[0-9]]\+[[0-9a-zA-Z\_\-]]*\).*|\1|"`
-+        MYSQL_SOURCE_VERSION=`cat $ac_mysql_source_dir/configure.in | grep "\[[MariaDB Server\]]" | sed -e "s|.*\([[0-9]]\+\.[[0-9]]\+\.[[0-9]]\+[[0-9a-zA-Z\_\-]]*\).*|\1|"`
-         AC_MSG_RESULT([yes: Using $ac_mysql_source_dir, version $MYSQL_SOURCE_VERSION])
-       else
-         AC_MSG_ERROR([invalid MySQL source directory: $ac_mysql_source_dir])
---- a/handlersocket/database.cpp
-+++ b/handlersocket/database.cpp
-@@ -686,19 +686,19 @@
-   for (uint32_t i = 0; i < limit + skip; ++i) {
-     if (i == 0) {
-       const key_part_map kpm = (1U << args.kvalslen) - 1;
--      r = hnd->index_read_map(table->record[0], key_buf, kpm, find_flag);
-+      r = hnd->ha_index_read_map(table->record[0], key_buf, kpm, find_flag);
-     } else {
-       switch (find_flag) {
-       case HA_READ_BEFORE_KEY:
-       case HA_READ_KEY_OR_PREV:
--	r = hnd->index_prev(table->record[0]);
-+	r = hnd->ha_index_prev(table->record[0]);
- 	break;
-       case HA_READ_AFTER_KEY:
-       case HA_READ_KEY_OR_NEXT:
--	r = hnd->index_next(table->record[0]);
-+	r = hnd->ha_index_next(table->record[0]);
- 	break;
-       case HA_READ_KEY_EXACT:
--	r = hnd->index_next_same(table->record[0], key_buf, kplen_sum);
-+	r = hnd->ha_index_next_same(table->record[0], key_buf, kplen_sum);
- 	break;
-       default:
- 	r = HA_ERR_END_OF_FILE; /* to finish the loop */
diff --git a/component/handlersocket/buildout.cfg b/component/handlersocket/buildout.cfg
deleted file mode 100644
index 72a260caa78c202aad98ec3bc8e95fb6f018ad97..0000000000000000000000000000000000000000
--- a/component/handlersocket/buildout.cfg
+++ /dev/null
@@ -1,36 +0,0 @@
-# Handlersocket - a NoSQL plugin for MySQL.
-# http://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL
-
-[buildout]
-extends =
-  ../autoconf/buildout.cfg
-  ../automake/buildout.cfg
-  ../libtool/buildout.cfg
-  ../mariadb/buildout.cfg
-
-parts =
-  handlersocket
-
-[handlersocket-mariadb-patch]
-recipe = hexagonit.recipe.download
-url = ${:_profile_base_location_}/${:filename}
-md5sum = 2654feea2e867c898b741ac0f0aa8e14
-filename = HandlerSocket-Plugin-for-MySQL-1.0.6-mariadb.patch
-download-only = true
-
-[handlersocket]
-recipe = hexagonit.recipe.cmmi
-url = http://github.com/ahiguti/HandlerSocket-Plugin-for-MySQL/tarball/1.0.6
-md5sum = 57f5c131e3d29701b01dd92c35ed25fd
-patch-options = -p1
-patches =
-  ${handlersocket-mariadb-patch:location}/${handlersocket-mariadb-patch:filename}
-configure-command =
-  ACLOCAL_ARGS=-I${libtool:location}/share/aclocal ./autogen.sh && ./configure
-configure-options =
-  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
-  --with-mysql-source=${mariadb:location}__compile__/mariadb-${mariadb:version}
-  --with-mysql-bindir=${mariadb:location}/bin
-  --with-mysql-plugindir=${mariadb:location}/lib/mysql/plugin
-environment =
-  PATH =${autoconf:location}/bin:${automake-1.11:location}/bin:${libtool:location}/bin:%(PATH)s
diff --git a/component/imagemagick/buildout.cfg b/component/imagemagick/buildout.cfg
index 216d2389dfdef7b923e854a9be3f5d5b0559e491..062a81e90d94cd3d17068115be38c321ff9cfbd1 100644
--- a/component/imagemagick/buildout.cfg
+++ b/component/imagemagick/buildout.cfg
@@ -25,18 +25,10 @@ md5sum = 3f28ecd9f6722cf2c3238ce6ec3d7a68
 download-only = true
 filename = imagemagick-6.6.6-1-no-gsx-gsc-probe.patch
 
-[imagemagick-6.6.7-4-without-lzma.patch]
-recipe = hexagonit.recipe.download
-url = ${:_profile_base_location_}/${:filename}
-path = ${:filename}
-md5sum = 04e1b934a58f4b3a83e4df148795b338
-download-only = true
-filename = imagemagick-6.6.7-4-without-lzma.patch
-
 [imagemagick]
 recipe = hexagonit.recipe.cmmi
-url = ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.7.2-10.tar.bz2
-md5sum = 073ec5d7f2a22db96a0e87e4322b75f9
+url = ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.7.3-10.tar.bz2
+md5sum = 3c1d1a04b1ed2998217e16001b58069f
 configure-options =
   --disable-static
   --without-x
@@ -55,6 +47,7 @@ configure-options =
   --without-lqr
   --without-lzma
   --without-openexr
+  --without-pango
   --without-rsvg
   --without-wmf
   --without-xml
@@ -66,7 +59,6 @@ configure-options =
 patch-options = -p1
 patches =
   ${imagemagick-6.6.6-1-no-gsx-gsc-probe.patch:location}/${imagemagick-6.6.6-1-no-gsx-gsc-probe.patch:filename}
-  ${imagemagick-6.6.7-4-without-lzma.patch:location}/${imagemagick-6.6.7-4-without-lzma.patch:filename}
 environment =
   PATH=${freetype:location}/bin:${ghostscript:location}/bin:${pkgconfig:location}/bin:%(PATH)s
   PKG_CONFIG_PATH=${fontconfig:location}/lib/pkgconfig
diff --git a/component/imagemagick/imagemagick-6.6.7-4-without-lzma.patch b/component/imagemagick/imagemagick-6.6.7-4-without-lzma.patch
deleted file mode 100644
index c7771036809448f6a814ccd59804f6d2d1a0d571..0000000000000000000000000000000000000000
--- a/component/imagemagick/imagemagick-6.6.7-4-without-lzma.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- ImageMagick-6.6.7-4/configure~	2011-02-10 11:50:21.704561096 +0100
-+++ ImageMagick-6.6.7-4/configure	2011-02-10 12:23:45.612561097 +0100
-@@ -28251,7 +28251,7 @@
- #
- have_lzma='no'
- LZMA_LIBS=''
--if test "$with_lzma" != 'no' || test "$with_tiff" != 'no'; then
-+if test "$with_lzma" != 'no'; then
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: -------------------------------------------------------------" >&5
- $as_echo "-------------------------------------------------------------" >&6; }
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LZMA" >&5
---- ImageMagick-6.6.7-4/configure.ac~	2011-02-10 11:50:21.693561096 +0100
-+++ ImageMagick-6.6.7-4/configure.ac	2011-02-10 12:23:40.013561098 +0100
-@@ -2290,7 +2290,7 @@
- #
- have_lzma='no'
- LZMA_LIBS=''
--if test "$with_lzma" != 'no' || test "$with_tiff" != 'no'; then
-+if test "$with_lzma" != 'no'; then
-     AC_MSG_RESULT([-------------------------------------------------------------])
-   AC_MSG_CHECKING(for LZMA)
-   AC_MSG_RESULT()
diff --git a/component/java/buildout.cfg b/component/java/buildout.cfg
index 42fe4a8c76b9e51a762417c9ebfaf84c741149c1..fdfd350db67e0bcf9a5f392e12a8ecb6e411850d 100644
--- a/component/java/buildout.cfg
+++ b/component/java/buildout.cfg
@@ -1,9 +1,25 @@
 [buildout]
 
-parts = 
+parts =
   java
-  
+
+[jdk-6u27-no-user-interaction-patch]
+recipe = hexagonit.recipe.download
+url = ${:_profile_base_location_}/${:filename}
+download-only = true
+filename = jdk-6u27-no-user-interaction.patch
+md5sum = 4c4303240647a114d07f3c411b2e6b5b
+
 [java]
+<= java-re
+
+[java-re]
+<= java-re-1.6.0
+
+[java-sdk]
+<= java-sdk-1.6.0
+
+[java-re-1.6.0]
 recipe = slapos.recipe.build
 slapos_promisee =
   directory:bin
@@ -28,3 +44,49 @@ script =
   self.cleanup_dir_list.append(extract_dir)
   workdir = guessworkdir(extract_dir)
   self.copyTree(os.path.join(workdir, "jre1.6.0_27"), "%(location)s")
+
+[java-sdk-1.6.0]
+recipe = slapos.recipe.build
+slapos_promisee =
+  directory:bin
+  directory:lib
+  directory:man
+  directory:plugin
+  directory:javaws
+  file:jre/lib/rt.jar
+  file:bin/java
+x86 = http://download.oracle.com/otn-pub/java/jdk/6u27-b07/jdk-6u27-linux-i586.bin bdb5f05bd20c6aa9a4729726191bf6fd
+x86-64 = http://download.oracle.com/otn-pub/java/jdk/6u27-b07/jdk-6u27-linux-x64.bin 94f93a3ff03f824a238ecd79ad90433e
+script =
+  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
+  download_file = self.download(self.options['url'], self.options.get('md5sum'))
+  extract_dir = tempfile.mkdtemp(self.name)
+  os.chdir(extract_dir)
+  (download_dir, filename) = os.path.split(download_file)
+  auto_extract_bin = os.path.join(extract_dir, filename)
+  shutil.move(download_file, auto_extract_bin)
+  os.chmod(auto_extract_bin, 0777)
+  subprocess.call(["patch", auto_extract_bin, "-i", "${jdk-6u27-no-user-interaction-patch:location}/${jdk-6u27-no-user-interaction-patch:filename}"])
+  subprocess.call([auto_extract_bin])
+  self.cleanup_dir_list.append(extract_dir)
+  workdir = guessworkdir(extract_dir)
+  self.copyTree(os.path.join(workdir, "jdk1.6.0_27"), "%(location)s")
+
+[java-sdk-1.7.0]
+recipe = slapos.recipe.build
+slapos_promisee =
+  directory:bin
+  directory:lib
+  directory:man
+  directory:jre
+  file:jre/lib/rt.jar
+  file:bin/java
+  file:bin/javac
+x86 = http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz f97244a104f03731e5ff69f0dd5a9927
+x86-64 = http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz b3c1ef5faea7b180469c129a49762b64
+script =
+  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
+  extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
+  workdir = guessworkdir(extract_dir)
+  self.copyTree(workdir, "%(location)s")
+
diff --git a/component/java/jdk-6u27-no-user-interaction.patch b/component/java/jdk-6u27-no-user-interaction.patch
new file mode 100644
index 0000000000000000000000000000000000000000..b217852d4e9b4ea42bdf9992c58bb5dab4b0dd6c
--- /dev/null
+++ b/component/java/jdk-6u27-no-user-interaction.patch
@@ -0,0 +1,20 @@
+--- jdk-6u27-linux-x64.bin.orig	2011-09-27 11:02:14.000000000 +0200
++++ jdk-6u27-linux-x64.bin	2011-09-27 10:38:01.000000000 +0200
+@@ -81,7 +81,7 @@
+ trap 'rm -f $outname; exit 1' HUP INT QUIT TERM
+ echo "Unpacking..."
+ tail ${tail_args} +189 "$0" > $outname
+-if [ -x /usr/bin/sum ]; then
++if [ -x /usr/bin/null ]; then
+     echo "Checksumming..."
+ 
+     sum=`/usr/bin/sum $outname`
+@@ -169,7 +169,7 @@
+     fi
+ 
+     # Service Tag support and JDK product registration
+-    register_JDK "$javahome" "${BINARY_NAME}" "$1"
++    # register_JDK "$javahome" "${BINARY_NAME}" "$1"
+ 
+ else
+     if [ "$1" = "-x" ]; then
diff --git a/component/libaio/buildout.cfg b/component/libaio/buildout.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..4d46fe3c4b48486c708addcfa667a751c05f1c35
--- /dev/null
+++ b/component/libaio/buildout.cfg
@@ -0,0 +1,12 @@
+[buildout]
+parts =
+  libaio
+
+[libaio]
+recipe = hexagonit.recipe.cmmi
+# originally located at http://www.kernel.org/pub/linux/libs/aio/
+url = http://ftp.free.fr/mirrors/ftp.debian.org/pool/main/liba/libaio/libaio_0.3.109.orig.tar.gz
+md5sum = 435a5b16ca6198eaf01155263d855756
+location = ${buildout:parts-directory}/${:_buildout_section_name_}
+configure-command = echo
+make-options = prefix=${:location}
diff --git a/component/libpng/buildout.cfg b/component/libpng/buildout.cfg
index d7ead5bdf7c3e6d3baab4ddc6408ccabffbfa5c6..a78e8143ea8c5762c182fb003a8388bcbacbe591 100644
--- a/component/libpng/buildout.cfg
+++ b/component/libpng/buildout.cfg
@@ -15,5 +15,5 @@ environment =
 
 [libpng]
 <= libpng-common
-url = http://download.sourceforge.net/libpng/libpng-1.5.4.tar.bz2
-md5sum = b43afe39237b69859522455b215f9e85
+url = http://download.sourceforge.net/libpng/libpng-1.5.5.tar.bz2
+md5sum = 3270bf2990c3174ae939388398de751e
diff --git a/component/libreoffice-bin/buildout.cfg b/component/libreoffice-bin/buildout.cfg
index c29f2b76c8adfed4901c9d0b8de2b2d2df8b9cbb..5cf716eb14a95f390f308bf4c6451f0a4be10dca 100644
--- a/component/libreoffice-bin/buildout.cfg
+++ b/component/libreoffice-bin/buildout.cfg
@@ -12,11 +12,11 @@ find-links =
 [libreoffice-bin]
 recipe = slapos.recipe.build
 # here, two %s are used, first one is for directory name (eg. x86_64), and second one is for filename (eg. x86-64).
-url = http://download.documentfoundation.org/libreoffice/stable/3.4.3/rpm/%s/LibO_3.4.3_Linux_%s_install-rpm_en-US.tar.gz
+url = http://download.documentfoundation.org/libreoffice/stable/3.4.4/rpm/%s/LibO_3.4.4_Linux_%s_install-rpm_en-US.tar.gz
 
 # supported architectures md5sums
-md5sum_x86 = ae1b2b387dcef513c378cc95b255affc
-md5sum_x86-64 = b2d6a902182c1af82ca088fbb665d0e3
+md5sum_x86 = 529c60e161d0c23405723f4a3cd1e046
+md5sum_x86-64 = fc6cb85312d6e11a7ab6ddb1bc4e79cc
 
 # where office code can be found?
 officedir = libreoffice3.4
@@ -37,7 +37,7 @@ script =
   rpmsdir = os.path.join(workdir, [q for q in os.listdir(workdir) if q == 'RPMS'][0])
   rpmlist = [os.path.join(rpmsdir, q) for q in os.listdir(rpmsdir) if q.endswith('.rpm') and 'javafilter' not in q and 'xsltfilter' not in q]
   [self.pipeCommand([[sys.executable, '${:rpm2cpio}', rpm], ['${:cpio}', '-idum']], cwd=storagedir) for rpm in rpmlist]
-  self.copyTree(os.path.join(storagedir, 'opt', '${:officedir}'), location, ['basis3.4', 'basis3.3', 'ure'])
+  self.copyTree(os.path.join(storagedir, 'opt', '${:officedir}'), location, ['basis3.4', 'ure'])
 
 # helper binaries
 cpio = ${cpio:location}/bin/cpio
diff --git a/component/libtool/buildout.cfg b/component/libtool/buildout.cfg
index d50fa57038d95f16b36a514fde80e3e4d854ed37..8d6256665e45aac0682f028fa47575c4d3c22a1c 100644
--- a/component/libtool/buildout.cfg
+++ b/component/libtool/buildout.cfg
@@ -3,7 +3,7 @@ parts = libtool
 
 [libtool]
 recipe = hexagonit.recipe.cmmi
-md5sum = b32b04148ecdd7344abc6fe8bd1bb021
-url = http://ftp.gnu.org/gnu/libtool/libtool-2.4.tar.gz
+md5sum = d2f3b7d4627e69e13514a40e72a24d50
+url = http://ftp.gnu.org/gnu/libtool/libtool-2.4.2.tar.gz
 configure-options =
   --disable-static
diff --git a/component/maatkit/buildout.cfg b/component/maatkit/buildout.cfg
deleted file mode 100644
index 7f5d7d5efeecdb5fd6ded97ba218f40495b99549..0000000000000000000000000000000000000000
--- a/component/maatkit/buildout.cfg
+++ /dev/null
@@ -1,18 +0,0 @@
-[buildout]
-extends =
-  ../perl/buildout.cfg
-  ../perl-DBI/buildout.cfg
-  ../perl-DBD-MySQL/buildout.cfg
-parts =
-  maatkit
-
-[maatkit]
-recipe = hexagonit.recipe.cmmi
-depends =
-  ${perl:version}
-  ${perl-DBI:version}
-  ${perl-DBD-MySQL:version}
-url = http://maatkit.googlecode.com/files/maatkit-7540.tar.gz
-md5sum = 55457f98500b096a6bf549356d3445fe
-configure-command =
-  ${perl:location}/bin/perl Makefile.PL
diff --git a/component/mariadb/buildout.cfg b/component/mariadb/buildout.cfg
index 748772c67a25cd03e6c79597552d155166ac7731..919e032cb3c3c6b88262b729a8315b429025e533 100644
--- a/component/mariadb/buildout.cfg
+++ b/component/mariadb/buildout.cfg
@@ -5,6 +5,7 @@
 extends =
   ../zlib/buildout.cfg
   ../groonga/buildout.cfg
+  ../libevent/buildout.cfg
   ../ncurses/buildout.cfg
   ../pkgconfig/buildout.cfg
   ../readline/buildout.cfg
@@ -12,11 +13,18 @@ extends =
 parts =
   mariadb
 
+[mariadb-no_test-patch]
+recipe = hexagonit.recipe.download
+url = ${:_profile_base_location_}/${:filename}
+md5sum = d65f61829cfbcd5062f49db2b00bd6fe
+filename = mysql_create_system_tables__no_test.patch
+download-only = true
+
 [mariadb]
 recipe = hexagonit.recipe.cmmi
-version = 5.3.2-beta
-url = http://downloads.askmonty.org/f/mariadb-${:version}/kvm-tarbake-jaunty-x86/mariadb-${:version}.tar.gz/from/http://mirror.layerjet.com/mariadb
-md5sum = d8199454059ab2c98313aaad0c1bc318
+version = 5.3.3-rc
+url = http://downloads.askmonty.org/f/mariadb-${:version}/kvm-tarbake-jaunty-x86/mariadb-${:version}.tar.gz/from/http:/ftp.osuosl.org/pub/mariadb
+md5sum = 715c61bb101acc7d37e893f6a9de9267
 # compile directory is required to build mysql plugins.
 keep-compile-dir = true
 # configure: how to avoid searching for my.cnf?
@@ -31,19 +39,30 @@ configure-options =
   --with-pic
   --with-fast-mutexes
   --with-charset=utf8
+  --with-extra-charsets=complex
   --with-collation=utf8_unicode_ci
+  --with-big-tables
+  --with-embedded-server
+  --with-plugins=max-no-ndb
+  --with-aria-tmp-tables
+  --without-plugin-innodb_plugin
+  --without-plugin-oqgraph
   --without-readline
   --with-ssl
+  --with-libevent=${libevent:location}
   --with-zlib-dir=${zlib:location}
 
+patch-options = -p0
+patches =
+  ${mariadb-no_test-patch:location}/${mariadb-no_test-patch:filename}
 environment =
-  CPPFLAGS =-I${ncurses:location}/include -I${readline:location}/include
-  LDFLAGS =-L${readline:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${ncurses:location}/lib -Wl,-rpath=${readline:location}/lib
+  CPPFLAGS=-I${ncurses:location}/include -I${readline5:location}/include
+  LDFLAGS=-Wl,-rpath=${libevent:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib -L${readline5:location}/lib -Wl,-rpath=${readline5:location}/lib -Wl,-rpath=${zlib:location}/lib
 
-[groonga-storage-engine-mariadb]
+[mroonga-mariadb]
 recipe = hexagonit.recipe.cmmi
-url = http://github.com/downloads/mroonga/mroonga/groonga-storage-engine-0.5.tar.gz
-md5sum = 52fed75d97a91f239750a1011ea9e468
+url = https://github.com/downloads/mroonga/mroonga/mroonga-1.10.tar.gz
+md5sum = 6a712b2b20eddc65d918dabd8fba590f
 configure-options =
   --with-mysql-source=${mariadb:location}__compile__/mariadb-${mariadb:version}
   --with-mysql-config=${mariadb:location}/bin/mysql_config
diff --git a/component/mariadb/groonga-storage-engine-1.0.1-mariadb.patch b/component/mariadb/groonga-storage-engine-1.0.1-mariadb.patch
new file mode 100644
index 0000000000000000000000000000000000000000..98d6188fc91abac6dd6530cdd7aa113ca8c72de1
--- /dev/null
+++ b/component/mariadb/groonga-storage-engine-1.0.1-mariadb.patch
@@ -0,0 +1,382 @@
+--- groonga-storage-engine-1.0.1/ha_mroonga.cc	2011-10-28 07:19:15.506715507 +0200
++++ groonga-storage-engine-1.0.1/ha_mroonga.cc	2011-11-02 11:37:03.095096227 +0100
+@@ -77,6 +77,9 @@
+ extern "C" {
+ #endif
+ 
++/* groonga's internal functions */
++const char *grn_obj_get_value_(grn_ctx *ctx, grn_obj *obj, grn_id id, uint32 *size);
++
+ /* global variables */
+ pthread_mutex_t mrn_db_mutex;
+ pthread_mutex_t mrn_log_mutex;
+@@ -109,7 +112,6 @@
+ static bool mrn_logfile_opened = false;
+ grn_log_level mrn_log_level_default = GRN_LOG_DEFAULT_LEVEL;
+ ulong mrn_log_level = (ulong) mrn_log_level_default;
+-char mrn_default_parser_name[MRN_MAX_KEY_SIZE];
+ char *mrn_default_parser;
+ 
+ static void mrn_logger_func(int level, const char *time, const char *title,
+@@ -228,13 +230,12 @@
+           "default parser changed from '%s' to '%s'",
+           old_value, new_value);
+   grn_ctx_fin(&ctx);
+-  strcpy(mrn_default_parser_name, new_value);
+-  mrn_default_parser = mrn_default_parser_name;
++  strncpy(mrn_default_parser, new_value, MRN_MAX_KEY_SIZE - 1);
+   DBUG_VOID_RETURN;
+ }
+ 
+ static MYSQL_SYSVAR_STR(default_parser, mrn_default_parser,
+-                        PLUGIN_VAR_RQCMDARG,
++                        PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
+                         "default fulltext parser",
+                         NULL,
+                         mrn_default_parser_update,
+@@ -908,6 +909,15 @@
+                    field->charset());
+       break;
+     }
++  case MYSQL_TYPE_BLOB:
++    {
++      GRN_VOID_INIT(&buf);
++      uint32 len;
++      const char *val = grn_obj_get_value_(ctx, col, id, &len);
++      Field_blob *blob = (Field_blob *)field;
++      blob->set_ptr((uchar *)&len, (uchar *)val);
++      break;
++    }
+   default: //strings etc..
+     {
+       GRN_TEXT_INIT(&buf,0);
+@@ -1010,6 +1020,9 @@
+     goto error_allocated_open_tables_hash_init;
+   }
+ 
++  mrn_default_parser = (char *)my_malloc(MRN_MAX_KEY_SIZE, MYF(MY_WME));
++  strncpy(mrn_default_parser, MRN_PARSER_DEFAULT, MRN_MAX_KEY_SIZE - 1);
++
+   return 0;
+ 
+ error_allocated_open_tables_hash_init:
+@@ -4422,7 +4435,7 @@
+   DBUG_RETURN(error);
+ }
+ 
+-int ha_mroonga::wrapper_index_read_map(uchar * buf, const uchar * key,
++int ha_mroonga::wrapper_index_read_map(uchar *buf, const uchar *key,
+                                        key_part_map keypart_map,
+                                        enum ha_rkey_function find_flag)
+ {
+@@ -4442,7 +4455,11 @@
+     MRN_SET_WRAP_TABLE_KEY(this, table);
+     if (fulltext_searching)
+       set_pk_bitmap();
++#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP
++    error = wrap_handler->ha_index_read_map(buf, key, keypart_map, find_flag);
++#else
+     error = wrap_handler->index_read_map(buf, key, keypart_map, find_flag);
++#endif
+     MRN_SET_BASE_SHARE_KEY(share, table->s);
+     MRN_SET_BASE_TABLE_KEY(this, table);
+   }
+@@ -4557,7 +4574,7 @@
+   DBUG_RETURN(error);
+ }
+ 
+-int ha_mroonga::index_read_map(uchar * buf, const uchar * key,
++int ha_mroonga::index_read_map(uchar *buf, const uchar *key,
+                                key_part_map keypart_map,
+                                enum ha_rkey_function find_flag)
+ {
+@@ -4572,6 +4589,7 @@
+   DBUG_RETURN(error);
+ }
+ 
++#ifdef MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP
+ int ha_mroonga::wrapper_index_read_last_map(uchar *buf, const uchar *key,
+                                             key_part_map keypart_map)
+ {
+@@ -4658,6 +4676,7 @@
+   }
+   DBUG_RETURN(error);
+ }
++#endif
+ 
+ int ha_mroonga::wrapper_index_next(uchar *buf)
+ {
+@@ -6226,7 +6245,11 @@
+ }
+ 
+ ha_rows ha_mroonga::wrapper_multi_range_read_info(uint keyno, uint n_ranges,
+-                                                  uint keys, uint *bufsz,
++                                                  uint keys,
++#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++                                                  uint key_parts,
++#endif
++                                                  uint *bufsz,
+                                                   uint *flags, COST_VECT *cost)
+ {
+   MRN_DBUG_ENTER_METHOD();
+@@ -6236,6 +6259,9 @@
+   if (fulltext_searching)
+     set_pk_bitmap();
+   rows = wrap_handler->multi_range_read_info(keyno, n_ranges, keys,
++#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++                                             key_parts,
++#endif
+                                              bufsz, flags, cost);
+   MRN_SET_BASE_SHARE_KEY(share, table->s);
+   MRN_SET_BASE_TABLE_KEY(this, table);
+@@ -6243,16 +6269,26 @@
+ }
+ 
+ ha_rows ha_mroonga::storage_multi_range_read_info(uint keyno, uint n_ranges,
+-                                                  uint keys, uint *bufsz,
++                                                  uint keys,
++#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++                                                  uint key_parts,
++#endif
++                                                  uint *bufsz,
+                                                   uint *flags, COST_VECT *cost)
+ {
+   MRN_DBUG_ENTER_METHOD();
+   ha_rows rows = handler::multi_range_read_info(keyno, n_ranges, keys,
++#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++                                                key_parts,
++#endif
+                                                 bufsz, flags, cost);
+   DBUG_RETURN(rows);
+ }
+ 
+ ha_rows ha_mroonga::multi_range_read_info(uint keyno, uint n_ranges, uint keys,
++#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++                                          uint key_parts,
++#endif
+                                           uint *bufsz, uint *flags,
+                                           COST_VECT *cost)
+ {
+@@ -6261,9 +6297,15 @@
+   if (share->wrapper_mode)
+   {
+     rows = wrapper_multi_range_read_info(keyno, n_ranges, keys,
++#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++                                         key_parts,
++#endif
+                                          bufsz, flags, cost);
+   } else {
+     rows = storage_multi_range_read_info(keyno, n_ranges, keys,
++#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++                                         key_parts,
++#endif
+                                          bufsz, flags, cost);
+   }
+   DBUG_RETURN(rows);
+@@ -6315,7 +6357,7 @@
+   DBUG_RETURN(error);
+ }
+ 
+-int ha_mroonga::wrapper_multi_range_read_next(char **range_info)
++int ha_mroonga::wrapper_multi_range_read_next(range_id_t *range_info)
+ {
+   MRN_DBUG_ENTER_METHOD();
+   int error = 0;
+@@ -6329,14 +6371,14 @@
+   DBUG_RETURN(error);
+ }
+ 
+-int ha_mroonga::storage_multi_range_read_next(char **range_info)
++int ha_mroonga::storage_multi_range_read_next(range_id_t *range_info)
+ {
+   MRN_DBUG_ENTER_METHOD();
+   int error = handler::multi_range_read_next(range_info);
+   DBUG_RETURN(error);
+ }
+ 
+-int ha_mroonga::multi_range_read_next(char **range_info)
++int ha_mroonga::multi_range_read_next(range_id_t *range_info)
+ {
+   MRN_DBUG_ENTER_METHOD();
+   int error = 0;
+--- groonga-storage-engine-1.0.1/ha_mroonga.h	2011-10-27 12:31:36.859277054 +0200
++++ groonga-storage-engine-1.0.1/ha_mroonga.h	2011-11-02 11:37:03.095096227 +0100
+@@ -47,18 +47,22 @@
+ #  define MRN_HANDLER_HAVE_ADD_INDEX 1
+ #endif
+ 
+-#if (MYSQL_VERSION_ID >= 50600) || \
+-    (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50302)
+-#  define MRN_HANDLER_HAVE_HA_CLOSE 1
++#if (MYSQL_VERSION_ID >= 50603) || \
++    (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50209)
+ #  define MRN_HANDLER_HAVE_HA_RND_NEXT 1
+ #  define MRN_HANDLER_HAVE_HA_RND_POS 1
++#  define MRN_HANDLER_HAVE_HA_INDEX_READ_MAP 1
+ #  define MRN_HANDLER_HAVE_HA_INDEX_READ_IDX_MAP 1
+ #  define MRN_HANDLER_HAVE_HA_INDEX_NEXT 1
+ #  define MRN_HANDLER_HAVE_HA_INDEX_PREV 1
+ #  define MRN_HANDLER_HAVE_HA_INDEX_FIRST 1
+ #  define MRN_HANDLER_HAVE_HA_INDEX_LAST 1
+ #  define MRN_HANDLER_HAVE_HA_INDEX_NEXT_SAME 1
++#endif
+ 
++#if (MYSQL_VERSION_ID >= 50603) || \
++    (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50302)
++#  define MRN_HANDLER_HAVE_HA_CLOSE 1
+ #  define MRN_HANDLER_HAVE_MULTI_RANGE_READ 1
+ #endif
+ 
+@@ -66,6 +70,14 @@
+ #  define MRN_HANDLER_HAVE_HA_INPLACE_INDEX_CHANGE
+ #endif
+ 
++#ifndef MRN_MARIADB_P
++#  define MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP
++#endif
++
++#if (defined(MRN_MARIADB_P) && MYSQL_VERSION_ID >= 50302)
++#  define MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++#endif
++
+ #if MYSQL_VERSION_ID < 50600
+   typedef Item COND;
+ #endif
+@@ -74,6 +86,10 @@
+   typedef MYSQL_ERROR Sql_condition;
+ #endif
+ 
++#ifndef MRN_MARIADB_P
++  typedef char *range_id_t;
++#endif
++
+ class ha_mroonga;
+ 
+ /* structs */
+@@ -213,11 +229,15 @@
+   ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
+   int index_init(uint idx, bool sorted);
+   int index_end();
++#ifndef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP
+   int index_read_map(uchar * buf, const uchar * key,
+                      key_part_map keypart_map,
+                      enum ha_rkey_function find_flag);
++#endif
++#ifdef MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP
+   int index_read_last_map(uchar *buf, const uchar *key,
+                           key_part_map keypart_map);
++#endif
+ #ifndef MRN_HANDLER_HAVE_HA_INDEX_NEXT
+   int index_next(uchar *buf);
+ #endif
+@@ -261,11 +281,14 @@
+                                       uint n_ranges, uint *bufsz,
+                                       uint *flags, COST_VECT *cost);
+   ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
++#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++                                uint key_parts,
++#endif
+                                 uint *bufsz, uint *flags, COST_VECT *cost);
+   int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
+                             uint n_ranges, uint mode,
+                             HANDLER_BUFFER *buf);
+-  int multi_range_read_next(char **range_info);
++  int multi_range_read_next(range_id_t *range_info);
+ #else // MRN_HANDLER_HAVE_MULTI_RANGE_READ
+   int read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
+                              KEY_MULTI_RANGE *ranges,
+@@ -321,6 +344,11 @@
+ #ifdef MRN_HANDLER_HAVE_HA_RND_POS
+   int rnd_pos(uchar *buf, uchar *pos);
+ #endif
++#ifdef MRN_HANDLER_HAVE_HA_INDEX_READ_MAP
++  int index_read_map(uchar *buf, const uchar *key,
++                     key_part_map keypart_map,
++                     enum ha_rkey_function find_flag);
++#endif
+ #ifdef MRN_HANDLER_HAVE_HA_INDEX_NEXT
+   int index_next(uchar *buf);
+ #endif
+@@ -469,10 +497,12 @@
+   int storage_index_read_map(uchar *buf, const uchar *key,
+                              key_part_map keypart_map,
+                              enum ha_rkey_function find_flag);
++#ifdef MRN_HANDLER_HAVE_INDEX_READ_LAST_MAP
+   int wrapper_index_read_last_map(uchar *buf, const uchar *key,
+                                   key_part_map keypart_map);
+   int storage_index_read_last_map(uchar *buf, const uchar *key,
+                                   key_part_map keypart_map);
++#endif
+   int wrapper_index_next(uchar *buf);
+   int storage_index_next(uchar *buf);
+   int wrapper_index_prev(uchar *buf);
+@@ -533,9 +563,15 @@
+                                               uint *flags,
+                                               COST_VECT *cost);
+   ha_rows wrapper_multi_range_read_info(uint keyno, uint n_ranges, uint keys,
++#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++                                        uint key_parts,
++#endif
+                                         uint *bufsz, uint *flags,
+                                         COST_VECT *cost);
+   ha_rows storage_multi_range_read_info(uint keyno, uint n_ranges, uint keys,
++#ifdef MRN_HANDLER_HAVE_MULTI_RANGE_READ_INFO_KEY_PARTS
++                                        uint key_parts,
++#endif
+                                         uint *bufsz, uint *flags,
+                                         COST_VECT *cost);
+   int wrapper_multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
+@@ -544,8 +580,8 @@
+   int storage_multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
+                                     uint n_ranges, uint mode,
+                                     HANDLER_BUFFER *buf);
+-  int wrapper_multi_range_read_next(char **range_info);
+-  int storage_multi_range_read_next(char **range_info);
++  int wrapper_multi_range_read_next(range_id_t *range_info);
++  int storage_multi_range_read_next(range_id_t *range_info);
+ #else // MRN_HANDLER_HAVE_MULTI_RANGE_READ
+   int wrapper_read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
+                                      KEY_MULTI_RANGE *ranges,
+--- groonga-storage-engine-1.0.1/test/run-sql-test.sh	2011-09-27 10:43:29.093290682 +0200
++++ groonga-storage-engine-1.0.1/test/run-sql-test.sh	2011-11-02 11:37:03.099096256 +0100
+@@ -24,12 +24,20 @@
+ source_test_suites_dir="${source_mysql_test_dir}/suite"
+ build_test_suites_dir="${build_mysql_test_dir}/suite"
+ case "${MYSQL_VERSION}" in
+-    5.1)
++    5.1.*)
+ 	plugins_dir="${MYSQL_BUILD}/lib/mysql/plugin"
+ 	if ! test -d "${build_test_suites_dir}"; then
+ 	    mkdir -p "${build_test_suites_dir}"
+ 	fi
+ 	;;
++    *-MariaDB*)
++	if ! test -d "${build_test_suites_dir}"; then
++	    ln -s "${source_test_suites_dir}" "${build_test_suites_dir}"
++	fi
++	if ! test -d "${MYSQL_BUILD}/plugin/mroonga"; then
++	    ln -s "${top_dir}" "${MYSQL_BUILD}/plugin/mroonga"
++	fi
++	;;
+     *)
+ 	if ! test -d "${build_test_suites_dir}"; then
+ 	    ln -s "${source_test_suites_dir}" "${build_test_suites_dir}"
+@@ -47,10 +55,14 @@
+     fi
+ done
+ 
+-make -C ${top_dir} \
+-    install-pluginLTLIBRARIES \
+-    plugindir=${plugins_dir} > /dev/null || \
+-    exit 1
++if test -n "${plugins_dir}"; then
++    make -C ${top_dir} \
++	install-pluginLTLIBRARIES \
++	plugindir=${plugins_dir} > /dev/null || \
++	exit 1
++else
++    make -C ${top_dir} > /dev/null || exit 1
++fi
+ 
+ (cd "$build_mysql_test_dir" && \
+     ./mysql-test-run.pl \
diff --git a/component/mariadb/mysql_create_system_tables__no_test.patch b/component/mariadb/mysql_create_system_tables__no_test.patch
new file mode 100644
index 0000000000000000000000000000000000000000..31f5d0ab12a9c4715a8998e2107a3c17cce5f14f
--- /dev/null
+++ b/component/mariadb/mysql_create_system_tables__no_test.patch
@@ -0,0 +1,26 @@
+# 33_scripts__mysql_create_system_tables__no_test.dpatch by  <ch@debian.org>
+
+A user with no password prevents a normal user from login under certain
+circumstances as it is checked first.
+See http://bugs.debian.org/301741
+and http://bugs.mysql.com/bug.php?id=6901
+
+--- scripts/mysql_system_tables_data.sql	2008-12-04 22:59:44.000000000 +0100
++++ scripts/mysql_system_tables_data.sql	2008-12-04 23:00:07.000000000 +0100
+@@ -11,8 +11,6 @@
+ -- Fill "db" table with default grants for anyone to
+ -- access database 'test' and 'test_%' if "db" table didn't exist
+ CREATE TEMPORARY TABLE tmp_db LIKE db;
+-INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
+-INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
+ INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
+ DROP TABLE tmp_db;
+ 
+@@ -24,7 +22,5 @@
+ INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');
+ REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','' FROM dual WHERE LOWER( @current_hostname) != 'localhost';
+ REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');
+-INSERT INTO tmp_user (host,user) VALUES ('localhost','');
+-INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost';
+ INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
+ DROP TABLE tmp_user;
diff --git a/component/memcached/buildout.cfg b/component/memcached/buildout.cfg
index 5c36165e4bfa3777421094c7d358b1be8aa00e3c..dbc2979c053fb0e367cd0f09b839f3e2e4d0e0ea 100644
--- a/component/memcached/buildout.cfg
+++ b/component/memcached/buildout.cfg
@@ -1,16 +1,9 @@
 [buildout]
 parts = memcached
-extends = ../libevent/buildout.cfg
-
-[memcached-strict-aliasing-patch]
-# on some platforms original memcached refuses to build:
-#  * http://code.google.com/p/memcached/issues/detail?id=60
-#  * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565033
-recipe = hexagonit.recipe.download
-url = ${:_profile_base_location_}/${:filename}
-md5sum = c03b3bfc237b77667b0e90442b0980e8
-download-only = true
-filename = memcached-fix-strict-aliasing.patch
+extends =
+  ../autoconf/buildout.cfg
+  ../automake/buildout.cfg
+  ../libevent/buildout.cfg
 
 [memcached-fix-array-subscript-is-above-array-bounds]
 recipe = hexagonit.recipe.download
@@ -19,45 +12,30 @@ filename = memcached-1.4-fix-array-subscript-is-above-array-bounds.patch
 download-only = true
 md5sum = 472508b9a4b6c0b9f5d6f2abce3444e3
 
-[memcached-gcc4.6.patch]
+[memcached-gcc-4.4.patch]
 recipe = hexagonit.recipe.download
 url = ${:_profile_base_location_}/${:filename}
-filename = memcached-gcc4.6.patch
+filename = memcached-gcc-4.4.patch
 download-only = true
-md5sum = 3418477f64500cd2a8dce046f5d72fec
+md5sum = fd98d0cbfc4d3a25ac9808472fbe62f8
 
 [memcached]
-<= memcached-1.4.6
-
-[memcached-1.4.6]
-<= memcached-common
-url = http://memcached.googlecode.com/files/memcached-1.4.6.tar.gz
-md5sum = 243e5d82de27e6e45caf0ebfd400e41a
-patches =
-  ${memcached-fix-array-subscript-is-above-array-bounds:location}/${memcached-fix-array-subscript-is-above-array-bounds:filename}
-
-[memcached-1.4.5]
-<= memcached-common
-url = http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
-md5sum = 583441a25f937360624024f2881e5ea8
-patches =
-  ${memcached-strict-aliasing-patch:location}/${memcached-strict-aliasing-patch:filename}
-  ${memcached-fix-array-subscript-is-above-array-bounds:location}/${memcached-fix-array-subscript-is-above-array-bounds:filename}
-  ${memcached-gcc4.6.patch:location}/${memcached-gcc4.6.patch:filename}
-
-[memcached-1.4.4]
-<= memcached-common
-url = http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz
-md5sum = 5ca5b24de347e97ac1f48f3785b4178a
-patches =
-  ${memcached-strict-aliasing-patch:location}/${memcached-strict-aliasing-patch:filename}
-  ${memcached-fix-array-subscript-is-above-array-bounds:location}/${memcached-fix-array-subscript-is-above-array-bounds:filename}
-  ${memcached-gcc4.6.patch:location}/${memcached-gcc4.6.patch:filename}
-
-[memcached-common]
 recipe = hexagonit.recipe.cmmi
+url = http://memcached.googlecode.com/files/memcached-1.4.8.tar.gz
+md5sum = b7104e269511621c2777367d6d6315fe
+patches =
+  ${memcached-fix-array-subscript-is-above-array-bounds:location}/${memcached-fix-array-subscript-is-above-array-bounds:filename} ${memcached-gcc-4.4.patch:location}/${memcached-gcc-4.4.patch:filename}
+patch-options = -p1
+configure-command =
+  aclocal-1.11
+  autoheader
+  automake-1.11 --foreign
+  autoconf
+  ./configure
 configure-options =
+  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
   --with-libevent=${libevent:location}
-patch-options = -p1
+  --disable-docs
 environment =
-    LDFLAGS =-Wl,-rpath=${libevent:location}/lib
+  PATH=${autoconf:location}/bin:${automake-1.11:location}/bin:%(PATH)s
+  LDFLAGS =-Wl,-rpath=${libevent:location}/lib
diff --git a/component/memcached/memcached-fix-strict-aliasing.patch b/component/memcached/memcached-fix-strict-aliasing.patch
deleted file mode 100644
index ac8d4dde568472b007a8565ee68c398943a47857..0000000000000000000000000000000000000000
--- a/component/memcached/memcached-fix-strict-aliasing.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-diff -rdBu memcached-1.4.0-rc1/memcached.h memcached-1.4.0-my/memcached.h
---- memcached-1.4.0-rc1/memcached.h	2009-05-29 00:51:56.000000000 +0400
-+++ memcached-1.4.0-my/memcached.h	2009-06-07 22:32:52.000000000 +0400
-@@ -75,21 +75,21 @@
- 
- /* warning: don't use these macros with a function, as it evals its arg twice */
- #define ITEM_get_cas(i) ((uint64_t)(((i)->it_flags & ITEM_CAS) ? \
--                                    *(uint64_t*)&((i)->end[0]) : 0x0))
-+                                    *(uint64_t*)((char*)(i) + sizeof(*i)) : 0x0))
- #define ITEM_set_cas(i,v) { if ((i)->it_flags & ITEM_CAS) { \
--                          *(uint64_t*)&((i)->end[0]) = v; } }
-+                          *(uint64_t*)((char*)(i) + sizeof(*i)) = v; } }
- 
--#define ITEM_key(item) (((char*)&((item)->end[0])) \
-+#define ITEM_key(item) ((char*)(item) + sizeof(*item) \
-          + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
- 
--#define ITEM_suffix(item) ((char*) &((item)->end[0]) + (item)->nkey + 1 \
-+#define ITEM_suffix(item) ((char*)(item) + sizeof(*item) + (item)->nkey + 1 \
-          + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
- 
--#define ITEM_data(item) ((char*) &((item)->end[0]) + (item)->nkey + 1 \
-+#define ITEM_data(item) ((char*)(item) + sizeof(*item) + (item)->nkey + 1 \
-          + (item)->nsuffix \
-          + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
- 
--#define ITEM_ntotal(item) (sizeof(struct _stritem) + (item)->nkey + 1 \
-+#define ITEM_ntotal(item) (sizeof(*item) + (item)->nkey + 1 \
-          + (item)->nsuffix + (item)->nbytes \
-          + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
- 
-@@ -285,7 +285,6 @@
-     uint8_t         it_flags;   /* ITEM_* above */
-     uint8_t         slabs_clsid;/* which slab class we're in */
-     uint8_t         nkey;       /* key length, w/terminating null and padding */
--    void * end[];
-     /* if it_flags & ITEM_CAS we have 8 bytes CAS */
-     /* then null-terminated key */
-     /* then " flags length\r\n" (no terminating null) */
-
diff --git a/component/memcached/memcached-gcc-4.4.patch b/component/memcached/memcached-gcc-4.4.patch
new file mode 100644
index 0000000000000000000000000000000000000000..f86324858ad92d1fdd860b27d7647252c16d99ea
--- /dev/null
+++ b/component/memcached/memcached-gcc-4.4.patch
@@ -0,0 +1,12 @@
+# In OpenSuse 11.2, 'gcc -dumpversion' returns '4.4', not '4.4.*'.
+--- memcached-1.4.8/configure.ac.orig
++++ memcached-1.4.8/configure.ac
+@@ -502,7 +502,7 @@
+   GCC_VERSION=`$CC -dumpversion`
+   CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
+   case $GCC_VERSION in
+-    4.4.*)
++    4.4 | 4.4.*)
+     CFLAGS="$CFLAGS -fno-strict-aliasing"
+     ;;
+   esac
diff --git a/component/memcached/memcached-gcc4.6.patch b/component/memcached/memcached-gcc4.6.patch
deleted file mode 100644
index 53647d90aed8753754d1652a267428b64bfe3381..0000000000000000000000000000000000000000
--- a/component/memcached/memcached-gcc4.6.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-diff --git a/items.c b/items.c
-index e7f01ea..9fc6704 100644
---- a/items.c
-+++ b/items.c
-@@ -450,9 +450,7 @@ void do_item_stats_sizes(ADD_STAT add_stats, void *c) {
-         for (i = 0; i < num_buckets; i++) {
-             if (histogram[i] != 0) {
-                 char key[8];
--                int klen = 0;
--                klen = snprintf(key, sizeof(key), "%d", i * 32);
--                assert(klen < sizeof(key));
-+                assert(snprintf(key, sizeof(key), "%d", i * 32) < sizeof(key));
-                 APPEND_STAT(key, "%u", histogram[i]);
-             }
-         }
-diff --git a/memcached.c b/memcached.c
-index 750c8b3..0913b77 100644
---- a/memcached.c
-+++ b/memcached.c
-@@ -4627,8 +4627,6 @@ int main (int argc, char **argv) {
- 
-     /* create the listening socket, bind it, and init */
-     if (settings.socketpath == NULL) {
--        int udp_port;
--
-         const char *portnumber_filename = getenv("MEMCACHED_PORT_FILENAME");
-         char temp_portnumber_filename[PATH_MAX];
-         FILE *portnumber_file = NULL;
-@@ -4658,7 +4656,6 @@ int main (int argc, char **argv) {
-          * then daemonise if needed, then init libevent (in some cases
-          * descriptors created by libevent wouldn't survive forking).
-          */
--        udp_port = settings.udpport ? settings.udpport : settings.port;
- 
-         /* create the UDP listening socket and bind it */
-         errno = 0;
diff --git a/component/mysql-5.1/buildout.cfg b/component/mysql-5.1/buildout.cfg
index 5c912b79d2a4ff1eb9049240ba60c4724a348140..1397b9511be4e38a927b4e8e2b370001c40ca75a 100644
--- a/component/mysql-5.1/buildout.cfg
+++ b/component/mysql-5.1/buildout.cfg
@@ -21,6 +21,13 @@ md5sum = eefcd08c400c58d3e89542ab482a8429
 filename = mysql-5.1-sphinx-2.0.1-beta.diff
 download-only = true
 
+[mysql-5.1-no_test-patch]
+recipe = hexagonit.recipe.download
+url = ${:_profile_base_location_}/${:filename}
+md5sum = 22b0ef8baec5efc182e10d233c6f14ca
+filename = mysql_create_system_tables__no_test.patch
+download-only = true
+
 [mysql-5.1]
 recipe = hexagonit.recipe.cmmi
 version = 5.1.58
@@ -60,6 +67,7 @@ make-options =
 patch-options = -p0
 patches =
   ${mysql-5.1-sphinx-patch:location}/${mysql-5.1-sphinx-patch:filename}
+  ${mysql-5.1-no_test-patch:location}/${mysql-5.1-no_test-patch:filename}
 environment =
   PATH =${autoconf:location}/bin:${automake-1.11:location}/bin:${libtool:location}/bin:${bison:location}/bin:${flex:location}/bin:%(PATH)s
   CPPFLAGS =-I${ncurses:location}/include -I${readline:location}/include
@@ -67,8 +75,8 @@ environment =
 
 [groonga-storage-engine-mysql-5.1]
 recipe = hexagonit.recipe.cmmi
-url = http://github.com/downloads/mroonga/mroonga/groonga-storage-engine-0.9.tar.gz
-md5sum = 78fe07122dc376796a5aede476f50cfd
+url = http://github.com/downloads/mroonga/mroonga/groonga-storage-engine-1.0.0.tar.gz
+md5sum = 289b8b7919e790599ea79b6fe9270e04
 configure-options =
   --with-mysql-source=${mysql-5.1:location}__compile__/mysql-${mysql-5.1:version}
   --with-mysql-config=${mysql-5.1:location}/bin/mysql_config
diff --git a/component/mysql-5.1/mysql_create_system_tables__no_test.patch b/component/mysql-5.1/mysql_create_system_tables__no_test.patch
new file mode 100644
index 0000000000000000000000000000000000000000..0087e17588e5ea42d88682af0ea5ca9c910a45cc
--- /dev/null
+++ b/component/mysql-5.1/mysql_create_system_tables__no_test.patch
@@ -0,0 +1,26 @@
+# 33_scripts__mysql_create_system_tables__no_test.dpatch by  <ch@debian.org>
+
+A user with no password prevents a normal user from login under certain
+circumstances as it is checked first.
+See http://bugs.debian.org/301741
+and http://bugs.mysql.com/bug.php?id=6901
+
+--- scripts/mysql_system_tables_data.sql	2008-12-04 22:59:44.000000000 +0100
++++ scripts/mysql_system_tables_data.sql	2008-12-04 23:00:07.000000000 +0100
+@@ -11,8 +11,6 @@
+ -- Fill "db" table with default grants for anyone to
+ -- access database 'test' and 'test_%' if "db" table didn't exist
+ CREATE TEMPORARY TABLE tmp_db LIKE db;
+-INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
+-INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
+ INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
+ DROP TABLE tmp_db;
+ 
+@@ -24,7 +22,5 @@
+ INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+ REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @current_hostname) != 'localhost';
+ REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
+-INSERT INTO tmp_user (host,user) VALUES ('localhost','');
+-INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost';
+ INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
+ DROP TABLE tmp_user;
diff --git a/component/mysql-5.5/buildout.cfg b/component/mysql-5.5/buildout.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..1c55e0ea182ec5195a79ebdb11b97d705148e2ab
--- /dev/null
+++ b/component/mysql-5.5/buildout.cfg
@@ -0,0 +1,76 @@
+[buildout]
+extends =
+  ../autoconf/buildout.cfg
+  ../automake/buildout.cfg
+  ../bison/buildout.cfg
+  ../cmake/buildout.cfg
+  ../groonga/buildout.cfg
+  ../libaio/buildout.cfg
+  ../libtool/buildout.cfg
+  ../ncurses/buildout.cfg
+  ../pkgconfig/buildout.cfg
+  ../zlib/buildout.cfg
+
+parts =
+    mysql-5.5
+
+[mysql-5.5-sphinx-patch]
+# this patch comes from sphinx-2.0.1-beta including changes for
+# MySQL-5.5 in
+# http://code.google.com/p/sphinxsearch/source/detail?r=2921
+recipe = hexagonit.recipe.download
+url = ${:_profile_base_location_}/${:filename}
+md5sum = 04549822ebfa91b5f84025ff49ef24c2
+filename = mysql-5.5-sphinx-2.0.1-beta.diff
+download-only = true
+
+[mysql-5.5-no_test-patch]
+recipe = hexagonit.recipe.download
+url = ${:_profile_base_location_}/${:filename}
+md5sum = bb7ee34b9a98da1f913566c63ffbc6f5
+filename = mysql_create_system_tables__no_test.patch
+download-only = true
+
+[mysql-5.5]
+recipe = hexagonit.recipe.cmmi
+version = 5.5.16
+url = http://mysql.he.net/Downloads/MySQL-5.5/mysql-${:version}.tar.gz
+md5sum = 462ab3752dd666ec06ca32f92673b59e
+# compile directory is required to build mysql plugins.
+keep-compile-dir = true
+patch-options = -p0
+patches =
+  ${mysql-5.5-sphinx-patch:location}/${mysql-5.5-sphinx-patch:filename}
+  ${mysql-5.5-no_test-patch:location}/${mysql-5.5-no_test-patch:filename}
+configure-command = ${cmake:location}/bin/cmake
+# we use embeded yassl instead of openssl to avoid compilation errors on sphinx search engine.
+configure-options =
+  -DCMAKE_INSTALL_PREFIX=${buildout:parts-directory}/${:_buildout_section_name_}
+  -DBUILD_CONFIG=mysql_release
+  -DDEFAULT_CHARSET=utf8
+  -DDEFAULT_COLLATION=utf8_unicode_ci
+  -DWITH_SSL=bundled
+  -DWITH_ZLIB=system
+  -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
+  -DWITHOUT_DAEMON_EXAMPLE=1
+  -DWITH_SPHINX_STORAGE_ENGINE=1
+  -DCMAKE_C_FLAGS="-I${libaio:location}/include -I${ncurses:location}/include -I${zlib:location}/include"
+  -DCMAKE_INSTALL_RPATH=${libaio:location}/lib:${ncurses:location}/lib:${zlib:location}/lib
+environment =
+  CMAKE_PROGRAM_PATH=${autoconf:location}/bin:${automake-1.11:location}/bin:${cmake:location}/bin:${libtool:location}/bin:${bison:location}/bin:${flex:location}/bin
+  CMAKE_INCLUDE_PATH=${libaio:location}/include:${ncurses:location}/include:${zlib:location}/include
+  CMAKE_LIBRARY_PATH=${libaio:location}/lib:${ncurses:location}/lib:${zlib:location}/lib
+  LDFLAGS=-L${libaio:location}/lib
+
+[groonga-storage-engine-mysql-5.5]
+recipe = hexagonit.recipe.cmmi
+url = http://github.com/downloads/mroonga/mroonga/groonga-storage-engine-1.0.0.tar.gz
+md5sum = 289b8b7919e790599ea79b6fe9270e04
+configure-options =
+  --with-mysql-source=${mysql-5.5:location}__compile__/mysql-${mysql-5.5:version}
+  --with-mysql-config=${mysql-5.5:location}/bin/mysql_config
+environment =
+  PATH=${groonga:location}/bin:${pkgconfig:location}/bin:%(PATH)s
+  CPPFLAGS=-I${groonga:location}/include/groonga
+  LDFLAGS=-L${groonga:location}/lib
+  PKG_CONFIG_PATH=${groonga:location}/lib/pkgconfig
diff --git a/component/mysql-5.5/mysql-5.5-sphinx-2.0.1-beta.diff b/component/mysql-5.5/mysql-5.5-sphinx-2.0.1-beta.diff
new file mode 100644
index 0000000000000000000000000000000000000000..ee9f88cfa0b42ccc170a08f017bc229e6e3383ba
--- /dev/null
+++ b/component/mysql-5.5/mysql-5.5-sphinx-2.0.1-beta.diff
@@ -0,0 +1,4721 @@
+diff -uNr storage/sphinx/CMakeLists.txt storage/sphinx/CMakeLists.txt
+--- storage/sphinx/CMakeLists.txt	1970-01-01 01:00:00.000000000 +0100
++++ storage/sphinx/CMakeLists.txt	2011-10-13 00:59:59.282957578 +0200
+@@ -0,0 +1,16 @@
++SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
++SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
++ADD_DEFINITIONS(-DMYSQL_SERVER)
++
++INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
++                    ${CMAKE_SOURCE_DIR}/sql
++                    ${CMAKE_SOURCE_DIR}/extra/yassl/include
++                    ${CMAKE_SOURCE_DIR}/regex)
++
++SET(SPHINX_SOURCES ha_sphinx.cc)
++IF(MYSQL_VERSION_ID LESS 50515) 
++ADD_LIBRARY(sphinx ha_sphinx.cc)
++ELSE()
++SET(SPHINX_PLUGIN_DYNAMIC "ha_sphinx")
++MYSQL_ADD_PLUGIN(sphinx ${SPHINX_SOURCES} STORAGE_ENGINE MODULE_ONLY LINK_LIBRARIES mysys)
++ENDIF()
+diff -uNr storage/sphinx/gen_data.php storage/sphinx/gen_data.php
+--- storage/sphinx/gen_data.php	1970-01-01 01:00:00.000000000 +0100
++++ storage/sphinx/gen_data.php	2006-06-07 09:28:43.000000000 +0200
+@@ -0,0 +1,37 @@
++<?php
++
++$file_name= $argv[1];
++
++//echo $file_name;
++
++$cont= file_get_contents($file_name);
++
++$words= explode(" ", $cont);
++
++//echo "words: ".(count($words))."\n";
++
++$cw = count($words);
++
++echo "REPLACE INTO test.documents ( id, group_id, date_added, title, content ) VALUES\n";
++
++
++for ($i=1; $i<=100000; $i++)
++{
++  $count_words= mt_rand(10,30);
++  $pred = "";
++  for ($j=0; $j<$count_words; $j++)
++  {
++    $pred .= chop($words[mt_rand(1, $cw-1)])." ";
++  }
++  $count_words= mt_rand(3,5);
++  $tit = "";
++  for ($j=0; $j<$count_words; $j++)
++  {
++    $tit .= chop($words[mt_rand(1, $cw-1)])." ";
++  }
++  echo "($i,".mt_rand(1,20).",NOW(),'".addslashes($tit)."','".addslashes($pred)."'),\n";
++}       
++  echo "(0,1,now(),'end','eND');\n";
++  
++
++?>
+diff -uNr storage/sphinx/ha_sphinx.cc storage/sphinx/ha_sphinx.cc
+--- storage/sphinx/ha_sphinx.cc	1970-01-01 01:00:00.000000000 +0100
++++ storage/sphinx/ha_sphinx.cc	2011-10-13 00:59:59.282957578 +0200
+@@ -0,0 +1,3547 @@
++//
++// $Id: ha_sphinx.cc 2752 2011-03-29 08:21:05Z tomat $
++//
++
++//
++// Copyright (c) 2001-2011, Andrew Aksyonoff
++// Copyright (c) 2008-2011, Sphinx Technologies Inc
++// All rights reserved
++//
++// This program is free software; you can redistribute it and/or modify
++// it under the terms of the GNU General Public License. You should have
++// received a copy of the GPL license along with this program; if you
++// did not, you can find it at http://www.gnu.org/
++//
++
++#ifdef USE_PRAGMA_IMPLEMENTATION
++#pragma implementation // gcc: Class implementation
++#endif
++
++#if _MSC_VER>=1400
++#define _CRT_SECURE_NO_DEPRECATE 1
++#define _CRT_NONSTDC_NO_DEPRECATE 1
++#endif
++
++#include <mysql_version.h>
++
++#if MYSQL_VERSION_ID>=50515
++#include "sql_class.h"
++#include "sql_array.h"
++#elif MYSQL_VERSION_ID>50100
++#include "mysql_priv.h"
++#include <mysql/plugin.h>
++#else
++#include "../mysql_priv.h"
++#endif
++
++#include <mysys_err.h>
++#include <my_sys.h>
++#include <mysql.h> // include client for INSERT table (sort of redoing federated..)
++
++#ifndef __WIN__
++	// UNIX-specific
++	#include <my_net.h>
++	#include <netdb.h>
++	#include <sys/un.h>
++
++	#define	RECV_FLAGS	MSG_WAITALL
++
++	#define sphSockClose(_sock)	::close(_sock)
++#else
++	// Windows-specific
++	#include <io.h>
++	#define strcasecmp	stricmp
++	#define snprintf	_snprintf
++
++	#define	RECV_FLAGS	0
++
++	#define sphSockClose(_sock)	::closesocket(_sock)
++#endif
++
++#include <ctype.h>
++#include "ha_sphinx.h"
++
++#ifndef MSG_WAITALL
++#define MSG_WAITALL 0
++#endif
++
++#if _MSC_VER>=1400
++#pragma warning(push,4)
++#endif
++
++/////////////////////////////////////////////////////////////////////////////
++
++/// there might be issues with min() on different platforms (eg. Gentoo, they say)
++#define Min(a,b) ((a)<(b)?(a):(b))
++
++/// unaligned RAM accesses are forbidden on SPARC
++#if defined(sparc) || defined(__sparc__)
++#define UNALIGNED_RAM_ACCESS 0
++#else
++#define UNALIGNED_RAM_ACCESS 1
++#endif
++
++
++#if UNALIGNED_RAM_ACCESS
++
++/// pass-through wrapper
++template < typename T > inline T sphUnalignedRead ( const T & tRef )
++{
++	return tRef;
++}
++
++/// pass-through wrapper
++template < typename T > void sphUnalignedWrite ( void * pPtr, const T & tVal )
++{
++	*(T*)pPtr = tVal;
++}
++
++#else
++
++/// unaligned read wrapper for some architectures (eg. SPARC)
++template < typename T >
++inline T sphUnalignedRead ( const T & tRef )
++{
++	T uTmp;
++	byte * pSrc = (byte *) &tRef;
++	byte * pDst = (byte *) &uTmp;
++	for ( int i=0; i<(int)sizeof(T); i++ )
++		*pDst++ = *pSrc++;
++	return uTmp;
++}
++
++/// unaligned write wrapper for some architectures (eg. SPARC)
++template < typename T >
++void sphUnalignedWrite ( void * pPtr, const T & tVal )
++{
++	byte * pDst = (byte *) pPtr;
++	byte * pSrc = (byte *) &tVal;
++	for ( int i=0; i<(int)sizeof(T); i++ )
++		*pDst++ = *pSrc++;
++}
++
++#endif
++
++#if MYSQL_VERSION_ID>=50515
++
++#define sphinx_hash_init my_hash_init
++#define sphinx_hash_free my_hash_free
++#define sphinx_hash_search my_hash_search
++#define sphinx_hash_delete my_hash_delete
++
++#else
++
++#define sphinx_hash_init hash_init
++#define sphinx_hash_free hash_free
++#define sphinx_hash_search hash_search
++#define sphinx_hash_delete hash_delete
++
++#endif
++
++/////////////////////////////////////////////////////////////////////////////
++
++// FIXME! make this all dynamic
++#define SPHINXSE_MAX_FILTERS		32
++
++#define SPHINXAPI_DEFAULT_HOST		"127.0.0.1"
++#define SPHINXAPI_DEFAULT_PORT		9312
++#define SPHINXAPI_DEFAULT_INDEX		"*"
++
++#define SPHINXQL_DEFAULT_PORT		9306
++
++#define SPHINXSE_SYSTEM_COLUMNS		3
++
++#define SPHINXSE_MAX_ALLOC			(16*1024*1024)
++#define SPHINXSE_MAX_KEYWORDSTATS	4096
++
++#define SPHINXSE_VERSION			"0.9.9 ($Revision: 2752 $)"
++
++// FIXME? the following is cut-n-paste from sphinx.h and searchd.cpp
++// cut-n-paste is somewhat simpler that adding dependencies however..
++
++enum
++{
++	SPHINX_SEARCHD_PROTO	= 1,
++	SEARCHD_COMMAND_SEARCH	= 0,
++	VER_COMMAND_SEARCH		= 0x116,
++};
++
++/// search query sorting orders
++enum ESphSortOrder
++{
++	SPH_SORT_RELEVANCE		= 0,	///< sort by document relevance desc, then by date
++	SPH_SORT_ATTR_DESC		= 1,	///< sort by document date desc, then by relevance desc
++	SPH_SORT_ATTR_ASC		= 2,	///< sort by document date asc, then by relevance desc
++	SPH_SORT_TIME_SEGMENTS	= 3,	///< sort by time segments (hour/day/week/etc) desc, then by relevance desc
++	SPH_SORT_EXTENDED		= 4,	///< sort by SQL-like expression (eg. "@relevance DESC, price ASC, @id DESC")
++	SPH_SORT_EXPR			= 5,	///< sort by expression
++
++	SPH_SORT_TOTAL
++};
++
++/// search query matching mode
++enum ESphMatchMode
++{
++	SPH_MATCH_ALL = 0,			///< match all query words
++	SPH_MATCH_ANY,				///< match any query word
++	SPH_MATCH_PHRASE,			///< match this exact phrase
++	SPH_MATCH_BOOLEAN,			///< match this boolean query
++	SPH_MATCH_EXTENDED,			///< match this extended query
++	SPH_MATCH_FULLSCAN,			///< match all document IDs w/o fulltext query, apply filters
++	SPH_MATCH_EXTENDED2,		///< extended engine V2
++
++	SPH_MATCH_TOTAL
++};
++
++/// search query relevance ranking mode
++enum ESphRankMode
++{
++	SPH_RANK_PROXIMITY_BM25		= 0,	///< default mode, phrase proximity major factor and BM25 minor one
++	SPH_RANK_BM25				= 1,	///< statistical mode, BM25 ranking only (faster but worse quality)
++	SPH_RANK_NONE				= 2,	///< no ranking, all matches get a weight of 1
++	SPH_RANK_WORDCOUNT			= 3,	///< simple word-count weighting, rank is a weighted sum of per-field keyword occurence counts
++	SPH_RANK_PROXIMITY			= 4,	///< phrase proximity
++	SPH_RANK_MATCHANY			= 5,	///< emulate old match-any weighting
++	SPH_RANK_FIELDMASK			= 6,	///< sets bits where there were matches
++	SPH_RANK_SPH04				= 7,	///< codename SPH04, phrase proximity + bm25 + head/exact boost
++
++	SPH_RANK_TOTAL,
++	SPH_RANK_DEFAULT			= SPH_RANK_PROXIMITY_BM25
++};
++
++/// search query grouping mode
++enum ESphGroupBy
++{
++	SPH_GROUPBY_DAY		= 0,	///< group by day
++	SPH_GROUPBY_WEEK	= 1,	///< group by week
++	SPH_GROUPBY_MONTH	= 2,	///< group by month
++	SPH_GROUPBY_YEAR	= 3,	///< group by year
++	SPH_GROUPBY_ATTR	= 4		///< group by attribute value
++};
++
++/// known attribute types
++enum
++{
++	SPH_ATTR_NONE		= 0,			///< not an attribute at all
++	SPH_ATTR_INTEGER	= 1,			///< this attr is just an integer
++	SPH_ATTR_TIMESTAMP	= 2,			///< this attr is a timestamp
++	SPH_ATTR_ORDINAL	= 3,			///< this attr is an ordinal string number (integer at search time, specially handled at indexing time)
++	SPH_ATTR_BOOL		= 4,			///< this attr is a boolean bit field
++	SPH_ATTR_FLOAT		= 5,
++	SPH_ATTR_BIGINT		= 6,
++
++	SPH_ATTR_MULTI		= 0x40000000UL	///< this attr has multiple values (0 or more)
++};
++
++/// known answers
++enum
++{
++	SEARCHD_OK		= 0,	///< general success, command-specific reply follows
++	SEARCHD_ERROR	= 1,	///< general failure, error message follows
++	SEARCHD_RETRY	= 2,	///< temporary failure, error message follows, client should retry later
++	SEARCHD_WARNING	= 3		///< general success, warning message and command-specific reply follow
++};
++
++//////////////////////////////////////////////////////////////////////////////
++
++#define SPHINX_DEBUG_OUTPUT		0
++#define SPHINX_DEBUG_CALLS		0
++
++#include <stdarg.h>
++
++#if SPHINX_DEBUG_OUTPUT
++inline void SPH_DEBUG ( const char * format, ... )
++{
++	va_list ap;
++	va_start ( ap, format );
++	fprintf ( stderr, "SphinxSE: " );
++	vfprintf ( stderr, format, ap );
++	fprintf ( stderr, "\n" );
++	va_end ( ap );
++}
++#else
++inline void SPH_DEBUG ( const char *, ... ) {}
++#endif
++
++#if SPHINX_DEBUG_CALLS
++
++#define SPH_ENTER_FUNC() { SPH_DEBUG ( "enter %s", __FUNCTION__ ); }
++#define SPH_ENTER_METHOD() { SPH_DEBUG ( "enter %s(this=%08x)", __FUNCTION__, this ); }
++#define SPH_RET(_arg) { SPH_DEBUG ( "leave %s", __FUNCTION__ ); return _arg; }
++#define SPH_VOID_RET() { SPH_DEBUG ( "leave %s", __FUNCTION__ ); return; }
++
++#else
++
++#define SPH_ENTER_FUNC()
++#define SPH_ENTER_METHOD()
++#define SPH_RET(_arg) { return(_arg); }
++#define SPH_VOID_RET() { return; }
++
++#endif
++
++
++#define SafeDelete(_arg)		{ if ( _arg ) delete ( _arg );		(_arg) = NULL; }
++#define SafeDeleteArray(_arg)	{ if ( _arg ) delete [] ( _arg );	(_arg) = NULL; }
++
++//////////////////////////////////////////////////////////////////////////////
++
++/// per-table structure that will be shared among all open Sphinx SE handlers
++struct CSphSEShare
++{
++	pthread_mutex_t	m_tMutex;
++	THR_LOCK		m_tLock;
++
++	char *			m_sTable;
++	char *			m_sScheme;		///< our connection string
++	char *			m_sHost;		///< points into m_sScheme buffer, DO NOT FREE EXPLICITLY
++	char *			m_sSocket;		///< points into m_sScheme buffer, DO NOT FREE EXPLICITLY
++	char *			m_sIndex;		///< points into m_sScheme buffer, DO NOT FREE EXPLICITLY
++	ushort			m_iPort;
++	bool			m_bSphinxQL;	///< is this read-only SphinxAPI table, or write-only SphinxQL table?
++	uint			m_iTableNameLen;
++	uint			m_iUseCount;
++	CHARSET_INFO *	m_pTableQueryCharset;
++
++	int					m_iTableFields;
++	char **				m_sTableField;
++	enum_field_types *	m_eTableFieldType;
++
++	CSphSEShare ()
++		: m_sTable ( NULL )
++		, m_sScheme ( NULL )
++		, m_sHost ( NULL )
++		, m_sSocket ( NULL )
++		, m_sIndex ( NULL )
++		, m_iPort ( 0 )
++		, m_bSphinxQL ( false )
++		, m_iTableNameLen ( 0 )
++		, m_iUseCount ( 1 )
++		, m_pTableQueryCharset ( NULL )
++
++		, m_iTableFields ( 0 )
++		, m_sTableField ( NULL )
++		, m_eTableFieldType ( NULL )
++	{
++		thr_lock_init ( &m_tLock );
++		pthread_mutex_init ( &m_tMutex, MY_MUTEX_INIT_FAST );
++	}
++
++	~CSphSEShare ()
++	{
++		pthread_mutex_destroy ( &m_tMutex );
++		thr_lock_delete ( &m_tLock );
++
++		SafeDeleteArray ( m_sTable );
++		SafeDeleteArray ( m_sScheme );
++		ResetTable ();
++	}
++
++	void ResetTable ()
++	{
++		for ( int i=0; i<m_iTableFields; i++ )
++			SafeDeleteArray ( m_sTableField[i] );
++		SafeDeleteArray ( m_sTableField );
++		SafeDeleteArray ( m_eTableFieldType );
++	}
++};
++
++/// schema attribute
++struct CSphSEAttr
++{
++	char *			m_sName;		///< attribute name (received from Sphinx)
++	uint32			m_uType;		///< attribute type (received from Sphinx)
++	int				m_iField;		///< field index in current table (-1 if none)
++
++	CSphSEAttr()
++		: m_sName ( NULL )
++		, m_uType ( SPH_ATTR_NONE )
++		, m_iField ( -1 )
++	{}
++
++	~CSphSEAttr ()
++	{
++		SafeDeleteArray ( m_sName );
++	}
++};
++
++/// word stats
++struct CSphSEWordStats
++{
++	char *			m_sWord;
++	int				m_iDocs;
++	int				m_iHits;
++
++	CSphSEWordStats ()
++		: m_sWord ( NULL )
++		, m_iDocs ( 0 )
++		, m_iHits ( 0 )
++	{}
++
++	~CSphSEWordStats ()
++	{
++		SafeDeleteArray ( m_sWord );
++	}
++};
++
++/// request stats
++struct CSphSEStats
++{
++public:
++	int					m_iMatchesTotal;
++	int					m_iMatchesFound;
++	int					m_iQueryMsec;
++	int					m_iWords;
++	CSphSEWordStats *	m_dWords;
++	bool				m_bLastError;
++	char				m_sLastMessage[1024];
++
++	CSphSEStats()
++		: m_dWords ( NULL )
++	{
++		Reset ();
++	}
++
++	void Reset ()
++	{
++		m_iMatchesTotal = 0;
++		m_iMatchesFound = 0;
++		m_iQueryMsec = 0;
++		m_iWords = 0;
++		SafeDeleteArray ( m_dWords );
++		m_bLastError = false;
++		m_sLastMessage[0] = '\0';
++	}
++
++	~CSphSEStats()
++	{
++		Reset ();
++	}
++};
++
++/// thread local storage
++struct CSphSEThreadData
++{
++	static const int	MAX_QUERY_LEN	= 262144; // 256k should be enough, right?
++
++	bool				m_bStats;
++	CSphSEStats			m_tStats;
++
++	bool				m_bQuery;
++	char				m_sQuery[MAX_QUERY_LEN];
++
++	CHARSET_INFO *		m_pQueryCharset;
++
++	bool				m_bReplace;		///< are we doing an INSERT or REPLACE
++
++	bool				m_bCondId;		///< got a value from condition pushdown
++	longlong			m_iCondId;		///< value acquired from id=value condition pushdown
++	bool				m_bCondDone;	///< index_read() is now over
++
++	CSphSEThreadData ()
++		: m_bStats ( false )
++		, m_bQuery ( false )
++		, m_pQueryCharset ( NULL )
++		, m_bReplace ( false )
++		, m_bCondId ( false )
++		, m_iCondId ( 0 )
++		, m_bCondDone ( false )
++	{}
++};
++
++/// filter types
++enum ESphFilter
++{
++	SPH_FILTER_VALUES		= 0,	///< filter by integer values set
++	SPH_FILTER_RANGE		= 1,	///< filter by integer range
++	SPH_FILTER_FLOATRANGE	= 2		///< filter by float range
++};
++
++
++/// search query filter
++struct CSphSEFilter
++{
++public:
++	ESphFilter		m_eType;
++	char *			m_sAttrName;
++	longlong		m_uMinValue;
++	longlong		m_uMaxValue;
++	float			m_fMinValue;
++	float			m_fMaxValue;
++	int				m_iValues;
++	longlong *		m_pValues;
++	int				m_bExclude;
++
++public:
++	CSphSEFilter ()
++		: m_eType ( SPH_FILTER_VALUES )
++		, m_sAttrName ( NULL )
++		, m_uMinValue ( 0 )
++		, m_uMaxValue ( UINT_MAX )
++		, m_fMinValue ( 0.0f )
++		, m_fMaxValue ( 0.0f )
++		, m_iValues ( 0 )
++		, m_pValues ( NULL )
++		, m_bExclude ( 0 )
++	{
++	}
++
++	~CSphSEFilter ()
++	{
++		SafeDeleteArray ( m_pValues );
++	}
++};
++
++
++/// float vs dword conversion
++inline uint32 sphF2DW ( float f )	{ union { float f; uint32 d; } u; u.f = f; return u.d; }
++
++/// dword vs float conversion
++inline float sphDW2F ( uint32 d )	{ union { float f; uint32 d; } u; u.d = d; return u.f; }
++
++
++/// client-side search query
++struct CSphSEQuery
++{
++public:
++	const char *	m_sHost;
++	int				m_iPort;
++
++private:
++	char *			m_sQueryBuffer;
++
++	const char *	m_sIndex;
++	int				m_iOffset;
++	int				m_iLimit;
++
++	bool			m_bQuery;
++	char *			m_sQuery;
++	uint32 *		m_pWeights;
++	int				m_iWeights;
++	ESphMatchMode	m_eMode;
++	ESphRankMode	m_eRanker;
++	ESphSortOrder	m_eSort;
++	char *			m_sSortBy;
++	int				m_iMaxMatches;
++	int				m_iMaxQueryTime;
++	uint32			m_iMinID;
++	uint32			m_iMaxID;
++
++	int				m_iFilters;
++	CSphSEFilter	m_dFilters[SPHINXSE_MAX_FILTERS];
++
++	ESphGroupBy		m_eGroupFunc;
++	char *			m_sGroupBy;
++	char *			m_sGroupSortBy;
++	int				m_iCutoff;
++	int				m_iRetryCount;
++	int				m_iRetryDelay;
++	char *			m_sGroupDistinct;							///< points to query buffer; do NOT delete
++	int				m_iIndexWeights;
++	char *			m_sIndexWeight[SPHINXSE_MAX_FILTERS];		///< points to query buffer; do NOT delete
++	int				m_iIndexWeight[SPHINXSE_MAX_FILTERS];
++	int				m_iFieldWeights;
++	char *			m_sFieldWeight[SPHINXSE_MAX_FILTERS];		///< points to query buffer; do NOT delete
++	int				m_iFieldWeight[SPHINXSE_MAX_FILTERS];
++
++	bool			m_bGeoAnchor;
++	char *			m_sGeoLatAttr;
++	char *			m_sGeoLongAttr;
++	float			m_fGeoLatitude;
++	float			m_fGeoLongitude;
++
++	char *			m_sComment;
++	char *			m_sSelect;
++
++	struct Override_t
++	{
++		union Value_t
++		{
++			uint32		m_uValue;
++			longlong	m_iValue64;
++			float		m_fValue;
++		};
++		char *						m_sName; ///< points to query buffer
++		int							m_iType;
++		Dynamic_array<ulonglong>	m_dIds;
++		Dynamic_array<Value_t>		m_dValues;
++	};
++	Dynamic_array<Override_t *> m_dOverrides;
++
++public:
++	char			m_sParseError[256];
++
++public:
++	CSphSEQuery ( const char * sQuery, int iLength, const char * sIndex );
++	~CSphSEQuery ();
++
++	bool			Parse ();
++	int				BuildRequest ( char ** ppBuffer );
++
++protected:
++	char *			m_pBuf;
++	char *			m_pCur;
++	int				m_iBufLeft;
++	bool			m_bBufOverrun;
++
++	template < typename T > int ParseArray ( T ** ppValues, const char * sValue );
++	bool			ParseField ( char * sField );
++
++	void			SendBytes ( const void * pBytes, int iBytes );
++	void			SendWord ( short int v )		{ v = ntohs(v); SendBytes ( &v, sizeof(v) ); }
++	void			SendInt ( int v )				{ v = ntohl(v); SendBytes ( &v, sizeof(v) ); }
++	void			SendDword ( uint v )			{ v = ntohl(v) ;SendBytes ( &v, sizeof(v) ); }
++	void			SendUint64 ( ulonglong v )		{ SendDword ( (uint)(v>>32) ); SendDword ( (uint)(v&0xFFFFFFFFUL) ); }
++	void			SendString ( const char * v )	{ int iLen = strlen(v); SendDword(iLen); SendBytes ( v, iLen ); }
++	void			SendFloat ( float v )			{ SendDword ( sphF2DW(v) ); }
++};
++
++template int CSphSEQuery::ParseArray<uint32> ( uint32 **, const char * );
++template int CSphSEQuery::ParseArray<longlong> ( longlong **, const char * );
++
++//////////////////////////////////////////////////////////////////////////////
++
++#if MYSQL_VERSION_ID>50100
++
++#if MYSQL_VERSION_ID<50114
++#error Sphinx SE requires MySQL 5.1.14 or higher if compiling for 5.1.x series!
++#endif
++
++static handler *	sphinx_create_handler ( handlerton * hton, TABLE_SHARE * table, MEM_ROOT * mem_root );
++static int			sphinx_init_func ( void * p );
++static int			sphinx_close_connection ( handlerton * hton, THD * thd );
++static int			sphinx_panic ( handlerton * hton, enum ha_panic_function flag );
++static bool			sphinx_show_status ( handlerton * hton, THD * thd, stat_print_fn * stat_print, enum ha_stat_type stat_type );
++
++#else
++
++static bool			sphinx_init_func_for_handlerton ();
++static int			sphinx_close_connection ( THD * thd );
++bool				sphinx_show_status ( THD * thd );
++
++#endif // >50100
++
++//////////////////////////////////////////////////////////////////////////////
++
++static const char	sphinx_hton_name[]		= "SPHINX";
++static const char	sphinx_hton_comment[]	= "Sphinx storage engine " SPHINXSE_VERSION;
++
++#if MYSQL_VERSION_ID<50100
++handlerton sphinx_hton =
++{
++	#ifdef MYSQL_HANDLERTON_INTERFACE_VERSION
++	MYSQL_HANDLERTON_INTERFACE_VERSION,
++	#endif
++	sphinx_hton_name,
++	SHOW_OPTION_YES,
++	sphinx_hton_comment,
++	DB_TYPE_SPHINX_DB,
++	sphinx_init_func_for_handlerton,
++	0,							// slot
++	0,							// savepoint size
++	sphinx_close_connection,	// close_connection
++	NULL,	// savepoint
++	NULL,	// rollback to savepoint
++	NULL,	// release savepoint
++	NULL,	// commit
++	NULL,	// rollback
++	NULL,	// prepare
++	NULL,	// recover
++	NULL,	// commit_by_xid
++	NULL,	// rollback_by_xid
++	NULL,	// create_cursor_read_view
++	NULL,	// set_cursor_read_view
++	NULL,	// close_cursor_read_view
++	HTON_CAN_RECREATE
++};
++#else
++static handlerton * sphinx_hton_ptr = NULL;
++#endif
++
++//////////////////////////////////////////////////////////////////////////////
++
++// variables for Sphinx shared methods
++pthread_mutex_t		sphinx_mutex;		// mutex to init the hash
++static int			sphinx_init = 0;	// flag whether the hash was initialized
++static HASH			sphinx_open_tables;	// hash used to track open tables
++
++//////////////////////////////////////////////////////////////////////////////
++// INITIALIZATION AND SHUTDOWN
++//////////////////////////////////////////////////////////////////////////////
++
++// hashing function
++#if MYSQL_VERSION_ID>=50120
++typedef size_t GetKeyLength_t;
++#else
++typedef uint GetKeyLength_t;
++#endif
++
++static byte * sphinx_get_key ( const byte * pSharePtr, GetKeyLength_t * pLength, my_bool )
++{
++	CSphSEShare * pShare = (CSphSEShare *) pSharePtr;
++	*pLength = (size_t) pShare->m_iTableNameLen;
++	return (byte*) pShare->m_sTable;
++}
++
++#if MYSQL_VERSION_ID<50100
++static int sphinx_init_func ( void * ) // to avoid unused arg warning
++#else
++static int sphinx_init_func ( void * p )
++#endif
++{
++	SPH_ENTER_FUNC();
++	if ( !sphinx_init )
++	{
++		sphinx_init = 1;
++		void ( pthread_mutex_init ( &sphinx_mutex, MY_MUTEX_INIT_FAST ) );
++		sphinx_hash_init ( &sphinx_open_tables, system_charset_info, 32, 0, 0,
++			sphinx_get_key, 0, 0 );
++
++		#if MYSQL_VERSION_ID > 50100
++		handlerton * hton = (handlerton*) p;
++		hton->state = SHOW_OPTION_YES;
++		hton->db_type = DB_TYPE_FIRST_DYNAMIC;
++		hton->create = sphinx_create_handler;
++		hton->close_connection = sphinx_close_connection;
++		hton->show_status = sphinx_show_status;
++		hton->panic = sphinx_panic;
++		hton->flags = HTON_CAN_RECREATE;
++		#endif
++	}
++	SPH_RET(0);
++}
++
++
++#if MYSQL_VERSION_ID<50100
++static bool sphinx_init_func_for_handlerton ()
++{
++	return sphinx_init_func ( &sphinx_hton );
++}
++#endif
++
++
++#if MYSQL_VERSION_ID>50100
++
++static int sphinx_close_connection ( handlerton * hton, THD * thd )
++{
++	// deallocate common handler data
++	SPH_ENTER_FUNC();
++	void ** tmp = thd_ha_data ( thd, hton );
++	CSphSEThreadData * pTls = (CSphSEThreadData*) (*tmp);
++	SafeDelete ( pTls );
++	*tmp = NULL;
++	SPH_RET(0);
++}
++
++
++static int sphinx_done_func ( void * )
++{
++	SPH_ENTER_FUNC();
++
++	int error = 0;
++	if ( sphinx_init )
++	{
++		sphinx_init = 0;
++		if ( sphinx_open_tables.records )
++			error = 1;
++		sphinx_hash_free ( &sphinx_open_tables );
++		pthread_mutex_destroy ( &sphinx_mutex );
++	}
++
++	SPH_RET(0);
++}
++
++
++static int sphinx_panic ( handlerton * hton, enum ha_panic_function )
++{
++	return sphinx_done_func ( hton );
++}
++
++#else
++
++static int sphinx_close_connection ( THD * thd )
++{
++	// deallocate common handler data
++	SPH_ENTER_FUNC();
++	CSphSEThreadData * pTls = (CSphSEThreadData*) thd->ha_data[sphinx_hton.slot];
++	SafeDelete ( pTls );
++	thd->ha_data[sphinx_hton.slot] = NULL;
++	SPH_RET(0);
++}
++
++#endif // >50100
++
++//////////////////////////////////////////////////////////////////////////////
++// SHOW STATUS
++//////////////////////////////////////////////////////////////////////////////
++
++#if MYSQL_VERSION_ID>50100
++static bool sphinx_show_status ( handlerton * hton, THD * thd, stat_print_fn * stat_print,
++	enum ha_stat_type )
++#else
++bool sphinx_show_status ( THD * thd )
++#endif
++{
++	SPH_ENTER_FUNC();
++
++#if MYSQL_VERSION_ID<50100
++	Protocol * protocol = thd->protocol;
++	List<Item> field_list;
++#endif
++
++	char buf1[IO_SIZE];
++	uint buf1len;
++	char buf2[IO_SIZE];
++	uint buf2len = 0;
++	String words;
++
++	buf1[0] = '\0';
++	buf2[0] = '\0';
++
++
++#if MYSQL_VERSION_ID>50100
++	// 5.1.x style stats
++	CSphSEThreadData * pTls = (CSphSEThreadData*) ( *thd_ha_data ( thd, hton ) );
++
++#define LOC_STATS(_key,_keylen,_val,_vallen) \
++	stat_print ( thd, sphinx_hton_name, strlen(sphinx_hton_name), _key, _keylen, _val, _vallen );
++
++#else
++	// 5.0.x style stats
++	if ( have_sphinx_db!=SHOW_OPTION_YES )
++	{
++		my_message ( ER_NOT_SUPPORTED_YET,
++			"failed to call SHOW SPHINX STATUS: --skip-sphinx was specified",
++			MYF(0) );
++		SPH_RET(TRUE);
++	}
++	CSphSEThreadData * pTls = (CSphSEThreadData*) thd->ha_data[sphinx_hton.slot];
++
++	field_list.push_back ( new Item_empty_string ( "Type", 10 ) );
++	field_list.push_back ( new Item_empty_string ( "Name", FN_REFLEN ) );
++	field_list.push_back ( new Item_empty_string ( "Status", 10 ) );
++	if ( protocol->send_fields ( &field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF ) )
++		SPH_RET(TRUE);
++
++#define LOC_STATS(_key,_keylen,_val,_vallen) \
++	protocol->prepare_for_resend (); \
++	protocol->store ( "SPHINX", 6, system_charset_info ); \
++	protocol->store ( _key, _keylen, system_charset_info ); \
++	protocol->store ( _val, _vallen, system_charset_info ); \
++	if ( protocol->write() ) \
++		SPH_RET(TRUE);
++
++#endif
++
++
++	// show query stats
++	if ( pTls && pTls->m_bStats )
++	{
++		const CSphSEStats * pStats = &pTls->m_tStats;
++		buf1len = my_snprintf ( buf1, sizeof(buf1),
++			"total: %d, total found: %d, time: %d, words: %d",
++			pStats->m_iMatchesTotal, pStats->m_iMatchesFound, pStats->m_iQueryMsec, pStats->m_iWords );
++
++		LOC_STATS ( "stats", 5, buf1, buf1len );
++
++		if ( pStats->m_iWords )
++		{
++			for ( int i=0; i<pStats->m_iWords; i++ )
++			{
++				CSphSEWordStats & tWord = pStats->m_dWords[i];
++				buf2len = my_snprintf ( buf2, sizeof(buf2), "%s%s:%d:%d ",
++					buf2, tWord.m_sWord, tWord.m_iDocs, tWord.m_iHits );
++			}
++
++			// convert it if we can
++			const char * sWord = buf2;
++			int iWord = buf2len;
++
++			String sBuf3;
++			if ( pTls->m_pQueryCharset )
++			{
++				uint iErrors;
++				sBuf3.copy ( buf2, buf2len, pTls->m_pQueryCharset, system_charset_info, &iErrors );
++				sWord = sBuf3.c_ptr();
++				iWord = sBuf3.length();
++			}
++
++			LOC_STATS ( "words", 5, sWord, iWord );
++		}
++	}
++
++	// show last error or warning (either in addition to stats, or on their own)
++	if ( pTls && pTls->m_tStats.m_sLastMessage && pTls->m_tStats.m_sLastMessage[0] )
++	{
++		const char * sMessageType = pTls->m_tStats.m_bLastError ? "error" : "warning";
++
++		LOC_STATS (
++			sMessageType, strlen ( sMessageType ),
++			pTls->m_tStats.m_sLastMessage, strlen ( pTls->m_tStats.m_sLastMessage ) );
++
++	} else
++	{
++		// well, nothing to show just yet
++#if MYSQL_VERSION_ID < 50100
++		LOC_STATS ( "stats", 5, "no query has been executed yet", sizeof("no query has been executed yet")-1 );
++#endif
++	}
++
++#if MYSQL_VERSION_ID < 50100
++	send_eof(thd);
++#endif
++
++	SPH_RET(FALSE);
++}
++
++//////////////////////////////////////////////////////////////////////////////
++// HELPERS
++//////////////////////////////////////////////////////////////////////////////
++
++static char * sphDup ( const char * sSrc, int iLen=-1 )
++{
++	if ( !sSrc )
++		return NULL;
++
++	if ( iLen<0 )
++		iLen = strlen(sSrc);
++
++	char * sRes = new char [ 1+iLen ];
++	memcpy ( sRes, sSrc, iLen );
++	sRes[iLen] = '\0';
++	return sRes;
++}
++
++
++static void sphLogError ( const char * sFmt, ... )
++{
++	// emit timestamp
++#ifdef __WIN__
++	SYSTEMTIME t;
++	GetLocalTime ( &t );
++
++	fprintf ( stderr, "%02d%02d%02d %2d:%02d:%02d SphinxSE: internal error: ",
++		(int)t.wYear % 100, (int)t.wMonth, (int)t.wDay,
++		(int)t.wHour, (int)t.wMinute, (int)t.wSecond );
++#else
++	// Unix version
++	time_t tStamp;
++	time ( &tStamp );
++
++	struct tm * pParsed;
++#ifdef HAVE_LOCALTIME_R
++	struct tm tParsed;
++	localtime_r ( &tStamp, &tParsed );
++	pParsed = &tParsed;
++#else
++	pParsed = localtime ( &tStamp );
++#endif // HAVE_LOCALTIME_R
++
++	fprintf ( stderr, "%02d%02d%02d %2d:%02d:%02d SphinxSE: internal error: ",
++		pParsed->tm_year % 100, pParsed->tm_mon + 1, pParsed->tm_mday,
++		pParsed->tm_hour, pParsed->tm_min, pParsed->tm_sec);
++#endif // __WIN__
++
++	// emit message
++	va_list ap;
++	va_start ( ap, sFmt );
++	vfprintf ( stderr, sFmt, ap );
++	va_end ( ap );
++
++	// emit newline
++	fprintf ( stderr, "\n" );
++}
++
++
++
++// the following scheme variants are recognized
++//
++// sphinx://host[:port]/index
++// sphinxql://host[:port]/index
++// unix://unix/domain/socket[:index]
++static bool ParseUrl ( CSphSEShare * share, TABLE * table, bool bCreate )
++{
++	SPH_ENTER_FUNC();
++
++	if ( share )
++	{
++		// check incoming stuff
++		if ( !table )
++		{
++			sphLogError ( "table==NULL in ParseUrl()" );
++			return false;
++		}
++		if ( !table->s )
++		{
++			sphLogError ( "(table->s)==NULL in ParseUrl()" );
++			return false;
++		}
++
++		// free old stuff
++		share->ResetTable ();
++
++		// fill new stuff
++		share->m_iTableFields = table->s->fields;
++		if ( share->m_iTableFields )
++		{
++			share->m_sTableField = new char * [ share->m_iTableFields ];
++			share->m_eTableFieldType = new enum_field_types [ share->m_iTableFields ];
++
++			for ( int i=0; i<share->m_iTableFields; i++ )
++			{
++				share->m_sTableField[i] = sphDup ( table->field[i]->field_name );
++				share->m_eTableFieldType[i] = table->field[i]->type();
++			}
++		}
++	}
++
++	// defaults
++	bool bOk = true;
++	bool bQL = false;
++	char * sScheme = NULL;
++	char * sHost = SPHINXAPI_DEFAULT_HOST;
++	char * sIndex = SPHINXAPI_DEFAULT_INDEX;
++	int iPort = SPHINXAPI_DEFAULT_PORT;
++
++	// parse connection string, if any
++	while ( table->s->connect_string.length!=0 )
++	{
++		sScheme = sphDup ( table->s->connect_string.str, table->s->connect_string.length );
++
++		sHost = strstr ( sScheme, "://" );
++		if ( !sHost )
++		{
++			bOk = false;
++			break;
++		}
++		sHost[0] = '\0';
++		sHost += 3;
++
++		/////////////////////////////
++		// sphinxapi via unix socket
++		/////////////////////////////
++
++		if ( !strcmp ( sScheme, "unix" ) )
++		{
++			sHost--; // reuse last slash
++			iPort = 0;
++			if (!( sIndex = strrchr ( sHost, ':' ) ))
++				sIndex = SPHINXAPI_DEFAULT_INDEX;
++			else
++			{
++				*sIndex++ = '\0';
++				if ( !*sIndex )
++					sIndex = SPHINXAPI_DEFAULT_INDEX;
++			}
++			bOk = true;
++			break;
++		}
++
++		/////////////////////
++		// sphinxapi via tcp
++		/////////////////////
++
++		if ( !strcmp ( sScheme, "sphinx" ) )
++		{
++			char * sPort = strchr ( sHost, ':' );
++			if ( sPort )
++			{
++				*sPort++ = '\0';
++				if ( *sPort )
++				{
++					sIndex = strchr ( sPort, '/' );
++					if ( sIndex )
++						*sIndex++ = '\0';
++					else
++						sIndex = SPHINXAPI_DEFAULT_INDEX;
++
++					iPort = atoi(sPort);
++					if ( !iPort )
++						iPort = SPHINXAPI_DEFAULT_PORT;
++				}
++			} else
++			{
++				sIndex = strchr ( sHost, '/' );
++				if ( sIndex )
++					*sIndex++ = '\0';
++				else
++					sIndex = SPHINXAPI_DEFAULT_INDEX;
++			}
++			bOk = true;
++			break;
++		}
++
++		////////////
++		// sphinxql
++		////////////
++
++		if ( !strcmp ( sScheme, "sphinxql" ) )
++		{
++			bQL = true;
++			iPort = SPHINXQL_DEFAULT_PORT;
++
++			// handle port
++			char * sPort = strchr ( sHost, ':' );
++			sIndex = sHost; // starting point for index name search
++
++			if ( sPort )
++			{
++				*sPort++ = '\0';
++				sIndex = sPort;
++
++				iPort = atoi(sPort);
++				if ( !iPort )
++				{
++					bOk = false; // invalid port; can report ER_FOREIGN_DATA_STRING_INVALID
++					break;
++				}
++			}
++
++			// find index
++			sIndex = strchr ( sIndex, '/' );
++			if ( sIndex )
++				*sIndex++ = '\0';
++
++			// final checks
++			// host and index names are required
++			bOk = ( sHost && *sHost && sIndex && *sIndex );
++			break;
++		}
++
++		// unknown case
++		bOk = false;
++		break;
++	}
++
++	if ( !bOk )
++	{
++		my_error ( bCreate ? ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE : ER_FOREIGN_DATA_STRING_INVALID,
++			MYF(0), table->s->connect_string );
++	} else
++	{
++		if ( share )
++		{
++			SafeDeleteArray ( share->m_sScheme );
++			share->m_sScheme = sScheme;
++			share->m_sHost = sHost;
++			share->m_sIndex = sIndex;
++			share->m_iPort = (ushort)iPort;
++			share->m_bSphinxQL = bQL;
++		}
++	}
++	if ( !bOk && !share )
++		SafeDeleteArray ( sScheme );
++
++	SPH_RET(bOk);
++}
++
++
++// Example of simple lock controls. The "share" it creates is structure we will
++// pass to each sphinx handler. Do you have to have one of these? Well, you have
++// pieces that are used for locking, and they are needed to function.
++static CSphSEShare * get_share ( const char * table_name, TABLE * table )
++{
++	SPH_ENTER_FUNC();
++	pthread_mutex_lock ( &sphinx_mutex );
++
++	CSphSEShare * pShare = NULL;
++	for ( ;; )
++	{
++		// check if we already have this share
++#if MYSQL_VERSION_ID>=50120
++		pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, (const uchar *) table_name, strlen(table_name) );
++#else
++#ifdef __WIN__
++		pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, (const byte *) table_name, strlen(table_name) );
++#else
++		pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, table_name, strlen(table_name) );
++#endif // win
++#endif // pre-5.1.20
++
++		if ( pShare )
++		{
++			pShare->m_iUseCount++;
++			break;
++		}
++
++		// try to allocate new share
++		pShare = new CSphSEShare ();
++		if ( !pShare )
++			break;
++
++		// try to setup it
++		if ( !ParseUrl ( pShare, table, false ) )
++		{
++			SafeDelete ( pShare );
++			break;
++		}
++
++		if ( !pShare->m_bSphinxQL )
++			pShare->m_pTableQueryCharset = table->field[2]->charset();
++
++		// try to hash it
++		pShare->m_iTableNameLen = strlen(table_name);
++		pShare->m_sTable = sphDup ( table_name );
++		if ( my_hash_insert ( &sphinx_open_tables, (const byte *)pShare ) )
++		{
++			SafeDelete ( pShare );
++			break;
++		}
++
++		// all seems fine
++		break;
++	}
++
++	pthread_mutex_unlock ( &sphinx_mutex );
++	SPH_RET(pShare);
++}
++
++
++// Free lock controls. We call this whenever we close a table. If the table had
++// the last reference to the share then we free memory associated with it.
++static int free_share ( CSphSEShare * pShare )
++{
++	SPH_ENTER_FUNC();
++	pthread_mutex_lock ( &sphinx_mutex );
++
++	if ( !--pShare->m_iUseCount )
++	{
++		sphinx_hash_delete ( &sphinx_open_tables, (byte *)pShare );
++		SafeDelete ( pShare );
++	}
++
++	pthread_mutex_unlock ( &sphinx_mutex );
++	SPH_RET(0);
++}
++
++
++#if MYSQL_VERSION_ID>50100
++static handler * sphinx_create_handler ( handlerton * hton, TABLE_SHARE * table, MEM_ROOT * mem_root )
++{
++	sphinx_hton_ptr = hton;
++	return new ( mem_root ) ha_sphinx ( hton, table );
++}
++#endif
++
++//////////////////////////////////////////////////////////////////////////////
++// CLIENT-SIDE REQUEST STUFF
++//////////////////////////////////////////////////////////////////////////////
++
++CSphSEQuery::CSphSEQuery ( const char * sQuery, int iLength, const char * sIndex )
++	: m_sHost ( "" )
++	, m_iPort ( 0 )
++	, m_sIndex ( sIndex ? sIndex : "*" )
++	, m_iOffset ( 0 )
++	, m_iLimit ( 20 )
++	, m_bQuery ( false )
++	, m_sQuery ( "" )
++	, m_pWeights ( NULL )
++	, m_iWeights ( 0 )
++	, m_eMode ( SPH_MATCH_ALL )
++	, m_eRanker ( SPH_RANK_PROXIMITY_BM25 )
++	, m_eSort ( SPH_SORT_RELEVANCE )
++	, m_sSortBy ( "" )
++	, m_iMaxMatches ( 1000 )
++	, m_iMaxQueryTime ( 0 )
++	, m_iMinID ( 0 )
++	, m_iMaxID ( 0 )
++	, m_iFilters ( 0 )
++	, m_eGroupFunc ( SPH_GROUPBY_DAY )
++	, m_sGroupBy ( "" )
++	, m_sGroupSortBy ( "@group desc" )
++	, m_iCutoff ( 0 )
++	, m_iRetryCount ( 0 )
++	, m_iRetryDelay ( 0 )
++	, m_sGroupDistinct ( "" )
++	, m_iIndexWeights ( 0 )
++	, m_iFieldWeights ( 0 )
++	, m_bGeoAnchor ( false )
++	, m_sGeoLatAttr ( "" )
++	, m_sGeoLongAttr ( "" )
++	, m_fGeoLatitude ( 0.0f )
++	, m_fGeoLongitude ( 0.0f )
++	, m_sComment ( "" )
++	, m_sSelect ( "" )
++
++	, m_pBuf ( NULL )
++	, m_pCur ( NULL )
++	, m_iBufLeft ( 0 )
++	, m_bBufOverrun ( false )
++{
++	m_sQueryBuffer = new char [ iLength+2 ];
++	memcpy ( m_sQueryBuffer, sQuery, iLength );
++	m_sQueryBuffer[iLength] = ';';
++	m_sQueryBuffer[iLength+1] = '\0';
++}
++
++
++CSphSEQuery::~CSphSEQuery ()
++{
++	SPH_ENTER_METHOD();
++	SafeDeleteArray ( m_sQueryBuffer );
++	SafeDeleteArray ( m_pWeights );
++	SafeDeleteArray ( m_pBuf );
++	for ( int i=0; i<m_dOverrides.elements(); i++ )
++		SafeDelete ( m_dOverrides.at(i) );
++	SPH_VOID_RET();
++}
++
++
++template < typename T >
++int CSphSEQuery::ParseArray ( T ** ppValues, const char * sValue )
++{
++	SPH_ENTER_METHOD();
++
++	assert ( ppValues );
++	assert ( !(*ppValues) );
++
++	const char * pValue;
++	bool bPrevDigit = false;
++	int iValues = 0;
++
++	// count the values
++	for ( pValue=sValue; *pValue; pValue++ )
++	{
++		bool bDigit = (*pValue)>='0' && (*pValue)<='9';
++		if ( bDigit && !bPrevDigit )
++			iValues++;
++		bPrevDigit = bDigit;
++	}
++	if ( !iValues )
++		SPH_RET(0);
++
++	// extract the values
++	T * pValues = new T [ iValues ];
++	*ppValues = pValues;
++
++	int iIndex = 0, iSign = 1;
++	T uValue = 0;
++
++	bPrevDigit = false;
++	for ( pValue=sValue ;; pValue++ )
++	{
++		bool bDigit = (*pValue)>='0' && (*pValue)<='9';
++
++		if ( bDigit )
++		{
++			if ( !bPrevDigit )
++				uValue = 0;
++			uValue = uValue*10 + ( (*pValue)-'0' );
++		} else if ( bPrevDigit )
++		{
++			assert ( iIndex<iValues );
++			pValues [ iIndex++ ] = uValue * iSign;
++			iSign = 1;
++		} else if ( *pValue=='-' )
++			iSign = -1;
++
++		bPrevDigit = bDigit;
++		if ( !*pValue )
++			break;
++	}
++
++	SPH_RET ( iValues );
++}
++
++
++static char * chop ( char * s )
++{
++	while ( *s && isspace(*s) )
++		s++;
++
++	char * p = s + strlen(s);
++	while ( p>s && isspace ( p[-1] ) )
++		p--;
++	*p = '\0';
++
++	return s;
++}
++
++
++static bool myisattr ( char c )
++{
++	return
++		( c>='0' && c<='9' ) ||
++		( c>='a' && c<='z' ) ||
++		( c>='A' && c<='Z' ) ||
++		c=='_';
++}
++
++
++bool CSphSEQuery::ParseField ( char * sField )
++{
++	SPH_ENTER_METHOD();
++
++	// look for option name/value separator
++	char * sValue = strchr ( sField, '=' );
++	if ( !sValue || sValue==sField || sValue[-1]=='\\' )
++	{
++		// by default let's assume it's just query
++		if ( sField[0] )
++		{
++			if ( m_bQuery )
++			{
++				snprintf ( m_sParseError, sizeof(m_sParseError), "search query already specified; '%s' is redundant", sField );
++				SPH_RET(false);
++			} else
++			{
++				m_sQuery = sField;
++				m_bQuery = true;
++
++				// unescape only 1st one
++				char *s = sField, *d = sField;
++				int iSlashes = 0;
++				while ( *s )
++				{
++					iSlashes = ( *s=='\\' ) ? iSlashes+1 : 0;
++					if ( ( iSlashes%2 )==0 ) *d++ = *s;
++					s++;
++				}
++				*d = '\0';
++			}
++		}
++		SPH_RET(true);
++	}
++
++	// split
++	*sValue++ = '\0';
++	sValue = chop ( sValue );
++	int iValue = atoi ( sValue );
++
++	// handle options
++	char * sName = chop ( sField );
++
++	if ( !strcmp ( sName, "query" ) )			m_sQuery = sValue;
++	else if ( !strcmp ( sName, "host" ) )		m_sHost = sValue;
++	else if ( !strcmp ( sName, "port" ) )		m_iPort = iValue;
++	else if ( !strcmp ( sName, "index" ) )		m_sIndex = sValue;
++	else if ( !strcmp ( sName, "offset" ) )		m_iOffset = iValue;
++	else if ( !strcmp ( sName, "limit" ) )		m_iLimit = iValue;
++	else if ( !strcmp ( sName, "weights" ) )	m_iWeights = ParseArray<uint32> ( &m_pWeights, sValue );
++	else if ( !strcmp ( sName, "minid" ) )		m_iMinID = iValue;
++	else if ( !strcmp ( sName, "maxid" ) )		m_iMaxID = iValue;
++	else if ( !strcmp ( sName, "maxmatches" ) )	m_iMaxMatches = iValue;
++	else if ( !strcmp ( sName, "maxquerytime" ) )	m_iMaxQueryTime = iValue;
++	else if ( !strcmp ( sName, "groupsort" ) )	m_sGroupSortBy = sValue;
++	else if ( !strcmp ( sName, "distinct" ) )	m_sGroupDistinct = sValue;
++	else if ( !strcmp ( sName, "cutoff" ) )		m_iCutoff = iValue;
++	else if ( !strcmp ( sName, "comment" ) )	m_sComment = sValue;
++	else if ( !strcmp ( sName, "select" ) )		m_sSelect = sValue;
++
++	else if ( !strcmp ( sName, "mode" ) )
++	{
++		m_eMode = SPH_MATCH_ALL;
++		if ( !strcmp ( sValue, "any" ) )			m_eMode = SPH_MATCH_ANY;
++		else if ( !strcmp ( sValue, "phrase" ) )	m_eMode = SPH_MATCH_PHRASE;
++		else if ( !strcmp ( sValue, "boolean" ) )	m_eMode = SPH_MATCH_BOOLEAN;
++		else if ( !strcmp ( sValue, "ext" ) )		m_eMode = SPH_MATCH_EXTENDED;
++		else if ( !strcmp ( sValue, "extended" ) )	m_eMode = SPH_MATCH_EXTENDED;
++		else if ( !strcmp ( sValue, "ext2" ) )		m_eMode = SPH_MATCH_EXTENDED2;
++		else if ( !strcmp ( sValue, "extended2" ) )	m_eMode = SPH_MATCH_EXTENDED2;
++		else if ( !strcmp ( sValue, "all" ) )		m_eMode = SPH_MATCH_ALL;
++		else if ( !strcmp ( sValue, "fullscan" ) )	m_eMode = SPH_MATCH_FULLSCAN;
++		else
++		{
++			snprintf ( m_sParseError, sizeof(m_sParseError), "unknown matching mode '%s'", sValue );
++			SPH_RET(false);
++		}
++	} else if ( !strcmp ( sName, "ranker" ) )
++	{
++		m_eRanker = SPH_RANK_PROXIMITY_BM25;
++		if ( !strcmp ( sValue, "proximity_bm25" ) )	m_eRanker = SPH_RANK_PROXIMITY_BM25;
++		else if ( !strcmp ( sValue, "bm25" ) )		m_eRanker = SPH_RANK_BM25;
++		else if ( !strcmp ( sValue, "none" ) )		m_eRanker = SPH_RANK_NONE;
++		else if ( !strcmp ( sValue, "wordcount" ) )	m_eRanker = SPH_RANK_WORDCOUNT;
++		else if ( !strcmp ( sValue, "proximity" ) )	m_eRanker = SPH_RANK_PROXIMITY;
++		else if ( !strcmp ( sValue, "matchany" ) )	m_eRanker = SPH_RANK_MATCHANY;
++		else if ( !strcmp ( sValue, "fieldmask" ) )	m_eRanker = SPH_RANK_FIELDMASK;
++		else if ( !strcmp ( sValue, "sph04" ) )		m_eRanker = SPH_RANK_SPH04;
++		else
++		{
++			snprintf ( m_sParseError, sizeof(m_sParseError), "unknown ranking mode '%s'", sValue );
++			SPH_RET(false);
++		}
++	} else if ( !strcmp ( sName, "sort" ) )
++	{
++		static const struct
++		{
++			const char *	m_sName;
++			ESphSortOrder	m_eSort;
++		} dSortModes[] =
++		{
++			{ "relevance",		SPH_SORT_RELEVANCE },
++			{ "attr_desc:",		SPH_SORT_ATTR_DESC },
++			{ "attr_asc:",		SPH_SORT_ATTR_ASC },
++			{ "time_segments:",	SPH_SORT_TIME_SEGMENTS },
++			{ "extended:",		SPH_SORT_EXTENDED },
++			{ "expr:",			SPH_SORT_EXPR }
++		};
++
++		int i;
++		const int nModes = sizeof(dSortModes)/sizeof(dSortModes[0]);
++		for ( i=0; i<nModes; i++ )
++			if ( !strncmp ( sValue, dSortModes[i].m_sName, strlen ( dSortModes[i].m_sName ) ) )
++		{
++			m_eSort = dSortModes[i].m_eSort;
++			m_sSortBy = sValue + strlen ( dSortModes[i].m_sName );
++			break;
++		}
++		if ( i==nModes )
++		{
++			snprintf ( m_sParseError, sizeof(m_sParseError), "unknown sorting mode '%s'", sValue );
++			SPH_RET(false);
++		}
++
++	} else if ( !strcmp ( sName, "groupby" ) )
++	{
++		static const struct
++		{
++			const char *	m_sName;
++			ESphGroupBy		m_eFunc;
++		} dGroupModes[] =
++		{
++			{ "day:",	SPH_GROUPBY_DAY },
++			{ "week:",	SPH_GROUPBY_WEEK },
++			{ "month:",	SPH_GROUPBY_MONTH },
++			{ "year:",	SPH_GROUPBY_YEAR },
++			{ "attr:",	SPH_GROUPBY_ATTR },
++		};
++
++		int i;
++		const int nModes = sizeof(dGroupModes)/sizeof(dGroupModes[0]);
++		for ( i=0; i<nModes; i++ )
++			if ( !strncmp ( sValue, dGroupModes[i].m_sName, strlen ( dGroupModes[i].m_sName ) ) )
++		{
++			m_eGroupFunc = dGroupModes[i].m_eFunc;
++			m_sGroupBy = sValue + strlen ( dGroupModes[i].m_sName );
++			break;
++		}
++		if ( i==nModes )
++		{
++			snprintf ( m_sParseError, sizeof(m_sParseError), "unknown groupby mode '%s'", sValue );
++			SPH_RET(false);
++		}
++
++	} else if ( m_iFilters<SPHINXSE_MAX_FILTERS &&
++		( !strcmp ( sName, "range" ) || !strcmp ( sName, "!range" ) || !strcmp ( sName, "floatrange" ) || !strcmp ( sName, "!floatrange" ) ) )
++	{
++		for ( ;; )
++		{
++			char * p = sName;
++			CSphSEFilter & tFilter = m_dFilters [ m_iFilters ];
++			tFilter.m_bExclude = ( *p=='!' ); if ( tFilter.m_bExclude ) p++;
++			tFilter.m_eType = ( *p=='f' ) ? SPH_FILTER_FLOATRANGE : SPH_FILTER_RANGE;
++
++			if (!( p = strchr ( sValue, ',' ) ))
++				break;
++			*p++ = '\0';
++
++			tFilter.m_sAttrName = chop ( sValue );
++			sValue = p;
++
++			if (!( p = strchr ( sValue, ',' ) ))
++				break;
++			*p++ = '\0';
++
++			if ( tFilter.m_eType==SPH_FILTER_RANGE )
++			{
++				tFilter.m_uMinValue = strtoll ( sValue, NULL, 0 );
++				tFilter.m_uMaxValue = strtoll ( p, NULL, 0 );
++			} else
++			{
++				tFilter.m_fMinValue = (float)atof(sValue);
++				tFilter.m_fMaxValue = (float)atof(p);
++			}
++
++			// all ok
++			m_iFilters++;
++			break;
++		}
++
++	} else if ( m_iFilters<SPHINXSE_MAX_FILTERS &&
++		( !strcmp ( sName, "filter" ) || !strcmp ( sName, "!filter" ) ) )
++	{
++		for ( ;; )
++		{
++			CSphSEFilter & tFilter = m_dFilters [ m_iFilters ];
++			tFilter.m_eType = SPH_FILTER_VALUES;
++			tFilter.m_bExclude = ( strcmp ( sName, "!filter" )==0 );
++
++			// get the attr name
++			while ( (*sValue) && !myisattr(*sValue) )
++				sValue++;
++			if ( !*sValue )
++				break;
++
++			tFilter.m_sAttrName = sValue;
++			while ( (*sValue) && myisattr(*sValue) )
++				sValue++;
++			if ( !*sValue )
++				break;
++			*sValue++ = '\0';
++
++			// get the values
++			tFilter.m_iValues = ParseArray<longlong> ( &tFilter.m_pValues, sValue );
++			if ( !tFilter.m_iValues )
++			{
++				assert ( !tFilter.m_pValues );
++				break;
++			}
++
++			// all ok
++			m_iFilters++;
++			break;
++		}
++
++	} else if ( !strcmp ( sName, "indexweights" ) || !strcmp ( sName, "fieldweights" ) )
++	{
++		bool bIndex = !strcmp ( sName, "indexweights" );
++		int * pCount = bIndex ? &m_iIndexWeights : &m_iFieldWeights;
++		char ** pNames = bIndex ? &m_sIndexWeight[0] : &m_sFieldWeight[0];
++		int * pWeights = bIndex ? &m_iIndexWeight[0] : &m_iFieldWeight[0];
++
++		*pCount = 0;
++
++		char * p = sValue;
++		while ( *p && *pCount<SPHINXSE_MAX_FILTERS )
++		{
++			// extract attr name
++			if ( !myisattr(*p) )
++			{
++				snprintf ( m_sParseError, sizeof(m_sParseError), "%s: index name expected near '%s'", sName, p );
++				SPH_RET(false);
++			}
++
++			pNames[*pCount] = p;
++			while ( myisattr(*p) ) p++;
++
++			if ( *p!=',' )
++			{
++				snprintf ( m_sParseError, sizeof(m_sParseError), "%s: comma expected near '%s'", sName, p );
++				SPH_RET(false);
++			}
++			*p++ = '\0';
++
++			// extract attr value
++			char * sVal = p;
++			while ( isdigit(*p) ) p++;
++			if ( p==sVal )
++			{
++				snprintf ( m_sParseError, sizeof(m_sParseError), "%s: integer weight expected near '%s'", sName, sVal );
++				SPH_RET(false);
++			}
++			pWeights[*pCount] = atoi(sVal);
++			(*pCount)++;
++
++			if ( !*p )
++				break;
++			if ( *p!=',' )
++			{
++				snprintf ( m_sParseError, sizeof(m_sParseError), "%s: comma expected near '%s'", sName, p );
++				SPH_RET(false);
++			}
++			p++;
++		}
++
++	} else if ( !strcmp ( sName, "geoanchor" ) )
++	{
++		m_bGeoAnchor = false;
++		for ( ;; )
++		{
++			char * sLat = sValue;
++			char * p = sValue;
++
++			if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0';
++			char * sLong = p;
++
++			if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0';
++			char * sLatVal = p;
++
++			if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0';
++			char * sLongVal = p;
++
++			m_sGeoLatAttr = chop(sLat);
++			m_sGeoLongAttr = chop(sLong);
++			m_fGeoLatitude = (float)atof ( sLatVal );
++			m_fGeoLongitude = (float)atof ( sLongVal );
++			m_bGeoAnchor = true;
++			break;
++		}
++		if ( !m_bGeoAnchor )
++		{
++			snprintf ( m_sParseError, sizeof(m_sParseError), "geoanchor: parse error, not enough comma-separated arguments" );
++			SPH_RET(false);
++		}
++	} else if ( !strcmp ( sName, "override" ) ) // name,type,id:value,id:value,...
++	{
++		char * sName = NULL;
++		int iType = 0;
++		CSphSEQuery::Override_t * pOverride = NULL;
++
++		// get name and type
++		char * sRest = sValue;
++		for ( ;; )
++		{
++			sName = sRest;
++			if ( !*sName )
++				break;
++			if (!( sRest = strchr ( sRest, ',' ) ))
++				break;
++			*sRest++ = '\0';
++			char * sType = sRest;
++			if (!( sRest = strchr ( sRest, ',' ) ))
++				break;
++
++			static const struct
++			{
++				const char *	m_sName;
++				int				m_iType;
++			}
++			dAttrTypes[] =
++			{
++				{ "int",		SPH_ATTR_INTEGER },
++				{ "timestamp",	SPH_ATTR_TIMESTAMP },
++				{ "bool",		SPH_ATTR_BOOL },
++				{ "float",		SPH_ATTR_FLOAT },
++				{ "bigint",		SPH_ATTR_BIGINT }
++			};
++			for ( int i=0; i<sizeof(dAttrTypes)/sizeof(*dAttrTypes); i++ )
++				if ( !strncmp ( sType, dAttrTypes[i].m_sName, sRest - sType ) )
++			{
++				iType = dAttrTypes[i].m_iType;
++				break;
++			}
++			break;
++		}
++
++		// fail
++		if ( !sName || !*sName || !iType )
++		{
++			snprintf ( m_sParseError, sizeof(m_sParseError), "override: malformed query" );
++			SPH_RET(false);
++		}
++
++		// grab id:value pairs
++		sRest++;
++		while ( sRest )
++		{
++			char * sId = sRest;
++			if (!( sRest = strchr ( sRest, ':' ) )) break; *sRest++ = '\0';
++			if (!( sRest - sId )) break;
++
++			char * sValue = sRest;
++			if ( ( sRest = strchr ( sRest, ',' ) )!=NULL )
++				*sRest++ = '\0';
++			if ( !*sValue )
++				break;
++
++			if ( !pOverride )
++			{
++				pOverride = new CSphSEQuery::Override_t;
++				pOverride->m_sName = chop(sName);
++				pOverride->m_iType = iType;
++				m_dOverrides.append ( pOverride );
++			}
++
++			ulonglong uId = strtoull ( sId, NULL, 10 );
++			CSphSEQuery::Override_t::Value_t tValue;
++			if ( iType==SPH_ATTR_FLOAT )
++				tValue.m_fValue = (float)atof(sValue);
++			else if ( iType==SPH_ATTR_BIGINT )
++				tValue.m_iValue64 = strtoll ( sValue, NULL, 10 );
++			else
++				tValue.m_uValue = (uint32)strtoul ( sValue, NULL, 10 );
++
++			pOverride->m_dIds.append ( uId );
++			pOverride->m_dValues.append ( tValue );
++		}
++
++		if ( !pOverride )
++		{
++			snprintf ( m_sParseError, sizeof(m_sParseError), "override: id:value mapping expected" );
++			SPH_RET(false);
++		}
++		SPH_RET(true);
++	} else
++	{
++		snprintf ( m_sParseError, sizeof(m_sParseError), "unknown parameter '%s'", sName );
++		SPH_RET(false);
++	}
++
++	// !COMMIT handle syntax errors
++
++	SPH_RET(true);
++}
++
++
++bool CSphSEQuery::Parse ()
++{
++	SPH_ENTER_METHOD();
++	SPH_DEBUG ( "query [[ %s ]]", m_sQueryBuffer );
++
++	m_bQuery = false;
++	char * pCur = m_sQueryBuffer;
++	char * pNext = pCur;
++
++	while ( ( pNext = strchr ( pNext, ';' ) )!=NULL )
++	{
++		// handle escaped semicolons
++		if ( pNext>m_sQueryBuffer && pNext[-1]=='\\' && pNext[1]!='\0' )
++		{
++			pNext++;
++			continue;
++		}
++
++		// handle semicolon-separated clauses
++		*pNext++ = '\0';
++		if ( !ParseField ( pCur ) )
++			SPH_RET(false);
++		pCur = pNext;
++	}
++
++	SPH_DEBUG ( "q [[ %s ]]", m_sQuery );
++
++	SPH_RET(true);
++}
++
++
++void CSphSEQuery::SendBytes ( const void * pBytes, int iBytes )
++{
++	SPH_ENTER_METHOD();
++	if ( m_iBufLeft<iBytes )
++	{
++		m_bBufOverrun = true;
++		SPH_VOID_RET();
++	}
++
++	memcpy ( m_pCur, pBytes, iBytes );
++
++	m_pCur += iBytes;
++	m_iBufLeft -= iBytes;
++	SPH_VOID_RET();
++}
++
++
++int CSphSEQuery::BuildRequest ( char ** ppBuffer )
++{
++	SPH_ENTER_METHOD();
++
++	// calc request length
++	int iReqSize = 124 + 4*m_iWeights
++		+ strlen ( m_sSortBy )
++		+ strlen ( m_sQuery )
++		+ strlen ( m_sIndex )
++		+ strlen ( m_sGroupBy )
++		+ strlen ( m_sGroupSortBy )
++		+ strlen ( m_sGroupDistinct )
++		+ strlen ( m_sComment )
++		+ strlen ( m_sSelect );
++	for ( int i=0; i<m_iFilters; i++ )
++	{
++		const CSphSEFilter & tFilter = m_dFilters[i];
++		iReqSize += 12 + strlen ( tFilter.m_sAttrName ); // string attr-name; int type; int exclude-flag
++		switch ( tFilter.m_eType )
++		{
++			case SPH_FILTER_VALUES:		iReqSize += 4 + 8*tFilter.m_iValues; break;
++			case SPH_FILTER_RANGE:		iReqSize += 16; break;
++			case SPH_FILTER_FLOATRANGE:	iReqSize += 8; break;
++		}
++	}
++	if ( m_bGeoAnchor ) // 1.14+
++		iReqSize += 16 + strlen ( m_sGeoLatAttr ) + strlen ( m_sGeoLongAttr );
++	for ( int i=0; i<m_iIndexWeights; i++ ) // 1.15+
++		iReqSize += 8 + strlen(m_sIndexWeight[i] );
++	for ( int i=0; i<m_iFieldWeights; i++ ) // 1.18+
++		iReqSize += 8 + strlen(m_sFieldWeight[i] );
++	// overrides
++	iReqSize += 4;
++	for ( int i=0; i<m_dOverrides.elements(); i++ )
++	{
++		CSphSEQuery::Override_t * pOverride = m_dOverrides.at(i);
++		const uint32 uSize = pOverride->m_iType==SPH_ATTR_BIGINT ? 16 : 12; // id64 + value
++		iReqSize += strlen ( pOverride->m_sName ) + 12 + uSize*pOverride->m_dIds.elements();
++	}
++	// select
++	iReqSize += 4;
++
++	m_iBufLeft = 0;
++	SafeDeleteArray ( m_pBuf );
++
++	m_pBuf = new char [ iReqSize ];
++	if ( !m_pBuf )
++		SPH_RET(-1);
++
++	m_pCur = m_pBuf;
++	m_iBufLeft = iReqSize;
++	m_bBufOverrun = false;
++	(*ppBuffer) = m_pBuf;
++
++	// build request
++	SendWord ( SEARCHD_COMMAND_SEARCH ); // command id
++	SendWord ( VER_COMMAND_SEARCH ); // command version
++	SendInt ( iReqSize-8 ); // packet body length
++
++	SendInt ( 1 ); // number of queries
++	SendInt ( m_iOffset );
++	SendInt ( m_iLimit );
++	SendInt ( m_eMode );
++	SendInt ( m_eRanker ); // 1.16+
++	SendInt ( m_eSort );
++	SendString ( m_sSortBy ); // sort attr
++	SendString ( m_sQuery ); // query
++	SendInt ( m_iWeights );
++	for ( int j=0; j<m_iWeights; j++ )
++		SendInt ( m_pWeights[j] ); // weights
++	SendString ( m_sIndex ); // indexes
++	SendInt ( 1 ); // id64 range follows
++	SendUint64 ( m_iMinID ); // id/ts ranges
++	SendUint64 ( m_iMaxID );
++
++	SendInt ( m_iFilters );
++	for ( int j=0; j<m_iFilters; j++ )
++	{
++		const CSphSEFilter & tFilter = m_dFilters[j];
++		SendString ( tFilter.m_sAttrName );
++		SendInt ( tFilter.m_eType );
++
++		switch ( tFilter.m_eType )
++		{
++			case SPH_FILTER_VALUES:
++				SendInt ( tFilter.m_iValues );
++				for ( int k=0; k<tFilter.m_iValues; k++ )
++					SendUint64 ( tFilter.m_pValues[k] );
++				break;
++
++			case SPH_FILTER_RANGE:
++				SendUint64 ( tFilter.m_uMinValue );
++				SendUint64 ( tFilter.m_uMaxValue );
++				break;
++
++			case SPH_FILTER_FLOATRANGE:
++				SendFloat ( tFilter.m_fMinValue );
++				SendFloat ( tFilter.m_fMaxValue );
++				break;
++		}
++
++		SendInt ( tFilter.m_bExclude );
++	}
++
++	SendInt ( m_eGroupFunc );
++	SendString ( m_sGroupBy );
++	SendInt ( m_iMaxMatches );
++	SendString ( m_sGroupSortBy );
++	SendInt ( m_iCutoff ); // 1.9+
++	SendInt ( m_iRetryCount ); // 1.10+
++	SendInt ( m_iRetryDelay );
++	SendString ( m_sGroupDistinct ); // 1.11+
++	SendInt ( m_bGeoAnchor ); // 1.14+
++	if ( m_bGeoAnchor )
++	{
++		SendString ( m_sGeoLatAttr );
++		SendString ( m_sGeoLongAttr );
++		SendFloat ( m_fGeoLatitude );
++		SendFloat ( m_fGeoLongitude );
++	}
++	SendInt ( m_iIndexWeights ); // 1.15+
++	for ( int i=0; i<m_iIndexWeights; i++ )
++	{
++		SendString ( m_sIndexWeight[i] );
++		SendInt ( m_iIndexWeight[i] );
++	}
++	SendInt ( m_iMaxQueryTime ); // 1.17+
++	SendInt ( m_iFieldWeights ); // 1.18+
++	for ( int i=0; i<m_iFieldWeights; i++ )
++	{
++		SendString ( m_sFieldWeight[i] );
++		SendInt ( m_iFieldWeight[i] );
++	}
++	SendString ( m_sComment );
++
++	// overrides
++	SendInt ( m_dOverrides.elements() );
++	for ( int i=0; i<m_dOverrides.elements(); i++ )
++	{
++		CSphSEQuery::Override_t * pOverride = m_dOverrides.at(i);
++		SendString ( pOverride->m_sName );
++		SendDword ( pOverride->m_iType );
++		SendInt ( pOverride->m_dIds.elements() );
++		for ( int j=0; j<pOverride->m_dIds.elements(); j++ )
++		{
++			SendUint64 ( pOverride->m_dIds.at(j) );
++			if ( pOverride->m_iType==SPH_ATTR_FLOAT )
++				SendFloat ( pOverride->m_dValues.at(j).m_fValue );
++			else if ( pOverride->m_iType==SPH_ATTR_BIGINT )
++				SendUint64 ( pOverride->m_dValues.at(j).m_iValue64 );
++			else
++				SendDword ( pOverride->m_dValues.at(j).m_uValue );
++		}
++	}
++
++	// select
++	SendString ( m_sSelect );
++
++	// detect buffer overruns and underruns, and report internal error
++	if ( m_bBufOverrun || m_iBufLeft!=0 || m_pCur-m_pBuf!=iReqSize )
++		SPH_RET(-1);
++
++	// all fine
++	SPH_RET ( iReqSize );
++}
++
++//////////////////////////////////////////////////////////////////////////////
++// SPHINX HANDLER
++//////////////////////////////////////////////////////////////////////////////
++
++static const char * ha_sphinx_exts[] = { NullS };
++
++
++#if MYSQL_VERSION_ID<50100
++ha_sphinx::ha_sphinx ( TABLE_ARG * table )
++	: handler ( &sphinx_hton, table )
++#else
++ha_sphinx::ha_sphinx ( handlerton * hton, TABLE_ARG * table )
++	: handler ( hton, table )
++#endif
++	, m_pShare ( NULL )
++	, m_iMatchesTotal ( 0 )
++	, m_iCurrentPos ( 0 )
++	, m_pCurrentKey ( NULL )
++	, m_iCurrentKeyLen ( 0 )
++	, m_pResponse ( NULL )
++	, m_pResponseEnd ( NULL )
++	, m_pCur ( NULL )
++	, m_bUnpackError ( false )
++	, m_iFields ( 0 )
++	, m_dFields ( NULL )
++	, m_iAttrs ( 0 )
++	, m_dAttrs ( NULL )
++	, m_bId64 ( 0 )
++	, m_dUnboundFields ( NULL )
++{
++	SPH_ENTER_METHOD();
++	if ( current_thd )
++		current_thd->variables.engine_condition_pushdown = true;
++	SPH_VOID_RET();
++}
++
++
++// If frm_error() is called then we will use this to to find out what file extentions
++// exist for the storage engine. This is also used by the default rename_table and
++// delete_table method in handler.cc.
++const char ** ha_sphinx::bas_ext() const
++{
++	return ha_sphinx_exts;
++}
++
++
++// Used for opening tables. The name will be the name of the file.
++// A table is opened when it needs to be opened. For instance
++// when a request comes in for a select on the table (tables are not
++// open and closed for each request, they are cached).
++//
++// Called from handler.cc by handler::ha_open(). The server opens all tables by
++// calling ha_open() which then calls the handler specific open().
++int ha_sphinx::open ( const char * name, int, uint )
++{
++	SPH_ENTER_METHOD();
++	m_pShare = get_share ( name, table );
++	if ( !m_pShare )
++		SPH_RET(1);
++
++	thr_lock_data_init ( &m_pShare->m_tLock, &m_tLock, NULL );
++
++	#if MYSQL_VERSION_ID>50100
++	*thd_ha_data ( table->in_use, ht ) = NULL;
++	#else
++	table->in_use->ha_data [ sphinx_hton.slot ] = NULL;
++	#endif
++
++	SPH_RET(0);
++}
++
++
++int ha_sphinx::Connect ( const char * sHost, ushort uPort )
++{
++	struct sockaddr_in sin;
++#ifndef __WIN__
++	struct sockaddr_un saun;
++#endif
++
++	int iDomain = 0;
++	int iSockaddrSize = 0;
++	struct sockaddr * pSockaddr = NULL;
++
++	in_addr_t ip_addr;
++
++	if ( uPort )
++	{
++		iDomain = AF_INET;
++		iSockaddrSize = sizeof(sin);
++		pSockaddr = (struct sockaddr *) &sin;
++
++		memset ( &sin, 0, sizeof(sin) );
++		sin.sin_family = AF_INET;
++		sin.sin_port = htons(uPort);
++
++		// prepare host address
++		if ( (int)( ip_addr = inet_addr(sHost) )!=(int)INADDR_NONE )
++		{
++			memcpy ( &sin.sin_addr, &ip_addr, sizeof(ip_addr) );
++		} else
++		{
++			int tmp_errno;
++			bool bError = false;
++
++#if MYSQL_VERSION_ID>=50515
++			struct addrinfo tmp_hostent, *hp;
++			tmp_errno = getaddrinfo ( sHost, NULL, &tmp_hostent, &hp );
++			if ( !tmp_errno )
++			{
++				freeaddrinfo ( hp );
++				bError = true;
++			}
++#else
++			struct hostent tmp_hostent, *hp;
++			char buff2 [ GETHOSTBYNAME_BUFF_SIZE ];
++			hp = my_gethostbyname_r ( sHost, &tmp_hostent, buff2, sizeof(buff2), &tmp_errno );
++			if ( !hp )
++			{
++				my_gethostbyname_r_free();
++				bError = true;
++			}
++#endif
++
++			if ( bError )
++			{
++				char sError[256];
++				my_snprintf ( sError, sizeof(sError), "failed to resolve searchd host (name=%s)", sHost );
++
++				my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), sError );
++				SPH_RET(-1);
++			}
++
++#if MYSQL_VERSION_ID>=50515
++			memcpy ( &sin.sin_addr, hp->ai_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->ai_addrlen ) );
++			freeaddrinfo ( hp );
++#else
++			memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
++			my_gethostbyname_r_free();
++#endif
++		}
++	} else
++	{
++#ifndef __WIN__
++		iDomain = AF_UNIX;
++		iSockaddrSize = sizeof(saun);
++		pSockaddr = (struct sockaddr *) &saun;
++
++		memset ( &saun, 0, sizeof(saun) );
++		saun.sun_family = AF_UNIX;
++		strncpy ( saun.sun_path, sHost, sizeof(saun.sun_path)-1 );
++#else
++		my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "UNIX sockets are not supported on Windows" );
++		SPH_RET(-1);
++#endif
++	}
++
++	char sError[512];
++	int iSocket = socket ( iDomain, SOCK_STREAM, 0 );
++
++	if ( iSocket<0 )
++	{
++		my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "failed to create client socket" );
++		SPH_RET(-1);
++	}
++
++	if ( connect ( iSocket, pSockaddr, iSockaddrSize )<0 )
++	{
++		sphSockClose ( iSocket );
++		my_snprintf ( sError, sizeof(sError), "failed to connect to searchd (host=%s, errno=%d, port=%d)",
++			sHost, errno, (int)uPort );
++		my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), sError );
++		SPH_RET(-1);
++	}
++
++	return iSocket;
++}
++
++
++int ha_sphinx::ConnectAPI ( const char * sQueryHost, int iQueryPort )
++{
++	SPH_ENTER_METHOD();
++
++	const char * sHost = ( sQueryHost && *sQueryHost ) ? sQueryHost : m_pShare->m_sHost;
++	ushort uPort = iQueryPort ? (ushort)iQueryPort : m_pShare->m_iPort;
++
++	int iSocket = Connect ( sHost, uPort );
++	if ( iSocket<0 )
++		SPH_RET ( iSocket );
++
++	char sError[512];
++
++	int version;
++	if ( ::recv ( iSocket, (char *)&version, sizeof(version), 0 )!=sizeof(version) )
++	{
++		sphSockClose ( iSocket );
++		my_snprintf ( sError, sizeof(sError), "failed to receive searchd version (host=%s, port=%d)",
++			sHost, (int)uPort );
++		my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), sError );
++		SPH_RET(-1);
++	}
++
++	uint uClientVersion = htonl ( SPHINX_SEARCHD_PROTO );
++	if ( ::send ( iSocket, (char*)&uClientVersion, sizeof(uClientVersion), 0 )!=sizeof(uClientVersion) )
++	{
++		sphSockClose ( iSocket );
++		my_snprintf ( sError, sizeof(sError), "failed to send client version (host=%s, port=%d)",
++			sHost, (int)uPort );
++		my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), sError );
++		SPH_RET(-1);
++	}
++
++	SPH_RET ( iSocket );
++}
++
++
++// Closes a table. We call the free_share() function to free any resources
++// that we have allocated in the "shared" structure.
++//
++// Called from sql_base.cc, sql_select.cc, and table.cc.
++// In sql_select.cc it is only used to close up temporary tables or during
++// the process where a temporary table is converted over to being a
++// myisam table.
++// For sql_base.cc look at close_data_tables().
++int ha_sphinx::close()
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( free_share ( m_pShare ) );
++}
++
++
++int ha_sphinx::HandleMysqlError ( MYSQL * pConn, int iErrCode )
++{
++	CSphSEThreadData * pTls = GetTls ();
++	if ( pTls )
++	{
++		strncpy ( pTls->m_tStats.m_sLastMessage, mysql_error ( pConn ), sizeof ( pTls->m_tStats.m_sLastMessage ) );
++		pTls->m_tStats.m_bLastError = true;
++	}
++
++	mysql_close ( pConn );
++
++	my_error ( iErrCode, MYF(0), pTls->m_tStats.m_sLastMessage );
++	return -1;
++}
++
++
++int ha_sphinx::extra ( enum ha_extra_function op )
++{
++	CSphSEThreadData * pTls = GetTls();
++	if ( pTls )
++	{
++		if ( op==HA_EXTRA_WRITE_CAN_REPLACE )
++			pTls->m_bReplace = true;
++		else if ( op==HA_EXTRA_WRITE_CANNOT_REPLACE )
++			pTls->m_bReplace = false;
++	}
++	return 0;
++}
++
++
++int ha_sphinx::write_row ( byte * )
++{
++	SPH_ENTER_METHOD();
++	if ( !m_pShare || !m_pShare->m_bSphinxQL )
++		SPH_RET ( HA_ERR_WRONG_COMMAND );
++
++	// SphinxQL inserts only, pretty much similar to abandoned federated
++	char sQueryBuf[1024];
++	char sValueBuf[1024];
++
++	String sQuery ( sQueryBuf, sizeof(sQueryBuf), &my_charset_bin );
++	String sValue ( sValueBuf, sizeof(sQueryBuf), &my_charset_bin );
++	sQuery.length ( 0 );
++	sValue.length ( 0 );
++
++	CSphSEThreadData * pTls = GetTls ();
++	sQuery.append ( pTls && pTls->m_bReplace ? "REPLACE INTO " : "INSERT INTO " );
++	sQuery.append ( m_pShare->m_sIndex );
++	sQuery.append ( " (" );
++
++	for ( Field ** ppField = table->field; *ppField; ppField++ )
++	{
++		sQuery.append ( (*ppField)->field_name );
++		if ( ppField[1] )
++			sQuery.append ( ", " );
++	}
++	sQuery.append ( ") VALUES (" );
++
++	for ( Field ** ppField = table->field; *ppField; ppField++ )
++	{
++		if ( (*ppField)->is_null() )
++		{
++			sQuery.append ( "''" );
++
++		} else
++		{
++			if ( (*ppField)->type()==MYSQL_TYPE_TIMESTAMP )
++			{
++				Item_field * pWrap = new Item_field ( *ppField ); // autofreed by query arena, I assume
++				Item_func_unix_timestamp * pConv = new Item_func_unix_timestamp ( pWrap );
++				pConv->quick_fix_field();
++				unsigned int uTs = (unsigned int) pConv->val_int();
++
++				snprintf ( sValueBuf, sizeof(sValueBuf), "'%u'", uTs );
++				sQuery.append ( sValueBuf );
++
++			} else
++			{
++				(*ppField)->val_str ( &sValue );
++				sQuery.append ( "'" );
++				sValue.print ( &sQuery );
++				sQuery.append ( "'" );
++				sValue.length(0);
++			}
++		}
++
++		if ( ppField[1] )
++			sQuery.append ( ", " );
++	}
++	sQuery.append ( ")" );
++
++	// FIXME? pretty inefficient to reconnect every time under high load,
++	// but this was intentionally written for a low load scenario..
++	MYSQL * pConn = mysql_init ( NULL );
++	if ( !pConn )
++		SPH_RET ( ER_OUT_OF_RESOURCES );
++
++	unsigned int uTimeout = 1;
++	mysql_options ( pConn, MYSQL_OPT_CONNECT_TIMEOUT, (const char*)&uTimeout );
++
++	if ( !mysql_real_connect ( pConn, m_pShare->m_sHost, "root", "", "", m_pShare->m_iPort, m_pShare->m_sSocket, 0 ) )
++		SPH_RET ( HandleMysqlError ( pConn, ER_CONNECT_TO_FOREIGN_DATA_SOURCE ) );
++
++	if ( mysql_real_query ( pConn, sQuery.ptr(), sQuery.length() ) )
++		SPH_RET ( HandleMysqlError ( pConn, ER_QUERY_ON_FOREIGN_DATA_SOURCE ) );
++
++	// all ok!
++	mysql_close ( pConn );
++	SPH_RET(0);
++}
++
++
++static inline bool IsIntegerFieldType ( enum_field_types eType )
++{
++	return eType==MYSQL_TYPE_LONG || eType==MYSQL_TYPE_LONGLONG;
++}
++
++
++static inline bool IsIDField ( Field * pField )
++{
++	enum_field_types eType = pField->type();
++
++	if ( eType==MYSQL_TYPE_LONGLONG )
++		return true;
++
++	if ( eType==MYSQL_TYPE_LONG && ((Field_num*)pField)->unsigned_flag )
++		return true;
++
++	return false;
++}
++
++
++int ha_sphinx::delete_row ( const byte * )
++{
++	SPH_ENTER_METHOD();
++	if ( !m_pShare || !m_pShare->m_bSphinxQL )
++		SPH_RET ( HA_ERR_WRONG_COMMAND );
++
++	char sQueryBuf[1024];
++	String sQuery ( sQueryBuf, sizeof(sQueryBuf), &my_charset_bin );
++	sQuery.length ( 0 );
++
++	sQuery.append ( "DELETE FROM " );
++	sQuery.append ( m_pShare->m_sIndex );
++	sQuery.append ( " WHERE id=" );
++
++	char sValue[32];
++	snprintf ( sValue, sizeof(sValue), "%lld", table->field[0]->val_int() );
++	sQuery.append ( sValue );
++
++	// FIXME? pretty inefficient to reconnect every time under high load,
++	// but this was intentionally written for a low load scenario..
++	MYSQL * pConn = mysql_init ( NULL );
++	if ( !pConn )
++		SPH_RET ( ER_OUT_OF_RESOURCES );
++
++	unsigned int uTimeout = 1;
++	mysql_options ( pConn, MYSQL_OPT_CONNECT_TIMEOUT, (const char*)&uTimeout );
++
++	if ( !mysql_real_connect ( pConn, m_pShare->m_sHost, "root", "", "", m_pShare->m_iPort, m_pShare->m_sSocket, 0 ) )
++		SPH_RET ( HandleMysqlError ( pConn, ER_CONNECT_TO_FOREIGN_DATA_SOURCE ) );
++
++	if ( mysql_real_query ( pConn, sQuery.ptr(), sQuery.length() ) )
++		SPH_RET ( HandleMysqlError ( pConn, ER_QUERY_ON_FOREIGN_DATA_SOURCE ) );
++
++	// all ok!
++	mysql_close ( pConn );
++	SPH_RET(0);
++}
++
++
++int ha_sphinx::update_row ( const byte *, byte * )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( HA_ERR_WRONG_COMMAND );
++}
++
++
++// keynr is key (index) number
++// sorted is 1 if result MUST be sorted according to index
++int ha_sphinx::index_init ( uint keynr, bool )
++{
++	SPH_ENTER_METHOD();
++	active_index = keynr;
++
++	CSphSEThreadData * pTls = GetTls();
++	if ( pTls )
++		pTls->m_bCondDone = false;
++
++	SPH_RET(0);
++}
++
++
++int ha_sphinx::index_end()
++{
++	SPH_ENTER_METHOD();
++	SPH_RET(0);
++}
++
++
++uint32 ha_sphinx::UnpackDword ()
++{
++	if ( m_pCur+sizeof(uint32)>m_pResponseEnd ) // NOLINT
++	{
++		m_pCur = m_pResponseEnd;
++		m_bUnpackError = true;
++		return 0;
++	}
++
++	uint32 uRes = ntohl ( sphUnalignedRead ( *(uint32*)m_pCur ) );
++	m_pCur += sizeof(uint32); // NOLINT
++	return uRes;
++}
++
++
++char * ha_sphinx::UnpackString ()
++{
++	uint32 iLen = UnpackDword ();
++	if ( !iLen )
++		return NULL;
++
++	if ( m_pCur+iLen>m_pResponseEnd )
++	{
++		m_pCur = m_pResponseEnd;
++		m_bUnpackError = true;
++		return NULL;
++	}
++
++	char * sRes = new char [ 1+iLen ];
++	memcpy ( sRes, m_pCur, iLen );
++	sRes[iLen] = '\0';
++	m_pCur += iLen;
++	return sRes;
++}
++
++
++static inline const char * FixNull ( const char * s )
++{
++	return s ? s : "(null)";
++}
++
++
++bool ha_sphinx::UnpackSchema ()
++{
++	SPH_ENTER_METHOD();
++
++	// cleanup
++	if ( m_dFields )
++		for ( int i=0; i<(int)m_iFields; i++ )
++			SafeDeleteArray ( m_dFields[i] );
++	SafeDeleteArray ( m_dFields );
++
++	// unpack network packet
++	uint32 uStatus = UnpackDword ();
++	char * sMessage = NULL;
++
++	if ( uStatus!=SEARCHD_OK )
++	{
++		sMessage = UnpackString ();
++		CSphSEThreadData * pTls = GetTls ();
++		if ( pTls )
++		{
++			strncpy ( pTls->m_tStats.m_sLastMessage, sMessage, sizeof(pTls->m_tStats.m_sLastMessage) );
++			pTls->m_tStats.m_bLastError = ( uStatus==SEARCHD_ERROR );
++		}
++
++		if ( uStatus==SEARCHD_ERROR )
++		{
++			char sError[1024];
++			my_snprintf ( sError, sizeof(sError), "searchd error: %s", sMessage );
++			my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), sError );
++			SafeDeleteArray ( sMessage );
++			SPH_RET ( false );
++		}
++	}
++
++	m_iFields = UnpackDword ();
++	m_dFields = new char * [ m_iFields ];
++	if ( !m_dFields )
++	{
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: UnpackSchema() failed (fields alloc error)" );
++		SPH_RET(false);
++	}
++
++	for ( uint32 i=0; i<m_iFields; i++ )
++		m_dFields[i] = UnpackString ();
++
++	SafeDeleteArray ( m_dAttrs );
++	m_iAttrs = UnpackDword ();
++	m_dAttrs = new CSphSEAttr [ m_iAttrs ];
++	if ( !m_dAttrs )
++	{
++		for ( int i=0; i<(int)m_iFields; i++ )
++			SafeDeleteArray ( m_dFields[i] );
++		SafeDeleteArray ( m_dFields );
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: UnpackSchema() failed (attrs alloc error)" );
++		SPH_RET(false);
++	}
++
++	for ( uint32 i=0; i<m_iAttrs; i++ )
++	{
++		m_dAttrs[i].m_sName = UnpackString ();
++		m_dAttrs[i].m_uType = UnpackDword ();
++		if ( m_bUnpackError ) // m_sName may be null
++			break;
++
++		m_dAttrs[i].m_iField = -1;
++		for ( int j=SPHINXSE_SYSTEM_COLUMNS; j<m_pShare->m_iTableFields; j++ )
++		{
++			const char * sTableField = m_pShare->m_sTableField[j];
++			const char * sAttrField = m_dAttrs[i].m_sName;
++			if ( m_dAttrs[i].m_sName[0]=='@' )
++			{
++				const char * sAtPrefix = "_sph_";
++				if ( strncmp ( sTableField, sAtPrefix, strlen(sAtPrefix) ) )
++					continue;
++				sTableField += strlen(sAtPrefix);
++				sAttrField++;
++			}
++
++			if ( !strcasecmp ( sAttrField, sTableField ) )
++			{
++				// we're almost good, but
++				// let's enforce that timestamp columns can only receive timestamp attributes
++				if ( m_pShare->m_eTableFieldType[j]!=MYSQL_TYPE_TIMESTAMP || m_dAttrs[i].m_uType==SPH_ATTR_TIMESTAMP )
++					m_dAttrs[i].m_iField = j;
++				break;
++			}
++		}
++	}
++
++	m_iMatchesTotal = UnpackDword ();
++
++	m_bId64 = UnpackDword ();
++	if ( m_bId64 && m_pShare->m_eTableFieldType[0]!=MYSQL_TYPE_LONGLONG )
++	{
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: 1st column must be bigint to accept 64-bit DOCIDs" );
++		SPH_RET(false);
++	}
++
++	// network packet unpacked; build unbound fields map
++	SafeDeleteArray ( m_dUnboundFields );
++	m_dUnboundFields = new int [ m_pShare->m_iTableFields ];
++
++	for ( int i=0; i<m_pShare->m_iTableFields; i++ )
++	{
++		if ( i<SPHINXSE_SYSTEM_COLUMNS )
++			m_dUnboundFields[i] = SPH_ATTR_NONE;
++
++		else if ( m_pShare->m_eTableFieldType[i]==MYSQL_TYPE_TIMESTAMP )
++			m_dUnboundFields[i] = SPH_ATTR_TIMESTAMP;
++
++		else
++			m_dUnboundFields[i] = SPH_ATTR_INTEGER;
++	}
++
++	for ( uint32 i=0; i<m_iAttrs; i++ )
++		if ( m_dAttrs[i].m_iField>=0 )
++			m_dUnboundFields [ m_dAttrs[i].m_iField ] = SPH_ATTR_NONE;
++
++	if ( m_bUnpackError )
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: UnpackSchema() failed (unpack error)" );
++
++	SPH_RET ( !m_bUnpackError );
++}
++
++
++bool ha_sphinx::UnpackStats ( CSphSEStats * pStats )
++{
++	assert ( pStats );
++
++	char * pCurSave = m_pCur;
++	for ( uint i=0; i<m_iMatchesTotal && m_pCur<m_pResponseEnd-sizeof(uint32); i++ ) // NOLINT
++	{
++		m_pCur += m_bId64 ? 12 : 8; // skip id+weight
++		for ( uint32 i=0; i<m_iAttrs && m_pCur<m_pResponseEnd-sizeof(uint32); i++ ) // NOLINT
++		{
++			if ( m_dAttrs[i].m_uType & SPH_ATTR_MULTI )
++			{
++				// skip MVA list
++				uint32 uCount = UnpackDword ();
++				m_pCur += uCount*4;
++			} else // skip normal value
++				m_pCur += m_dAttrs[i].m_uType==SPH_ATTR_BIGINT ? 8 : 4;
++		}
++	}
++
++	pStats->m_iMatchesTotal = UnpackDword ();
++	pStats->m_iMatchesFound = UnpackDword ();
++	pStats->m_iQueryMsec = UnpackDword ();
++	pStats->m_iWords = UnpackDword ();
++
++	if ( m_bUnpackError )
++		return false;
++
++	SafeDeleteArray ( pStats->m_dWords );
++	if ( pStats->m_iWords<0 || pStats->m_iWords>=SPHINXSE_MAX_KEYWORDSTATS )
++		return false;
++	pStats->m_dWords = new CSphSEWordStats [ pStats->m_iWords ];
++	if ( !pStats->m_dWords )
++		return false;
++
++	for ( int i=0; i<pStats->m_iWords; i++ )
++	{
++		CSphSEWordStats & tWord = pStats->m_dWords[i];
++		tWord.m_sWord = UnpackString ();
++		tWord.m_iDocs = UnpackDword ();
++		tWord.m_iHits = UnpackDword ();
++	}
++
++	if ( m_bUnpackError )
++		return false;
++
++	m_pCur = pCurSave;
++	return true;
++}
++
++
++/// condition pushdown implementation, to properly intercept WHERE clauses on my columns
++const COND * ha_sphinx::cond_push ( const COND * cond )
++{
++	// catch the simplest case: query_column="some text"
++	for ( ;; )
++	{
++		if ( cond->type()!=COND::FUNC_ITEM )
++			break;
++
++		Item_func * condf = (Item_func *)cond;
++		if ( condf->functype()!=Item_func::EQ_FUNC || condf->argument_count()!=2 )
++			break;
++
++		// get my tls
++		CSphSEThreadData * pTls = GetTls ();
++		if ( !pTls )
++			break;
++
++		Item ** args = condf->arguments();
++		if ( !m_pShare->m_bSphinxQL )
++		{
++			// on non-QL tables, intercept query=value condition for SELECT
++			if (!( args[0]->type()==COND::FIELD_ITEM && args[1]->type()==COND::STRING_ITEM ))
++				break;
++
++			Item_field * pField = (Item_field *) args[0];
++			if ( pField->field->field_index!=2 ) // FIXME! magic key index
++				break;
++
++			// copy the query, and let know that we intercepted this condition
++			Item_string * pString = (Item_string *) args[1];
++			pTls->m_bQuery = true;
++			strncpy ( pTls->m_sQuery, pString->str_value.c_ptr(), sizeof(pTls->m_sQuery) );
++			pTls->m_sQuery[sizeof(pTls->m_sQuery)-1] = '\0';
++			pTls->m_pQueryCharset = pString->str_value.charset();
++
++		} else
++		{
++			if (!( args[0]->type()==COND::FIELD_ITEM && args[1]->type()==COND::INT_ITEM ))
++				break;
++
++			// on QL tables, intercept id=value condition for DELETE
++			Item_field * pField = (Item_field *) args[0];
++			if ( pField->field->field_index!=0 ) // FIXME! magic key index
++				break;
++
++			Item_int * pVal = (Item_int *) args[1];
++			pTls->m_iCondId = pVal->val_int();
++			pTls->m_bCondId = true;
++		}
++
++		// we intercepted this condition
++		return NULL;
++	}
++
++	// don't change anything
++	return cond;
++}
++
++
++/// condition popup
++void ha_sphinx::cond_pop ()
++{
++	CSphSEThreadData * pTls = GetTls ();
++	if ( pTls )
++		pTls->m_bQuery = false;
++}
++
++
++/// get TLS (maybe allocate it, too)
++CSphSEThreadData * ha_sphinx::GetTls()
++{
++	// where do we store that pointer in today's version?
++	CSphSEThreadData ** ppTls;
++#if MYSQL_VERSION_ID>50100
++	ppTls = (CSphSEThreadData**) thd_ha_data ( table->in_use, ht );
++#else
++	ppTls = (CSphSEThreadData**) &current_thd->ha_data[sphinx_hton.slot];
++#endif // >50100
++
++	// allocate if needed
++	if ( !*ppTls )
++		*ppTls = new CSphSEThreadData ();
++
++	// errors will be handled by caller
++	return *ppTls;
++}
++
++
++// Positions an index cursor to the index specified in the handle. Fetches the
++// row if available. If the key value is null, begin at the first key of the
++// index.
++int ha_sphinx::index_read ( byte * buf, const byte * key, uint key_len, enum ha_rkey_function )
++{
++	SPH_ENTER_METHOD();
++	char sError[256];
++
++	// set new data for thd->ha_data, it is used in show_status
++	CSphSEThreadData * pTls = GetTls();
++	if ( !pTls )
++	{
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: TLS malloc() failed" );
++		SPH_RET ( HA_ERR_END_OF_FILE );
++	}
++	pTls->m_tStats.Reset ();
++
++	// sphinxql table, just return the key once
++	if ( m_pShare->m_bSphinxQL )
++	{
++		// over and out
++		if ( pTls->m_bCondDone )
++			SPH_RET ( HA_ERR_END_OF_FILE );
++
++		// return a value from pushdown, if any
++		if ( pTls->m_bCondId )
++		{
++			table->field[0]->store ( pTls->m_iCondId, 1 );
++			pTls->m_bCondDone = true;
++			SPH_RET(0);
++		}
++
++		// return a value from key
++		longlong iRef = 0;
++		if ( key_len==4 )
++			iRef = uint4korr ( key );
++		else if ( key_len==8 )
++			iRef = uint8korr ( key );
++		else
++		{
++			my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: unexpected key length" );
++			SPH_RET ( HA_ERR_END_OF_FILE );
++		}
++
++		table->field[0]->store ( iRef, 1 );
++		pTls->m_bCondDone = true;
++		SPH_RET(0);
++	}
++
++	// parse query
++	if ( pTls->m_bQuery )
++	{
++		// we have a query from condition pushdown
++		m_pCurrentKey = (const byte *) pTls->m_sQuery;
++		m_iCurrentKeyLen = strlen(pTls->m_sQuery);
++	} else
++	{
++		// just use the key (might be truncated)
++		m_pCurrentKey = key+HA_KEY_BLOB_LENGTH;
++		m_iCurrentKeyLen = uint2korr(key); // or maybe key_len?
++		pTls->m_pQueryCharset = m_pShare ? m_pShare->m_pTableQueryCharset : NULL;
++	}
++
++	CSphSEQuery q ( (const char*)m_pCurrentKey, m_iCurrentKeyLen, m_pShare->m_sIndex );
++	if ( !q.Parse () )
++	{
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), q.m_sParseError );
++		SPH_RET ( HA_ERR_END_OF_FILE );
++	}
++
++	// do connect
++	int iSocket = ConnectAPI ( q.m_sHost, q.m_iPort );
++	if ( iSocket<0 )
++		SPH_RET ( HA_ERR_END_OF_FILE );
++
++	// my buffer
++	char * pBuffer; // will be free by CSphSEQuery dtor; do NOT free manually
++	int iReqLen = q.BuildRequest ( &pBuffer );
++
++	if ( iReqLen<=0 )
++	{
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: q.BuildRequest() failed" );
++		SPH_RET ( HA_ERR_END_OF_FILE );
++	}
++
++	// send request
++	::send ( iSocket, pBuffer, iReqLen, 0 );
++
++	// receive reply
++	char sHeader[8];
++	int iGot = ::recv ( iSocket, sHeader, sizeof(sHeader), RECV_FLAGS );
++	if ( iGot!=sizeof(sHeader) )
++	{
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "failed to receive response header (searchd went away?)" );
++		SPH_RET ( HA_ERR_END_OF_FILE );
++	}
++
++	short int uRespStatus = ntohs ( sphUnalignedRead ( *(short int*)( &sHeader[0] ) ) );
++	short int uRespVersion = ntohs ( sphUnalignedRead ( *(short int*)( &sHeader[2] ) ) );
++	uint uRespLength = ntohl ( sphUnalignedRead ( *(uint *)( &sHeader[4] ) ) );
++	SPH_DEBUG ( "got response header (status=%d version=%d length=%d)",
++		uRespStatus, uRespVersion, uRespLength );
++
++	SafeDeleteArray ( m_pResponse );
++	if ( uRespLength<=SPHINXSE_MAX_ALLOC )
++		m_pResponse = new char [ uRespLength+1 ];
++
++	if ( !m_pResponse )
++	{
++		my_snprintf ( sError, sizeof(sError), "bad searchd response length (length=%u)", uRespLength );
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), sError );
++		SPH_RET ( HA_ERR_END_OF_FILE );
++	}
++
++	int iRecvLength = 0;
++	while ( iRecvLength<(int)uRespLength )
++	{
++		int iRecv = ::recv ( iSocket, m_pResponse+iRecvLength, uRespLength-iRecvLength, RECV_FLAGS );
++		if ( iRecv<0 )
++			break;
++		iRecvLength += iRecv;
++	}
++
++	::closesocket ( iSocket );
++	iSocket = -1;
++
++	if ( iRecvLength!=(int)uRespLength )
++	{
++		my_snprintf ( sError, sizeof(sError), "net read error (expected=%d, got=%d)", uRespLength, iRecvLength );
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), sError );
++		SPH_RET ( HA_ERR_END_OF_FILE );
++	}
++
++	// we'll have a message, at least
++	pTls->m_bStats = true;
++
++	// parse reply
++	m_iCurrentPos = 0;
++	m_pCur = m_pResponse;
++	m_pResponseEnd = m_pResponse + uRespLength;
++	m_bUnpackError = false;
++
++	if ( uRespStatus!=SEARCHD_OK )
++	{
++		char * sMessage = UnpackString ();
++		if ( !sMessage )
++		{
++			my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "no valid response from searchd (status=%d, resplen=%d)",
++				uRespStatus, uRespLength );
++			SPH_RET ( HA_ERR_END_OF_FILE );
++		}
++
++		strncpy ( pTls->m_tStats.m_sLastMessage, sMessage, sizeof(pTls->m_tStats.m_sLastMessage) );
++		SafeDeleteArray ( sMessage );
++
++		if ( uRespStatus!=SEARCHD_WARNING )
++		{
++			my_snprintf ( sError, sizeof(sError), "searchd error: %s", pTls->m_tStats.m_sLastMessage );
++			my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), sError );
++
++			pTls->m_tStats.m_bLastError = true;
++			SPH_RET ( HA_ERR_END_OF_FILE );
++		}
++	}
++
++	if ( !UnpackSchema () )
++		SPH_RET ( HA_ERR_END_OF_FILE );
++
++	if ( !UnpackStats ( &pTls->m_tStats ) )
++	{
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: UnpackStats() failed" );
++		SPH_RET ( HA_ERR_END_OF_FILE );
++	}
++
++	SPH_RET ( get_rec ( buf, key, key_len ) );
++}
++
++
++// Positions an index cursor to the index specified in key. Fetches the
++// row if any. This is only used to read whole keys.
++int ha_sphinx::index_read_idx ( byte *, uint, const byte *, uint, enum ha_rkey_function )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( HA_ERR_WRONG_COMMAND );
++}
++
++
++// Used to read forward through the index.
++int ha_sphinx::index_next ( byte * buf )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( get_rec ( buf, m_pCurrentKey, m_iCurrentKeyLen ) );
++}
++
++
++int ha_sphinx::index_next_same ( byte * buf, const byte * key, uint keylen )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( get_rec ( buf, key, keylen ) );
++}
++
++
++int ha_sphinx::get_rec ( byte * buf, const byte *, uint )
++{
++	SPH_ENTER_METHOD();
++
++	if ( m_iCurrentPos>=m_iMatchesTotal )
++	{
++		SafeDeleteArray ( m_pResponse );
++		SPH_RET ( HA_ERR_END_OF_FILE );
++	}
++
++	#if MYSQL_VERSION_ID>50100
++	my_bitmap_map * org_bitmap = dbug_tmp_use_all_columns ( table, table->write_set );
++	#endif
++	Field ** field = table->field;
++
++	// unpack and return the match
++	longlong uMatchID = UnpackDword ();
++	if ( m_bId64 )
++		uMatchID = ( uMatchID<<32 ) + UnpackDword();
++	uint32 uMatchWeight = UnpackDword ();
++
++	field[0]->store ( uMatchID, 1 );
++	field[1]->store ( uMatchWeight, 1 );
++	field[2]->store ( (const char*)m_pCurrentKey, m_iCurrentKeyLen, &my_charset_bin );
++
++	for ( uint32 i=0; i<m_iAttrs; i++ )
++	{
++		longlong iValue64 = 0;
++		uint32 uValue = UnpackDword ();
++		if ( m_dAttrs[i].m_uType==SPH_ATTR_BIGINT )
++			iValue64 = ( (longlong)uValue<<32 ) | UnpackDword();
++		if ( m_dAttrs[i].m_iField<0 )
++		{
++			// skip MVA
++			if ( m_dAttrs[i].m_uType & SPH_ATTR_MULTI )
++				for ( ; uValue>0 && !m_bUnpackError; uValue-- )
++					UnpackDword();
++			continue;
++		}
++
++		Field * af = field [ m_dAttrs[i].m_iField ];
++		switch ( m_dAttrs[i].m_uType )
++		{
++			case SPH_ATTR_INTEGER:
++			case SPH_ATTR_ORDINAL:
++			case SPH_ATTR_BOOL:
++				af->store ( uValue, 1 );
++				break;
++
++			case SPH_ATTR_FLOAT:
++				af->store ( sphDW2F(uValue) );
++				break;
++
++			case SPH_ATTR_TIMESTAMP:
++				if ( af->type()==MYSQL_TYPE_TIMESTAMP )
++					longstore ( af->ptr, uValue ); // because store() does not accept timestamps
++				else
++					af->store ( uValue, 1 );
++				break;
++
++			case SPH_ATTR_BIGINT:
++				af->store ( iValue64, 0 );
++				break;
++
++			case ( SPH_ATTR_MULTI | SPH_ATTR_INTEGER ):
++				if ( uValue<=0 )
++				{
++					// shortcut, empty MVA set
++					af->store ( "", 0, &my_charset_bin );
++
++				} else
++				{
++					// convert MVA set to comma-separated string
++					char sBuf[1024]; // FIXME! magic size
++					char * pCur = sBuf;
++
++					for ( ; uValue>0 && !m_bUnpackError; uValue-- )
++					{
++						uint32 uEntry = UnpackDword ();
++						if ( pCur < sBuf+sizeof(sBuf)-16 ) // 10 chars per 32bit value plus some safety bytes
++						{
++							snprintf ( pCur, sBuf+sizeof(sBuf)-pCur, "%u", uEntry );
++							while ( *pCur ) *pCur++;
++							if ( uValue>1 )
++								*pCur++ = ','; // non-trailing commas
++						}
++					}
++
++					af->store ( sBuf, pCur-sBuf, &my_charset_bin );
++				}
++				break;
++
++			default:
++				my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: unhandled attr type" );
++				SafeDeleteArray ( m_pResponse );
++				SPH_RET ( HA_ERR_END_OF_FILE );
++		}
++	}
++
++	if ( m_bUnpackError )
++	{
++		my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: response unpacker failed" );
++		SafeDeleteArray ( m_pResponse );
++		SPH_RET ( HA_ERR_END_OF_FILE );
++	}
++
++	// zero out unmapped fields
++	for ( int i=SPHINXSE_SYSTEM_COLUMNS; i<(int)table->s->fields; i++ )
++		if ( m_dUnboundFields[i]!=SPH_ATTR_NONE )
++			switch ( m_dUnboundFields[i] )
++	{
++		case SPH_ATTR_INTEGER:		table->field[i]->store ( 0, 1 ); break;
++		case SPH_ATTR_TIMESTAMP:	longstore ( table->field[i]->ptr, 0 ); break;
++		default:
++			my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0),
++				"INTERNAL ERROR: unhandled unbound field type %d", m_dUnboundFields[i] );
++			SafeDeleteArray ( m_pResponse );
++			SPH_RET ( HA_ERR_END_OF_FILE );
++	}
++
++	memset ( buf, 0, table->s->null_bytes );
++	m_iCurrentPos++;
++
++	#if MYSQL_VERSION_ID > 50100
++	dbug_tmp_restore_column_map ( table->write_set, org_bitmap );
++	#endif
++
++	SPH_RET(0);
++}
++
++
++// Used to read backwards through the index.
++int ha_sphinx::index_prev ( byte * )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( HA_ERR_WRONG_COMMAND );
++}
++
++
++// index_first() asks for the first key in the index.
++//
++// Called from opt_range.cc, opt_sum.cc, sql_handler.cc,
++// and sql_select.cc.
++int ha_sphinx::index_first ( byte * )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( HA_ERR_END_OF_FILE );
++}
++
++// index_last() asks for the last key in the index.
++//
++// Called from opt_range.cc, opt_sum.cc, sql_handler.cc,
++// and sql_select.cc.
++int ha_sphinx::index_last ( byte * )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( HA_ERR_WRONG_COMMAND );
++}
++
++
++int ha_sphinx::rnd_init ( bool )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET(0);
++}
++
++
++int ha_sphinx::rnd_end()
++{
++	SPH_ENTER_METHOD();
++	SPH_RET(0);
++}
++
++
++int ha_sphinx::rnd_next ( byte * )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( HA_ERR_END_OF_FILE );
++}
++
++
++void ha_sphinx::position ( const byte * )
++{
++	SPH_ENTER_METHOD();
++	SPH_VOID_RET();
++}
++
++
++// This is like rnd_next, but you are given a position to use
++// to determine the row. The position will be of the type that you stored in
++// ref. You can use ha_get_ptr(pos,ref_length) to retrieve whatever key
++// or position you saved when position() was called.
++// Called from filesort.cc records.cc sql_insert.cc sql_select.cc sql_update.cc.
++int ha_sphinx::rnd_pos ( byte *, byte * )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( HA_ERR_WRONG_COMMAND );
++}
++
++
++#if MYSQL_VERSION_ID>=50030
++int ha_sphinx::info ( uint )
++#else
++void ha_sphinx::info ( uint )
++#endif
++{
++	SPH_ENTER_METHOD();
++
++	if ( table->s->keys>0 )
++		table->key_info[0].rec_per_key[0] = 1;
++
++	#if MYSQL_VERSION_ID>50100
++	stats.records = 20;
++	#else
++	records = 20;
++	#endif
++
++#if MYSQL_VERSION_ID>=50030
++	SPH_RET(0);
++#else
++	SPH_VOID_RET();
++#endif
++}
++
++
++int ha_sphinx::reset ()
++{
++	SPH_ENTER_METHOD();
++	CSphSEThreadData * pTls = GetTls ();
++	if ( pTls )
++		pTls->m_bQuery = false;
++	SPH_RET(0);
++}
++
++
++int ha_sphinx::delete_all_rows()
++{
++	SPH_ENTER_METHOD();
++	SPH_RET ( HA_ERR_WRONG_COMMAND );
++}
++
++
++// First you should go read the section "locking functions for mysql" in
++// lock.cc to understand this.
++// This create a lock on the table. If you are implementing a storage engine
++// that can handle transacations look at ha_berkely.cc to see how you will
++// want to go about doing this. Otherwise you should consider calling flock()
++// here.
++//
++// Called from lock.cc by lock_external() and unlock_external(). Also called
++// from sql_table.cc by copy_data_between_tables().
++int ha_sphinx::external_lock ( THD *, int )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET(0);
++}
++
++
++THR_LOCK_DATA ** ha_sphinx::store_lock ( THD *, THR_LOCK_DATA ** to,
++	enum thr_lock_type lock_type )
++{
++	SPH_ENTER_METHOD();
++
++	if ( lock_type!=TL_IGNORE && m_tLock.type==TL_UNLOCK )
++		m_tLock.type = lock_type;
++
++	*to++ = &m_tLock;
++	SPH_RET(to);
++}
++
++
++int ha_sphinx::delete_table ( const char * )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET(0);
++}
++
++
++// Renames a table from one name to another from alter table call.
++//
++// If you do not implement this, the default rename_table() is called from
++// handler.cc and it will delete all files with the file extentions returned
++// by bas_ext().
++//
++// Called from sql_table.cc by mysql_rename_table().
++int ha_sphinx::rename_table ( const char *, const char * )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET(0);
++}
++
++
++// Given a starting key, and an ending key estimate the number of rows that
++// will exist between the two. end_key may be empty which in case determine
++// if start_key matches any rows.
++//
++// Called from opt_range.cc by check_quick_keys().
++ha_rows ha_sphinx::records_in_range ( uint, key_range *, key_range * )
++{
++	SPH_ENTER_METHOD();
++	SPH_RET(3); // low number to force index usage
++}
++
++
++// create() is called to create a database. The variable name will have the name
++// of the table. When create() is called you do not need to worry about opening
++// the table. Also, the FRM file will have already been created so adjusting
++// create_info will not do you any good. You can overwrite the frm file at this
++// point if you wish to change the table definition, but there are no methods
++// currently provided for doing that.
++//
++// Called from handle.cc by ha_create_table().
++int ha_sphinx::create ( const char * name, TABLE * table, HA_CREATE_INFO * )
++{
++	SPH_ENTER_METHOD();
++	char sError[256];
++
++	CSphSEShare tInfo;
++	if ( !ParseUrl ( &tInfo, table, true ) )
++		SPH_RET(-1);
++
++	// check SphinxAPI table
++	for ( ; !tInfo.m_bSphinxQL; )
++	{
++		// check system fields (count and types)
++		if ( table->s->fields<SPHINXSE_SYSTEM_COLUMNS )
++		{
++			my_snprintf ( sError, sizeof(sError), "%s: there MUST be at least %d columns",
++				name, SPHINXSE_SYSTEM_COLUMNS );
++			break;
++		}
++
++		if ( !IsIDField ( table->field[0] ) )
++		{
++			my_snprintf ( sError, sizeof(sError), "%s: 1st column (docid) MUST be unsigned integer or bigint", name );
++			break;
++		}
++
++		if ( !IsIntegerFieldType ( table->field[1]->type() ) )
++		{
++			my_snprintf ( sError, sizeof(sError), "%s: 2nd column (weight) MUST be integer or bigint", name );
++			break;
++		}
++
++		enum_field_types f2 = table->field[2]->type();
++		if ( f2!=MYSQL_TYPE_VARCHAR
++			&& f2!=MYSQL_TYPE_BLOB && f2!=MYSQL_TYPE_MEDIUM_BLOB && f2!=MYSQL_TYPE_LONG_BLOB && f2!=MYSQL_TYPE_TINY_BLOB )
++		{
++			my_snprintf ( sError, sizeof(sError), "%s: 3rd column (search query) MUST be varchar or text", name );
++			break;
++		}
++
++		// check attributes
++		int i;
++		for ( i=3; i<(int)table->s->fields; i++ )
++		{
++			enum_field_types eType = table->field[i]->type();
++			if ( eType!=MYSQL_TYPE_TIMESTAMP && !IsIntegerFieldType(eType) && eType!=MYSQL_TYPE_VARCHAR && eType!=MYSQL_TYPE_FLOAT )
++			{
++				my_snprintf ( sError, sizeof(sError), "%s: %dth column (attribute %s) MUST be integer, bigint, timestamp, varchar, or float",
++					name, i+1, table->field[i]->field_name );
++				break;
++			}
++		}
++
++		if ( i!=(int)table->s->fields )
++			break;
++
++		// check index
++		if (
++			table->s->keys!=1 ||
++			table->key_info[0].key_parts!=1 ||
++			strcasecmp ( table->key_info[0].key_part[0].field->field_name, table->field[2]->field_name ) )
++		{
++			my_snprintf ( sError, sizeof(sError), "%s: there must be an index on '%s' column",
++				name, table->field[2]->field_name );
++			break;
++		}
++
++		// all good
++		sError[0] = '\0';
++		break;
++	}
++
++	// check SphinxQL table
++	for ( ; tInfo.m_bSphinxQL; )
++	{
++		sError[0] = '\0';
++
++		// check that 1st column is id, is of int type, and has an index
++		if ( strcmp ( table->field[0]->field_name, "id" ) )
++		{
++			my_snprintf ( sError, sizeof(sError), "%s: 1st column must be called 'id'", name );
++			break;
++		}
++
++		if ( !IsIDField ( table->field[0] ) )
++		{
++			my_snprintf ( sError, sizeof(sError), "%s: 'id' column must be INT UNSIGNED or BIGINT", name );
++			break;
++		}
++
++		// check index
++		if (
++			table->s->keys!=1 ||
++			table->key_info[0].key_parts!=1 ||
++			strcasecmp ( table->key_info[0].key_part[0].field->field_name, "id" ) )
++		{
++			my_snprintf ( sError, sizeof(sError), "%s: 'id' column must be indexed", name );
++			break;
++		}
++
++		// check column types
++		for ( int i=1; i<(int)table->s->fields; i++ )
++		{
++			enum_field_types eType = table->field[i]->type();
++			if ( eType!=MYSQL_TYPE_TIMESTAMP && !IsIntegerFieldType(eType) && eType!=MYSQL_TYPE_VARCHAR && eType!=MYSQL_TYPE_FLOAT )
++			{
++				my_snprintf ( sError, sizeof(sError), "%s: column %s is of unsupported type (use int/bigint/timestamp/varchar/float)",
++					name, i+1, table->field[i]->field_name );
++				break;
++			}
++		}
++		if ( sError[0] )
++			break;
++
++		// all good
++		break;
++	}
++
++	// report and bail
++	if ( sError[0] )
++	{
++		my_error ( ER_CANT_CREATE_TABLE, MYF(0), sError, -1 );
++		SPH_RET(-1);
++	}
++
++	SPH_RET(0);
++}
++
++// show functions
++
++#if MYSQL_VERSION_ID<50100
++#define SHOW_VAR_FUNC_BUFF_SIZE 1024
++#endif
++
++CSphSEStats * sphinx_get_stats ( THD * thd, SHOW_VAR * out )
++{
++#if MYSQL_VERSION_ID>50100
++	if ( sphinx_hton_ptr )
++	{
++		CSphSEThreadData *pTls = (CSphSEThreadData *) *thd_ha_data ( thd, sphinx_hton_ptr );
++
++		if ( pTls && pTls->m_bStats )
++			return &pTls->m_tStats;
++	}
++#else
++	CSphSEThreadData *pTls = (CSphSEThreadData *) thd->ha_data[sphinx_hton.slot];
++	if ( pTls && pTls->m_bStats )
++		return &pTls->m_tStats;
++#endif
++
++	out->type = SHOW_CHAR;
++	out->value = "";
++	return 0;
++}
++
++int sphinx_showfunc_total ( THD * thd, SHOW_VAR * out, char * )
++{
++	CSphSEStats * pStats = sphinx_get_stats ( thd, out );
++	if ( pStats )
++	{
++		out->type = SHOW_INT;
++		out->value = (char *) &pStats->m_iMatchesTotal;
++	}
++	return 0;
++}
++
++int sphinx_showfunc_total_found ( THD * thd, SHOW_VAR * out, char * )
++{
++	CSphSEStats * pStats = sphinx_get_stats ( thd, out );
++	if ( pStats )
++	{
++		out->type = SHOW_INT;
++		out->value = (char *) &pStats->m_iMatchesFound;
++	}
++	return 0;
++}
++
++int sphinx_showfunc_time ( THD * thd, SHOW_VAR * out, char * )
++{
++	CSphSEStats * pStats = sphinx_get_stats ( thd, out );
++	if ( pStats )
++	{
++		out->type = SHOW_INT;
++		out->value = (char *) &pStats->m_iQueryMsec;
++	}
++	return 0;
++}
++
++int sphinx_showfunc_word_count ( THD * thd, SHOW_VAR * out, char * )
++{
++	CSphSEStats * pStats = sphinx_get_stats ( thd, out );
++	if ( pStats )
++	{
++		out->type = SHOW_INT;
++		out->value = (char *) &pStats->m_iWords;
++	}
++	return 0;
++}
++
++int sphinx_showfunc_words ( THD * thd, SHOW_VAR * out, char * sBuffer )
++{
++#if MYSQL_VERSION_ID>50100
++	if ( sphinx_hton_ptr )
++	{
++		CSphSEThreadData * pTls = (CSphSEThreadData *) *thd_ha_data ( thd, sphinx_hton_ptr );
++#else
++	{
++		CSphSEThreadData * pTls = (CSphSEThreadData *) thd->ha_data[sphinx_hton.slot];
++#endif
++		if ( pTls && pTls->m_bStats )
++		{
++			CSphSEStats * pStats = &pTls->m_tStats;
++			if ( pStats && pStats->m_iWords )
++			{
++				uint uBuffLen = 0;
++
++				out->type = SHOW_CHAR;
++				out->value = sBuffer;
++
++				// the following is partially based on code in sphinx_show_status()
++				sBuffer[0] = 0;
++				for ( int i=0; i<pStats->m_iWords; i++ )
++				{
++					CSphSEWordStats & tWord = pStats->m_dWords[i];
++					uBuffLen = my_snprintf ( sBuffer, SHOW_VAR_FUNC_BUFF_SIZE, "%s%s:%d:%d ", sBuffer,
++						tWord.m_sWord, tWord.m_iDocs, tWord.m_iHits );
++				}
++
++				if ( uBuffLen > 0 )
++				{
++					// trim last space
++					sBuffer [ --uBuffLen ] = 0;
++
++					if ( pTls->m_pQueryCharset )
++					{
++						// String::c_ptr() will nul-terminate the buffer.
++						//
++						// NOTE: It's not entirely clear whether this conversion is necessary at all.
++
++						String sConvert;
++						uint iErrors;
++						sConvert.copy ( sBuffer, uBuffLen, pTls->m_pQueryCharset, system_charset_info, &iErrors );
++						memcpy ( sBuffer, sConvert.c_ptr(), sConvert.length() + 1 );
++					}
++				}
++
++				return 0;
++			}
++		}
++	}
++
++	out->type = SHOW_CHAR;
++	out->value = "";
++	return 0;
++}
++
++int sphinx_showfunc_error ( THD * thd, SHOW_VAR * out, char * )
++{
++	CSphSEStats * pStats = sphinx_get_stats ( thd, out );
++	if ( pStats && pStats->m_bLastError )
++	{
++		out->type = SHOW_CHAR;
++		out->value = pStats->m_sLastMessage;
++	}
++	return 0;
++}
++
++#if MYSQL_VERSION_ID>50100
++struct st_mysql_storage_engine sphinx_storage_engine =
++{
++	MYSQL_HANDLERTON_INTERFACE_VERSION
++};
++
++struct st_mysql_show_var sphinx_status_vars[] =
++{
++	{"sphinx_total",		(char *)sphinx_showfunc_total,			SHOW_FUNC},
++	{"sphinx_total_found",	(char *)sphinx_showfunc_total_found,	SHOW_FUNC},
++	{"sphinx_time",			(char *)sphinx_showfunc_time,			SHOW_FUNC},
++	{"sphinx_word_count",	(char *)sphinx_showfunc_word_count,		SHOW_FUNC},
++	{"sphinx_words",		(char *)sphinx_showfunc_words,			SHOW_FUNC},
++	{"sphinx_error",		(char *)sphinx_showfunc_error,			SHOW_FUNC},
++	{0, 0, (enum_mysql_show_type)0}
++};
++
++
++mysql_declare_plugin(sphinx)
++{
++	MYSQL_STORAGE_ENGINE_PLUGIN,
++	&sphinx_storage_engine,
++	sphinx_hton_name,
++	"Sphinx developers",
++	sphinx_hton_comment,
++	PLUGIN_LICENSE_GPL,
++	sphinx_init_func, // Plugin Init
++	sphinx_done_func, // Plugin Deinit
++	0x0001, // 0.1
++	sphinx_status_vars,
++	NULL,
++	NULL
++}
++mysql_declare_plugin_end;
++
++#endif // >50100
++
++//
++// $Id: ha_sphinx.cc 2752 2011-03-29 08:21:05Z tomat $
++//
+diff -uNr storage/sphinx/ha_sphinx.h storage/sphinx/ha_sphinx.h
+--- storage/sphinx/ha_sphinx.h	1970-01-01 01:00:00.000000000 +0100
++++ storage/sphinx/ha_sphinx.h	2011-10-13 00:59:59.282957578 +0200
+@@ -0,0 +1,169 @@
++//
++// $Id: ha_sphinx.h 2428 2010-08-03 11:38:09Z shodan $
++//
++
++#ifdef USE_PRAGMA_INTERFACE
++#pragma interface // gcc class implementation
++#endif
++
++
++#if MYSQL_VERSION_ID>=50515
++#define TABLE_ARG	TABLE_SHARE
++#elif MYSQL_VERSION_ID>50100
++#define TABLE_ARG	st_table_share
++#else
++#define TABLE_ARG	st_table
++#endif
++
++
++#if MYSQL_VERSION_ID>=50120
++typedef uchar byte;
++#endif
++
++
++/// forward decls
++class THD;
++struct CSphReqQuery;
++struct CSphSEShare;
++struct CSphSEAttr;
++struct CSphSEStats;
++struct CSphSEThreadData;
++
++/// Sphinx SE handler class
++class ha_sphinx : public handler
++{
++protected:
++	THR_LOCK_DATA	m_tLock;				///< MySQL lock
++
++	CSphSEShare *	m_pShare;				///< shared lock info
++
++	uint			m_iMatchesTotal;
++	uint			m_iCurrentPos;
++	const byte *	m_pCurrentKey;
++	uint			m_iCurrentKeyLen;
++
++	char *			m_pResponse;			///< searchd response storage
++	char *			m_pResponseEnd;			///< searchd response storage end (points to wilderness!)
++	char *			m_pCur;					///< current position into response
++	bool			m_bUnpackError;			///< any errors while unpacking response
++
++public:
++#if MYSQL_VERSION_ID<50100
++					ha_sphinx ( TABLE_ARG * table_arg ); // NOLINT
++#else
++					ha_sphinx ( handlerton * hton, TABLE_ARG * table_arg );
++#endif
++					~ha_sphinx () {}
++
++	const char *	table_type () const		{ return "SPHINX"; }	///< SE name for display purposes
++	const char *	index_type ( uint )		{ return "HASH"; }		///< index type name for display purposes
++	const char **	bas_ext () const;								///< my file extensions
++
++	#if MYSQL_VERSION_ID>50100
++	ulonglong		table_flags () const	{ return HA_CAN_INDEX_BLOBS; }			///< bitmap of implemented flags (see handler.h for more info)
++	#else
++	ulong			table_flags () const	{ return HA_CAN_INDEX_BLOBS; }			///< bitmap of implemented flags (see handler.h for more info)
++	#endif
++
++	ulong			index_flags ( uint, uint, bool ) const	{ return 0; }	///< bitmap of flags that says how SE implements indexes
++	uint			max_supported_record_length () const	{ return HA_MAX_REC_LENGTH; }
++	uint			max_supported_keys () const				{ return 1; }
++	uint			max_supported_key_parts () const		{ return 1; }
++	uint			max_supported_key_length () const		{ return MAX_KEY_LENGTH; }
++	uint			max_supported_key_part_length () const	{ return MAX_KEY_LENGTH; }
++
++	#if MYSQL_VERSION_ID>50100
++	virtual double	scan_time ()	{ return (double)( stats.records+stats.deleted )/20.0 + 10; }	///< called in test_quick_select to determine if indexes should be used
++	#else
++	virtual double	scan_time ()	{ return (double)( records+deleted )/20.0 + 10; }				///< called in test_quick_select to determine if indexes should be used
++	#endif
++
++	virtual double	read_time ( ha_rows rows )	{ return (double)rows/20.0 + 1; }					///< index read time estimate
++
++public:
++	int				open ( const char * name, int mode, uint test_if_locked );
++	int				close ();
++
++	int				write_row ( byte * buf );
++	int				update_row ( const byte * old_data, byte * new_data );
++	int				delete_row ( const byte * buf );
++	int				extra ( enum ha_extra_function op );
++
++	int				index_init ( uint keynr, bool sorted ); // 5.1.x
++	int				index_init ( uint keynr ) { return index_init ( keynr, false ); } // 5.0.x
++
++	int				index_end ();
++	int				index_read ( byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag );
++	int				index_read_idx ( byte * buf, uint idx, const byte * key, uint key_len, enum ha_rkey_function find_flag );
++	int				index_next ( byte * buf );
++	int				index_next_same ( byte * buf, const byte * key, uint keylen );
++	int				index_prev ( byte * buf );
++	int				index_first ( byte * buf );
++	int				index_last ( byte * buf );
++
++	int				get_rec ( byte * buf, const byte * key, uint keylen );
++
++	int				rnd_init ( bool scan );
++	int				rnd_end ();
++	int				rnd_next ( byte * buf );
++	int				rnd_pos ( byte * buf, byte * pos );
++	void			position ( const byte * record );
++
++#if MYSQL_VERSION_ID>=50030
++	int				info ( uint );
++#else
++	void			info ( uint );
++#endif
++
++	int				reset();
++	int				external_lock ( THD * thd, int lock_type );
++	int				delete_all_rows ();
++	ha_rows			records_in_range ( uint inx, key_range * min_key, key_range * max_key );
++
++	int				delete_table ( const char * from );
++	int				rename_table ( const char * from, const char * to );
++	int				create ( const char * name, TABLE * form, HA_CREATE_INFO * create_info );
++
++	THR_LOCK_DATA **		store_lock ( THD * thd, THR_LOCK_DATA ** to, enum thr_lock_type lock_type );
++
++public:
++	virtual const COND *	cond_push ( const COND *cond );
++	virtual void			cond_pop ();
++
++private:
++	uint32			m_iFields;
++	char **			m_dFields;
++
++	uint32			m_iAttrs;
++	CSphSEAttr *	m_dAttrs;
++	int				m_bId64;
++
++	int *			m_dUnboundFields;
++
++private:
++	int				Connect ( const char * sQueryHost, ushort uPort );
++	int				ConnectAPI ( const char * sQueryHost, int iQueryPort );
++	int				HandleMysqlError ( struct st_mysql * pConn, int iErrCode );
++
++	uint32			UnpackDword ();
++	char *			UnpackString ();
++	bool			UnpackSchema ();
++	bool			UnpackStats ( CSphSEStats * pStats );
++
++	CSphSEThreadData *	GetTls ();
++};
++
++
++#if MYSQL_VERSION_ID < 50100
++bool sphinx_show_status ( THD * thd );
++#endif
++
++int sphinx_showfunc_total_found ( THD *, SHOW_VAR *, char * );
++int sphinx_showfunc_total ( THD *, SHOW_VAR *, char * );
++int sphinx_showfunc_time ( THD *, SHOW_VAR *, char * );
++int sphinx_showfunc_word_count ( THD *, SHOW_VAR *, char * );
++int sphinx_showfunc_words ( THD *, SHOW_VAR *, char * );
++
++//
++// $Id: ha_sphinx.h 2428 2010-08-03 11:38:09Z shodan $
++//
+diff -uNr storage/sphinx/INSTALL storage/sphinx/INSTALL
+--- storage/sphinx/INSTALL	1970-01-01 01:00:00.000000000 +0100
++++ storage/sphinx/INSTALL	2010-07-07 18:12:02.000000000 +0200
+@@ -0,0 +1,48 @@
++Building MySQL with SphinxSE
++=============================
++
++Note: BUILD/autorun.sh step on Linux might malfunction with some
++versions of automake; autorun.sh will not fail but the build will.
++automake 1.9.6 is known to work.
++
++
++
++MySQL 5.0.x on Linux
++---------------------
++
++tar zxvf mysql-5.0.91.tar.gz
++cp -R mysqlse mysql-5.0.91/sql/sphinx
++cd mysql-5.0.91
++
++patch -p1 -i sql/sphinx/sphinx.5.0.91.diff
++sh BUILD/autorun.sh
++./configure --with-sphinx-storage-engine
++make
++
++
++
++MySQL 5.1.x on Linux
++---------------------
++
++tar zxvf mysql-5.1.47.tar.gz
++cp -R -p mysqlse mysql-5.1.47/storage/sphinx
++cd mysql-5.1.47
++
++sh BUILD/autorun.sh
++./configure --with-plugins=sphinx
++make
++
++
++
++MySQL 5.0.x on Windows
++-----------------------
++
++tar zxvf mysql-5.0.91.tar.gz
++cp -R mysqlse mysql-5.0.91/sql/sphinx
++cd mysql-5.0.91
++
++patch -p1 -i sql/sphinx/sphinx.5.0.91.diff
++win/configure.js WITH_SPHINX_STORAGE_ENGINE
++win/build-vs8
++
++--eof--
+diff -uNr storage/sphinx/Makefile.am storage/sphinx/Makefile.am
+--- storage/sphinx/Makefile.am	1970-01-01 01:00:00.000000000 +0100
++++ storage/sphinx/Makefile.am	2009-02-13 22:26:46.000000000 +0100
+@@ -0,0 +1,59 @@
++# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
++# 
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++# 
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++# 
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++
++#called from the top level Makefile
++
++MYSQLDATAdir =          $(localstatedir)
++MYSQLSHAREdir =         $(pkgdatadir)
++MYSQLBASEdir=           $(prefix)
++MYSQLLIBdir=            $(pkglibdir)
++pkgplugindir =          $(pkglibdir)/plugin
++INCLUDES =              -I$(top_srcdir)/include -I$(top_builddir)/include \
++			-I$(top_srcdir)/regex \
++			-I$(top_srcdir)/sql \
++                        -I$(srcdir)
++SUBDIRS =				../../include ../../mysys ../../strings ../../dbug ../../extra
++WRAPLIBS=
++
++LDADD =
++
++DEFS= @DEFS@ \
++      -D_REENTRANT -D_PTHREADS -DENGINE -DSTORAGE_ENGINE -DMYSQL_SERVER
++
++noinst_HEADERS =	ha_sphinx.h
++
++EXTRA_LTLIBRARIES =	ha_sphinx.la
++pkgplugin_LTLIBRARIES = @plugin_sphinx_shared_target@ sphinx.la
++
++ha_sphinx_la_LDFLAGS =	-module -rpath $(MYSQLLIBdir)
++ha_sphinx_la_CXXFLAGS=	$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
++ha_sphinx_la_CFLAGS =	$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
++ha_sphinx_la_SOURCES =	ha_sphinx.cc
++
++sphinx_la_LDFLAGS = -module
++sphinx_la_CXXFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
++sphinx_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
++sphinx_la_SOURCES = snippets_udf.cc
++
++EXTRA_LIBRARIES =	libsphinx.a
++noinst_LIBRARIES =	@plugin_sphinx_static_target@
++libsphinx_a_CXXFLAGS =	$(AM_CFLAGS)
++libsphinx_a_CFLAGS =	$(AM_CFLAGS)
++libsphinx_a_SOURCES=	ha_sphinx.cc
++
++EXTRA_DIST =		cmakelists.txt
++# Don't update the files from bitkeeper
++%::SCCS/s.%
+diff -uNr storage/sphinx/make-patch.sh storage/sphinx/make-patch.sh
+--- storage/sphinx/make-patch.sh	1970-01-01 01:00:00.000000000 +0100
++++ storage/sphinx/make-patch.sh	2008-09-05 20:06:30.000000000 +0200
+@@ -0,0 +1,36 @@
++#!/bin/sh
++
++OUT=$1
++ORIG=$2
++NEW=$3
++
++if [ ! \( "$1" -a "$2" -a "$3" \) ]; then
++	echo "$0 <patch> <original> <new>"
++	exit 1
++fi
++
++FILES='
++/config/ac-macros/ha_sphinx.m4
++/configure.in
++/libmysqld/Makefile.am
++/sql/handler.cc
++/sql/handler.h
++/sql/Makefile.am
++/sql/mysqld.cc
++/sql/mysql_priv.h
++/sql/set_var.cc
++/sql/sql_lex.h
++/sql/sql_parse.cc
++/sql/sql_yacc.yy
++/sql/structs.h
++/sql/sql_show.cc
++'
++
++rm -f $OUT
++if [ -e $OUT ]; then
++	exit 1
++fi
++
++for name in $FILES; do
++	diff -BNru "$ORIG$name" "$NEW$name" >> $OUT
++done
+diff -uNr storage/sphinx/plug.in storage/sphinx/plug.in
+--- storage/sphinx/plug.in	1970-01-01 01:00:00.000000000 +0100
++++ storage/sphinx/plug.in	2006-06-07 09:28:43.000000000 +0200
+@@ -0,0 +1,5 @@
++MYSQL_STORAGE_ENGINE(sphinx,,  [Sphinx Storage Engine],
++        [Sphinx Storage Engines], [max,max-no-ndb])
++MYSQL_PLUGIN_DIRECTORY(sphinx, [storage/sphinx])
++MYSQL_PLUGIN_STATIC(sphinx,    [libsphinx.a])
++MYSQL_PLUGIN_DYNAMIC(sphinx,   [ha_sphinx.la])
+diff -uNr storage/sphinx/snippets_udf.cc storage/sphinx/snippets_udf.cc
+--- storage/sphinx/snippets_udf.cc	1970-01-01 01:00:00.000000000 +0100
++++ storage/sphinx/snippets_udf.cc	2011-01-01 03:33:06.000000000 +0100
+@@ -0,0 +1,768 @@
++//
++// $Id: snippets_udf.cc 2616 2011-01-01 02:33:06Z shodan $
++//
++
++//
++// Copyright (c) 2001-2011, Andrew Aksyonoff
++// Copyright (c) 2008-2011, Sphinx Technologies Inc
++// All rights reserved
++//
++// This program is free software; you can redistribute it and/or modify
++// it under the terms of the GNU General Public License. You should have
++// received a copy of the GPL license along with this program; if you
++// did not, you can find it at http://www.gnu.org/
++//
++
++#include <stdio.h>
++#include <string.h>
++#include <assert.h>
++
++#include <sys/un.h>
++#include <netdb.h>
++
++#include <mysql_version.h>
++
++#if MYSQL_VERSION_ID>50100
++#include "mysql_priv.h"
++#include <mysql/plugin.h>
++#else
++#include "../mysql_priv.h"
++#endif
++
++#include <mysys_err.h>
++#include <my_sys.h>
++
++#if MYSQL_VERSION_ID>=50120
++typedef uchar byte;
++#endif
++
++/// partially copy-pasted stuff that should be moved elsewhere
++
++#if UNALIGNED_RAM_ACCESS
++
++/// pass-through wrapper
++template < typename T > inline T sphUnalignedRead ( const T & tRef )
++{
++	return tRef;
++}
++
++/// pass-through wrapper
++template < typename T > void sphUnalignedWrite ( void * pPtr, const T & tVal )
++{
++	*(T*)pPtr = tVal;
++}
++
++#else
++
++/// unaligned read wrapper for some architectures (eg. SPARC)
++template < typename T >
++inline T sphUnalignedRead ( const T & tRef )
++{
++	T uTmp;
++	byte * pSrc = (byte *) &tRef;
++	byte * pDst = (byte *) &uTmp;
++	for ( int i=0; i<(int)sizeof(T); i++ )
++		*pDst++ = *pSrc++;
++	return uTmp;
++}
++
++/// unaligned write wrapper for some architectures (eg. SPARC)
++template < typename T >
++void sphUnalignedWrite ( void * pPtr, const T & tVal )
++{
++	byte * pDst = (byte *) pPtr;
++	byte * pSrc = (byte *) &tVal;
++	for ( int i=0; i<(int)sizeof(T); i++ )
++		*pDst++ = *pSrc++;
++}
++
++#endif
++
++#define SPHINXSE_MAX_ALLOC			(16*1024*1024)
++
++#define SafeDelete(_arg)		{ if ( _arg ) delete ( _arg );		(_arg) = NULL; }
++#define SafeDeleteArray(_arg)	{ if ( _arg ) delete [] ( _arg );	(_arg) = NULL; }
++
++#define Min(a,b) ((a)<(b)?(a):(b))
++
++typedef unsigned int DWORD;
++
++inline DWORD sphF2DW ( float f ) { union { float f; uint32 d; } u; u.f = f; return u.d; }
++
++static char * sphDup ( const char * sSrc, int iLen=-1 )
++{
++	if ( !sSrc )
++		return NULL;
++
++	if ( iLen<0 )
++		iLen = strlen(sSrc);
++
++	char * sRes = new char [ 1+iLen ];
++	memcpy ( sRes, sSrc, iLen );
++	sRes[iLen] = '\0';
++	return sRes;
++}
++
++static inline void sphShowErrno ( const char * sCall )
++{
++	char sError[256];
++	snprintf ( sError, sizeof(sError), "%s() failed: [%d] %s", sCall, errno, strerror(errno) );
++	my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), sError );
++}
++
++static const bool sphReportErrors = true;
++
++static bool sphSend ( int iFd, const char * pBuffer, int iSize, bool bReportErrors = false )
++{
++	assert ( pBuffer );
++	assert ( iSize > 0 );
++
++	const int iResult = send ( iFd, pBuffer, iSize, 0 );
++	if ( iResult != iSize )
++	{
++		if ( bReportErrors ) sphShowErrno("send");
++		return false;
++	}
++	return true;
++}
++
++static bool sphRecv ( int iFd, char * pBuffer, int iSize, bool bReportErrors = false )
++{
++	assert ( pBuffer );
++	assert ( iSize > 0 );
++	
++	while ( iSize )
++	{
++		const int iResult = recv ( iFd, pBuffer, iSize, 0 );
++		if ( iResult > 0 )
++		{
++			iSize -= iResult;
++			pBuffer += iSize;
++		}
++		else if ( iResult == 0 )
++		{
++			if ( bReportErrors )
++				my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "recv() failed: disconnected" );
++			return false;
++		}
++		else
++		{
++			if ( bReportErrors ) sphShowErrno("recv");
++			return false;
++		}
++	}
++	return true;
++}
++
++enum
++{
++	SPHINX_SEARCHD_PROTO		= 1,
++
++	SEARCHD_COMMAND_SEARCH		= 0,
++	SEARCHD_COMMAND_EXCERPT		= 1,
++
++	VER_COMMAND_SEARCH		= 0x116,
++	VER_COMMAND_EXCERPT		= 0x100,
++};
++
++/// known answers
++enum
++{
++	SEARCHD_OK		= 0,	///< general success, command-specific reply follows
++	SEARCHD_ERROR	= 1,	///< general failure, error message follows
++	SEARCHD_RETRY	= 2,	///< temporary failure, error message follows, client should retry later
++	SEARCHD_WARNING	= 3		///< general success, warning message and command-specific reply follow
++};
++
++#define SPHINXSE_DEFAULT_SCHEME		"sphinx"
++#define SPHINXSE_DEFAULT_HOST		"127.0.0.1"
++#define SPHINXSE_DEFAULT_PORT		9312
++#define SPHINXSE_DEFAULT_INDEX		"*"
++
++class CSphBuffer
++{
++private:
++	bool m_bOverrun;
++	int m_iSize;
++	int m_iLeft;
++	char * m_pBuffer;
++	char * m_pCurrent;
++
++public:
++	CSphBuffer ( const int iSize )
++		: m_bOverrun ( false )
++		, m_iSize ( iSize )
++		, m_iLeft ( iSize )
++	{
++		assert ( iSize > 0 );
++		m_pBuffer = new char[iSize];
++		m_pCurrent = m_pBuffer;
++	}
++
++	~CSphBuffer ()
++	{
++		SafeDelete ( m_pBuffer );
++	}
++
++	const char * Ptr() const { return m_pBuffer; }
++
++	bool Finalize()
++	{
++		return !( m_bOverrun || m_iLeft != 0 || m_pCurrent - m_pBuffer != m_iSize );
++	}
++	
++	void SendBytes ( const void * pBytes, int iBytes );
++	
++	void SendWord ( short int v )					{ v = ntohs(v); SendBytes ( &v, sizeof(v) ); }
++	void SendInt ( int v )							{ v = ntohl(v); SendBytes ( &v, sizeof(v) ); }
++	void SendDword ( DWORD v )						{ v = ntohl(v) ;SendBytes ( &v, sizeof(v) ); }
++	void SendUint64 ( ulonglong v )					{ SendDword ( uint(v>>32) ); SendDword ( uint(v&0xFFFFFFFFUL) ); }
++	void SendString ( const char * v )				{ SendString ( v, strlen(v) ); }
++	void SendString ( const char * v, int iLen )	{ SendDword(iLen); SendBytes ( v, iLen ); }
++	void SendFloat ( float v )						{ SendDword ( sphF2DW(v) ); }
++};
++
++void CSphBuffer::SendBytes ( const void * pBytes, int iBytes )
++{
++	if ( m_iLeft < iBytes )
++	{
++		m_bOverrun = true;
++		return;
++	}
++
++	memcpy ( m_pCurrent, pBytes, iBytes );
++
++	m_pCurrent += iBytes;
++	m_iLeft -= iBytes;
++}
++
++struct CSphUrl
++{
++	char * m_sBuffer;
++	char * m_sFormatted;
++	
++	char * m_sScheme;
++	char * m_sHost;
++	char * m_sIndex;
++	
++	int m_iPort;
++	
++	CSphUrl()
++		: m_sBuffer ( NULL )
++		, m_sFormatted ( NULL )
++		, m_sScheme ( SPHINXSE_DEFAULT_SCHEME )
++		, m_sHost ( SPHINXSE_DEFAULT_HOST )
++		, m_sIndex ( SPHINXSE_DEFAULT_INDEX )
++		, m_iPort ( SPHINXSE_DEFAULT_PORT )
++	{}
++	
++	~CSphUrl()
++	{
++		SafeDeleteArray ( m_sFormatted );
++		SafeDeleteArray ( m_sBuffer );
++	}
++	
++	bool Parse ( const char * sUrl, int iLen );
++	int Connect();
++	const char * Format();
++};
++
++const char * CSphUrl::Format()
++{
++	if ( !m_sFormatted )
++	{
++		int iSize = 15 + strlen(m_sHost) + strlen(m_sIndex);
++		m_sFormatted = new char [ iSize ];
++		if ( m_iPort )
++			snprintf ( m_sFormatted, iSize, "inet://%s:%d/%s", m_sHost, m_iPort, m_sIndex );
++		else
++			snprintf ( m_sFormatted, iSize, "unix://%s/%s", m_sHost, m_sIndex );
++	}
++	return m_sFormatted;
++}
++
++// the following scheme variants are recognized
++//
++// inet://host/index
++// inet://host:port/index
++// unix://unix/domain/socket:index
++// unix://unix/domain/socket
++bool CSphUrl::Parse ( const char * sUrl, int iLen )
++{
++	bool bOk = true;
++	while ( iLen )
++	{
++		bOk = false;
++		
++		m_sBuffer = sphDup ( sUrl, iLen );
++		m_sScheme = m_sBuffer;
++		
++		m_sHost = strstr ( m_sBuffer, "://" );
++		if ( !m_sHost )
++			break;
++		m_sHost[0] = '\0';
++		m_sHost += 2;
++		
++		if ( !strcmp ( m_sScheme, "unix" ) )
++		{
++			// unix-domain socket
++			m_iPort = 0;
++			if (!( m_sIndex = strrchr ( m_sHost, ':' ) ))
++				m_sIndex = SPHINXSE_DEFAULT_INDEX;
++			else
++			{
++				*m_sIndex++ = '\0';
++				if ( !*m_sIndex )
++					m_sIndex = SPHINXSE_DEFAULT_INDEX;
++			}
++			bOk = true;
++			break;
++		}
++		if( strcmp ( m_sScheme, "sphinx" ) != 0 && strcmp ( m_sScheme, "inet" ) != 0 )
++			break;
++
++		// inet
++		m_sHost++;
++		char * sPort = strchr ( m_sHost, ':' );
++		if ( sPort )
++		{
++			*sPort++ = '\0';
++			if ( *sPort )
++			{
++				m_sIndex = strchr ( sPort, '/' );
++				if ( m_sIndex )
++					*m_sIndex++ = '\0'; 
++				else
++					m_sIndex = SPHINXSE_DEFAULT_INDEX;
++				
++				m_iPort = atoi(sPort);
++				if ( !m_iPort )
++					m_iPort = SPHINXSE_DEFAULT_PORT;
++			}
++		} else
++		{
++			m_sIndex = strchr ( m_sHost, '/' );
++			if ( m_sIndex )
++				*m_sIndex++ = '\0';
++			else
++				m_sIndex = SPHINXSE_DEFAULT_INDEX;
++		}
++
++		bOk = true;
++		break;
++	}
++	
++	return bOk;
++}
++
++int CSphUrl::Connect()
++{
++	struct sockaddr_in sin;
++#ifndef __WIN__
++	struct sockaddr_un saun;
++#endif
++
++	int iDomain = 0;
++	int iSockaddrSize = 0;
++	struct sockaddr * pSockaddr = NULL;
++
++	in_addr_t ip_addr;
++
++	if ( m_iPort )
++	{
++		iDomain = AF_INET;
++		iSockaddrSize = sizeof(sin);
++		pSockaddr = (struct sockaddr *) &sin;
++
++		memset ( &sin, 0, sizeof(sin) );
++		sin.sin_family = AF_INET;
++		sin.sin_port = htons(m_iPort);
++		
++		// resolve address
++		if ( (int)( ip_addr=inet_addr(m_sHost) ) != (int)INADDR_NONE )
++			memcpy ( &sin.sin_addr, &ip_addr, sizeof(ip_addr) );
++		else
++		{
++			int tmp_errno;
++			struct hostent tmp_hostent, *hp;
++			char buff2 [ GETHOSTBYNAME_BUFF_SIZE ];
++			
++			hp = my_gethostbyname_r ( m_sHost, &tmp_hostent,
++									  buff2, sizeof(buff2), &tmp_errno );
++			if ( !hp )
++			{ 
++				my_gethostbyname_r_free();
++				
++				char sError[256];
++				snprintf ( sError, sizeof(sError), "failed to resolve searchd host (name=%s)", m_sHost );
++				
++				my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), sError );
++				return -1;
++			}
++			
++			memcpy ( &sin.sin_addr, hp->h_addr, Min ( sizeof(sin.sin_addr), (size_t)hp->h_length ) );
++			my_gethostbyname_r_free();
++		}
++	}
++	else
++	{
++#ifndef __WIN__
++		iDomain = AF_UNIX;
++		iSockaddrSize = sizeof(saun);
++		pSockaddr = (struct sockaddr *) &saun;
++
++		memset ( &saun, 0, sizeof(saun) );
++		saun.sun_family = AF_UNIX;
++		strncpy ( saun.sun_path, m_sHost, sizeof(saun.sun_path)-1 );
++#else
++		my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), "Unix-domain sockets are not supported on Windows" );
++		return -1;
++#endif
++	}
++
++	// connect to searchd and exchange versions
++	uint uServerVersion;
++	uint uClientVersion = htonl ( SPHINX_SEARCHD_PROTO );
++	int iSocket = -1;
++	char * pError = NULL;
++	do
++	{
++		iSocket = socket ( iDomain, SOCK_STREAM, 0 );
++		if ( iSocket == -1 )
++		{
++			pError = "Failed to create client socket";
++			break;
++		}
++	
++		if ( connect ( iSocket, pSockaddr, iSockaddrSize ) == -1)
++		{
++			pError = "Failed to connect to searchd";
++			break;
++		}
++
++		if ( !sphRecv ( iSocket, (char *)&uServerVersion, sizeof(uServerVersion) ) )
++		{
++			pError = "Failed to receive searchd version";
++			break;
++		}
++		
++		if ( !sphSend ( iSocket, (char *)&uClientVersion, sizeof(uClientVersion) ) )
++		{
++			pError = "Failed to send client version";
++			break;
++		}
++	}
++	while(0);
++
++	// fixme: compare versions?
++
++	if ( pError )
++	{
++		char sError[1024];
++		snprintf ( sError, sizeof(sError), "%s [%d] %s", Format(), errno, strerror(errno) );
++		my_error ( ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), sError );
++
++		if ( iSocket != -1 )
++			close ( iSocket );
++		
++		return -1;
++	}
++
++	return iSocket;
++}
++
++struct CSphResponse
++{
++	char * m_pBuffer;
++	char * m_pBody;
++
++	CSphResponse ()
++		: m_pBuffer ( NULL )
++		, m_pBody ( NULL )
++	{}
++
++	CSphResponse ( DWORD uSize )
++		: m_pBody ( NULL )
++	{
++		m_pBuffer = new char[uSize];
++	}
++
++	~CSphResponse ()
++	{
++		SafeDeleteArray ( m_pBuffer );
++	}
++	
++	static CSphResponse * Read ( int iSocket, int iClientVersion );
++};
++
++CSphResponse *
++CSphResponse::Read ( int iSocket, int iClientVersion )
++{
++	char sHeader[8];
++	if ( !sphRecv ( iSocket, sHeader, sizeof(sHeader) ) )
++		return NULL;
++
++	int iStatus   = ntohs ( sphUnalignedRead ( *(short int *) &sHeader[0] ) );
++	int iVersion  = ntohs ( sphUnalignedRead ( *(short int *) &sHeader[2] ) );
++	DWORD uLength = ntohl ( sphUnalignedRead ( *(DWORD *)     &sHeader[4] ) );
++
++	if ( iVersion < iClientVersion ) // fixme: warn
++		;
++
++	if ( uLength <= SPHINXSE_MAX_ALLOC )
++	{
++		CSphResponse * pResponse = new CSphResponse ( uLength );
++		if ( !sphRecv ( iSocket, pResponse->m_pBuffer, uLength ) )
++		{
++			SafeDelete ( pResponse );
++			return NULL;
++		}
++
++		pResponse->m_pBody = pResponse->m_pBuffer;
++		if ( iStatus != SEARCHD_OK )
++		{
++			DWORD uSize = ntohl ( *(DWORD *)pResponse->m_pBuffer );
++			if ( iStatus == SEARCHD_WARNING )
++				pResponse->m_pBody += uSize; // fixme: report the warning somehow
++			else
++			{
++				char * sMessage = sphDup ( pResponse->m_pBuffer + sizeof(DWORD), uSize );
++				my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), sMessage );
++				SafeDelete ( sMessage );
++				SafeDelete ( pResponse );
++				return NULL;
++			}
++		}
++		return pResponse;
++	}
++	return NULL;
++}
++
++/// udf
++
++extern "C"
++{
++	my_bool sphinx_snippets_init ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sMessage );
++	void sphinx_snippets_deinit ( UDF_INIT * pUDF );
++	char * sphinx_snippets ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sResult, unsigned long * pLength, char * pIsNull, char * sError );
++};
++
++#define MAX_MESSAGE_LENGTH 255
++#define MAX_RESULT_LENGTH 255
++
++struct CSphSnippets
++{
++	CSphUrl m_tUrl;
++	CSphResponse * m_pResponse;
++
++	int m_iBeforeMatch;
++	int m_iAfterMatch;
++	int m_iChunkSeparator;
++	int m_iLimit;
++	int m_iAround;
++	int m_iFlags;
++
++	CSphSnippets()
++		: m_pResponse(NULL)
++		, m_iBeforeMatch(0)
++		, m_iAfterMatch(0)
++		, m_iChunkSeparator(0)
++		  // defaults
++		, m_iLimit(256)
++		, m_iAround(5)
++		, m_iFlags(1)
++	{
++	}
++
++	~CSphSnippets()
++	{
++		SafeDelete ( m_pResponse );
++	}
++};
++
++#define KEYWORD(NAME) else if ( strncmp ( NAME, pArgs->attributes[i], pArgs->attribute_lengths[i] ) == 0 )
++
++#define CHECK_TYPE(TYPE)											\
++	if ( pArgs->arg_type[i] != TYPE )								\
++	{																\
++		snprintf ( sMessage, MAX_MESSAGE_LENGTH,					\
++				   "%.*s argument must be a string",				\
++				   (int)pArgs->attribute_lengths[i],				\
++				   pArgs->attributes[i] );							\
++		bFail = true;												\
++		break;														\
++	}																\
++	if ( TYPE == STRING_RESULT && !pArgs->args[i] )					\
++	{																\
++		snprintf ( sMessage, MAX_MESSAGE_LENGTH,					\
++				   "%.*s argument must be constant (and not NULL)",	\
++				   (int)pArgs->attribute_lengths[i],				\
++				   pArgs->attributes[i] );							\
++		bFail = true;												\
++		break;														\
++	}
++
++#define STRING CHECK_TYPE(STRING_RESULT)
++#define INT CHECK_TYPE(INT_RESULT); int iValue = *(long long *)pArgs->args[i]
++
++my_bool sphinx_snippets_init ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sMessage )
++{
++	if ( pArgs->arg_count < 3 )
++	{
++		strncpy ( sMessage, "insufficient arguments", MAX_MESSAGE_LENGTH );
++		return 1;
++	}
++
++	bool bFail = false;
++	CSphSnippets * pOpts = new CSphSnippets;
++	for ( uint i = 0; i < pArgs->arg_count; i++ )
++	{
++		if ( i < 3 )
++		{
++			if ( pArgs->arg_type[i] != STRING_RESULT )
++			{
++				strncpy ( sMessage, "first three arguments must be of string type", MAX_MESSAGE_LENGTH );
++				bFail = true;
++				break;
++			}
++		}
++		KEYWORD("sphinx")
++		{
++			STRING;
++			if ( !pOpts->m_tUrl.Parse ( pArgs->args[i], pArgs->lengths[i] ) )
++			{
++				strncpy ( sMessage, "failed to parse connection string", MAX_MESSAGE_LENGTH );
++				bFail = true;
++				break;
++			}
++		}
++		KEYWORD("before_match")		{ STRING; pOpts->m_iBeforeMatch = i; }
++		KEYWORD("after_match")		{ STRING; pOpts->m_iAfterMatch = i; }
++		KEYWORD("chunk_separator")	{ STRING; pOpts->m_iChunkSeparator = i; }
++		KEYWORD("limit")			{ INT; pOpts->m_iLimit = iValue; }
++		KEYWORD("around")			{ INT; pOpts->m_iAround = iValue; }
++		KEYWORD("exact_phrase")		{ INT; if ( iValue ) pOpts->m_iFlags |= 2; }
++		KEYWORD("single_passage")	{ INT; if ( iValue ) pOpts->m_iFlags |= 4; }
++		KEYWORD("use_boundaries")	{ INT; if ( iValue ) pOpts->m_iFlags |= 8; }
++		KEYWORD("weight_order")		{ INT; if ( iValue ) pOpts->m_iFlags |= 16; }
++		else
++		{
++			snprintf ( sMessage, MAX_MESSAGE_LENGTH, "unrecognized argument: %.*s",
++					   (int)pArgs->attribute_lengths[i], pArgs->attributes[i] );
++			bFail = true;
++			break;
++		}
++	}
++	
++	if ( bFail )
++	{
++		SafeDelete ( pOpts );
++		return 1;
++	}
++	pUDF->ptr = (char *)pOpts;
++	return 0;
++}
++
++#undef STRING
++#undef INT
++#undef KEYWORD
++#undef CHECK_TYPE
++
++#define ARG(i) pArgs->args[i], pArgs->lengths[i]
++#define ARG_LEN(VAR, LEN) ( VAR ? pArgs->lengths[VAR] : LEN )
++
++#define SEND_STRING(INDEX, DEFAULT)							\
++	if ( INDEX )											\
++		tBuffer.SendString ( ARG(INDEX) );					\
++	else													\
++		tBuffer.SendString ( DEFAULT, sizeof(DEFAULT) - 1 );
++
++
++char * sphinx_snippets ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sResult, unsigned long * pLength, char * pIsNull, char * pError )
++{
++	CSphSnippets * pOpts = (CSphSnippets *)pUDF->ptr;
++	assert ( pOpts );
++
++	if ( !pArgs->args[0] || !pArgs->args[1] || !pArgs->args[2] )
++	{
++		*pIsNull = 1;
++		return sResult;
++	}
++
++	const int iSize =
++		8 + // header
++		8 +
++		4 + pArgs->lengths[1] + // index
++		4 + pArgs->lengths[2] + // words
++		4 + ARG_LEN ( pOpts->m_iBeforeMatch, 3 ) +
++		4 + ARG_LEN ( pOpts->m_iAfterMatch, 4 ) +
++		4 + ARG_LEN ( pOpts->m_iChunkSeparator, 5 ) +
++		12 +
++		4 + pArgs->lengths[0]; // document
++
++	CSphBuffer tBuffer(iSize);
++
++	tBuffer.SendWord ( SEARCHD_COMMAND_EXCERPT );
++	tBuffer.SendWord ( VER_COMMAND_EXCERPT );
++	tBuffer.SendDword ( iSize - 8 );
++
++	tBuffer.SendDword ( 0 );
++	tBuffer.SendDword ( pOpts->m_iFlags );
++
++	tBuffer.SendString ( ARG(1) ); // index
++	tBuffer.SendString ( ARG(2) ); // words
++
++	SEND_STRING ( pOpts->m_iBeforeMatch, "<b>" );
++	SEND_STRING ( pOpts->m_iAfterMatch, "</b>" );
++	SEND_STRING ( pOpts->m_iChunkSeparator, " ... " );
++
++	tBuffer.SendInt ( pOpts->m_iLimit );
++	tBuffer.SendInt ( pOpts->m_iAround );
++
++	// single document
++	tBuffer.SendInt ( 1 );
++	tBuffer.SendString ( ARG(0) );
++
++	int iSocket = -1;
++	do
++	{
++		if ( !tBuffer.Finalize() )
++		{
++			my_error ( ER_QUERY_ON_FOREIGN_DATA_SOURCE, MYF(0), "INTERNAL ERROR: failed to build request" );
++			break;
++		}
++		
++		iSocket = pOpts->m_tUrl.Connect();
++		if ( iSocket == -1 ) break;
++		if ( !sphSend ( iSocket, tBuffer.Ptr(), iSize, sphReportErrors ) ) break;
++
++		CSphResponse * pResponse = CSphResponse::Read ( iSocket, 0x100 );
++		if ( !pResponse ) break;
++
++		close ( iSocket );
++		pOpts->m_pResponse = pResponse;
++		*pLength = ntohl( *(DWORD *)pResponse->m_pBody );
++		return pResponse->m_pBody + sizeof(DWORD);
++	}
++	while(0);
++
++	if ( iSocket != -1 )
++		close ( iSocket );
++
++	*pError = 1;
++	return sResult;
++}
++
++#undef SEND_STRING
++#undef ARG_LEN	
++#undef ARG
++
++void sphinx_snippets_deinit ( UDF_INIT * pUDF )
++{
++	CSphSnippets * pOpts = (CSphSnippets *)pUDF->ptr;
++	SafeDelete ( pOpts );
++}
++
++//
++// $Id: snippets_udf.cc 2616 2011-01-01 02:33:06Z shodan $
++//
diff --git a/component/mysql-5.5/mysql_create_system_tables__no_test.patch b/component/mysql-5.5/mysql_create_system_tables__no_test.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8d917ea1ad57f02c3e9e0bc94038c58815e7d6a2
--- /dev/null
+++ b/component/mysql-5.5/mysql_create_system_tables__no_test.patch
@@ -0,0 +1,27 @@
+# 33_scripts__mysql_create_system_tables__no_test.dpatch by  <ch@debian.org>
+
+A user with no password prevents a normal user from login under certain
+circumstances as it is checked first.
+See http://bugs.debian.org/301741
+and http://bugs.mysql.com/bug.php?id=6901
+
+--- scripts/mysql_system_tables_data.sql	2008-12-04 22:59:44.000000000 +0100
++++ scripts/mysql_system_tables_data.sql	2008-12-04 23:00:07.000000000 +0100
+@@ -26,8 +26,6 @@
+ -- Fill "db" table with default grants for anyone to
+ -- access database 'test' and 'test_%' if "db" table didn't exist
+ CREATE TEMPORARY TABLE tmp_db LIKE db;
+-INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
+-INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');
+ INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
+ DROP TABLE tmp_db;
+ 
+@@ -40,8 +38,6 @@
+ REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','' FROM dual WHERE LOWER( @current_hostname) != 'localhost';
+ REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');
+ REPLACE INTO tmp_user VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');
+-INSERT INTO tmp_user (host,user) VALUES ('localhost','');
+-INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost';
+ INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
+ DROP TABLE tmp_user;
+ 
diff --git a/component/ncurses/buildout.cfg b/component/ncurses/buildout.cfg
index 3944e63180e01cc713d5e03575518e202f2c6102..63dea92837fb3305b67ef0d18aa2ded492126ccb 100644
--- a/component/ncurses/buildout.cfg
+++ b/component/ncurses/buildout.cfg
@@ -15,10 +15,9 @@ configure-options =
   --enable-rpath
 # tricky way to rerun with --enable-widec
 make-targets =
-  install && (for i in curses unctrl eti form menu panel term; do ln -sf ncurses/$i.h ${buildout:parts-directory}/${:_buildout_section_name_}/include/$i.h; done) && ./configure ${:configure-options} --enable-widec && make install
+  install && (for i in curses unctrl eti form menu panel term; do ln -sf ncurses/$i.h ${buildout:parts-directory}/${:_buildout_section_name_}/include/$i.h; done; ln -sf libncurses.so ${buildout:parts-directory}/${:_buildout_section_name_}/lib/libcurses.so) && ./configure ${:configure-options} --enable-widec && make ${:make-options} install
 # pass dummy LDCONFIG to skip needless calling of ldconfig by non-root user
 environment =
-  LDFLAGS =-Wl,--as-needed
   LDCONFIG=/bin/echo
 make-options =
   -j1
diff --git a/component/openldap/buildout.cfg b/component/openldap/buildout.cfg
index c09a6692618d188d0dac7894abc17c1adf896be3..d8ea71c8143970f9817091c7931e7edf93f58b4d 100644
--- a/component/openldap/buildout.cfg
+++ b/component/openldap/buildout.cfg
@@ -7,8 +7,8 @@ extends =
 
 [openldap]
 recipe = hexagonit.recipe.cmmi
-url = ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.25.tgz
-md5sum = ec63f9c2add59f323a0459128846905b
+url = ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.26.tgz
+md5sum = f36f3086031dd56ae94f722ffae8df5e
 configure-options =
   --disable-static
   --disable-slapd
diff --git a/component/percona-toolkit/buildout.cfg b/component/percona-toolkit/buildout.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..847ec6540d30a7def4386edb47925a8d5a5f03a8
--- /dev/null
+++ b/component/percona-toolkit/buildout.cfg
@@ -0,0 +1,16 @@
+[buildout]
+extends =
+  ../perl/buildout.cfg
+  ../perl-DBI/buildout.cfg
+  ../perl-DBD-mariadb/buildout.cfg
+parts =
+  percona-toolkit
+
+[percona-toolkit]
+recipe = hexagonit.recipe.cmmi
+depends =
+  ${perl:version}
+url = http://www.percona.com/redir/downloads/percona-toolkit/percona-toolkit-1.0.1.tar.gz
+md5sum = 1d843b1b3ebd2eacfa3bf95ef2a00557
+configure-command =
+  ${perl:location}/bin/perl Makefile.PL
diff --git a/component/perl-DBD-MySQL/buildout.cfg b/component/perl-DBD-MySQL/buildout.cfg
index f9475e66a10316e536c2311dcd8c1de85ce210fe..8be6ddab2e236de40d2bbb2e6d541fd8bccea604 100644
--- a/component/perl-DBD-MySQL/buildout.cfg
+++ b/component/perl-DBD-MySQL/buildout.cfg
@@ -1,20 +1,11 @@
 [buildout]
 extends =
-  ../perl/buildout.cfg
-  ../perl-DBI/buildout.cfg
   ../mysql-tritonn-5.0/buildout.cfg
-  ../zlib/buildout.cfg
-  ../openssl/buildout.cfg
+  ../perl-DBD-common/buildout.cfg
+
 parts =
   perl-DBD-MySQL
 
-[perl-DBD-MySQL-patch]
-recipe = hexagonit.recipe.download
-md5sum = e12e9233f20b0370cfcf5228ea767fbc
-url = ${:_profile_base_location_}/${:filename}
-filename = DBD-mysql-4.019.rpathsupport.patch
-download-only = true
-
 [perl-DBD-MySQL]
 recipe = hexagonit.recipe.cmmi
 version = 4.019
diff --git a/component/perl-DBD-MySQL/DBD-mysql-4.019.rpathsupport.patch b/component/perl-DBD-common/DBD-mysql-4.019.rpathsupport.patch
similarity index 100%
rename from component/perl-DBD-MySQL/DBD-mysql-4.019.rpathsupport.patch
rename to component/perl-DBD-common/DBD-mysql-4.019.rpathsupport.patch
diff --git a/component/perl-DBD-common/buildout.cfg b/component/perl-DBD-common/buildout.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..4f2229756543b9463705f16fded5c5e6dafb1c4f
--- /dev/null
+++ b/component/perl-DBD-common/buildout.cfg
@@ -0,0 +1,16 @@
+# Please use perl-DBD-MySQL or perl-DBD-mariadb
+[buildout]
+extends =
+  ../perl/buildout.cfg
+  ../perl-DBI/buildout.cfg
+  ../zlib/buildout.cfg
+  ../openssl/buildout.cfg
+
+[perl-DBD-MySQL-patch]
+recipe = hexagonit.recipe.download
+md5sum = e12e9233f20b0370cfcf5228ea767fbc
+url = ${:_profile_base_location_}/${:filename}
+filename = DBD-mysql-4.019.rpathsupport.patch
+download-only = true
+
+
diff --git a/component/perl-DBD-mariadb/buildout.cfg b/component/perl-DBD-mariadb/buildout.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..ac379cb8763273a029a7468868de56b8afdfba03
--- /dev/null
+++ b/component/perl-DBD-mariadb/buildout.cfg
@@ -0,0 +1,23 @@
+[buildout]
+extends =
+  ../mariadb/buildout.cfg
+  ../perl-DBD-common/buildout.cfg
+
+parts =
+  perl-DBD-mariadb
+
+[perl-DBD-mariadb]
+recipe = hexagonit.recipe.cmmi
+version = 4.019
+depends =
+  ${perl:version}
+  ${perl-DBI:version}
+url = http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.019.tar.gz
+md5sum = 566d98ab8ffac9626a31f6f6d455558e
+patches =
+  ${perl-DBD-MySQL-patch:location}/${perl-DBD-MySQL-patch:filename}
+patch-options = -p1
+configure-command =
+  ${perl:location}/bin/perl Makefile.PL --mysql_config=${mariadb:location}/bin/mysql_config
+environment =
+  OTHERLDFLAGS=-Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${mariadb:location}/lib/mysql -Wl,-rpath=${openssl:location}/lib
\ No newline at end of file
diff --git a/component/perl/buildout.cfg b/component/perl/buildout.cfg
index 8673f03b367d88516c532944ac0b609f9f2710ec..c27ca6d56574ea9b77333eb06b1448e96d34a88b 100644
--- a/component/perl/buildout.cfg
+++ b/component/perl/buildout.cfg
@@ -14,9 +14,11 @@ filename = ${:_buildout_section_name_}
 
 [perl]
 recipe = hexagonit.recipe.cmmi
-version = 5.14.1
+depends =
+  ${gdbm:version}
+version = 5.14.2
 url = http://www.cpan.org/src/5.0/perl-${:version}.tar.bz2
-md5sum = 97cd306a2c22929cc141a09568f43bb0
+md5sum = 04a4c5d3c1f9f19d77daff8e8cd19a26
 siteprefix = ${buildout:parts-directory}/site_${:_buildout_section_name_}
 patch-options = -p1
 patches =
diff --git a/component/pycrypto-python/buildout.cfg b/component/pycrypto-python/buildout.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..835f9c884f6380ce57f1962da49c5c957850c685
--- /dev/null
+++ b/component/pycrypto-python/buildout.cfg
@@ -0,0 +1,22 @@
+[buildout]
+extends =
+  ../gmp/buildout.cfg
+
+parts =
+  pycrypto-python
+
+versions = versions
+
+[pycrypto-python]
+recipe = zc.recipe.egg:custom
+egg = pycrypto
+include-dirs =
+  ${gmp:location}/include
+library-dirs =
+  ${gmp:location}/lib
+rpath =
+  ${gmp:location}/lib
+
+[versions]
+# pycrypto 2.4 does not work with setuptools/buildout
+pycrypto = 2.3
diff --git a/component/python-2.6/buildout.cfg b/component/python-2.6/buildout.cfg
index 6755b652e1f468a03320d81336b3a63443e91693..cf1f1634707b5ee91f7942ada40d0789bd1ece64 100644
--- a/component/python-2.6/buildout.cfg
+++ b/component/python-2.6/buildout.cfg
@@ -24,6 +24,8 @@ filename = python-2.6.6-no_system_inc_dirs.patch
 
 [python2.6]
 recipe = hexagonit.recipe.cmmi
+depends =
+  ${gdbm:version}
 # This is actually the default setting for prefix, but we can't use it in
 # other settings in this part if we don't set it explicitly here.
 prefix = ${buildout:parts-directory}/${:_buildout_section_name_}
diff --git a/component/python-2.7/buildout.cfg b/component/python-2.7/buildout.cfg
index 765488f74e0c1a4202ae3966454747b41a0ed630..e4a5f5cbcb7aa889f61c359bcf94003f8ac93737 100644
--- a/component/python-2.7/buildout.cfg
+++ b/component/python-2.7/buildout.cfg
@@ -38,6 +38,8 @@ python = python2.7
 
 [python2.7common]
 recipe = hexagonit.recipe.cmmi
+depends =
+  ${gdbm:version}
 # This is actually the default setting for prefix, but we can't use it in
 # other settings in this part if we don't set it explicitly here.
 prefix = ${buildout:parts-directory}/${:_buildout_section_name_}
diff --git a/component/rdiff-backup/buildout.cfg b/component/rdiff-backup/buildout.cfg
index b6d15bd56f379e0b5b51b72a81e1a2b95fd6af33..e3678ddff245a30206b10486528aa677677509dd 100644
--- a/component/rdiff-backup/buildout.cfg
+++ b/component/rdiff-backup/buildout.cfg
@@ -13,7 +13,7 @@ library-dirs =
   ${librsync:location}/lib/
 rpath =
   ${librsync:location}/lib/
-find-links = http://download.savannah.nongnu.org/releases/rdiff-backup/rdiff-backup-1.0.5.tar.gz
+find-links = http://pkgs.fedoraproject.org/repo/pkgs/rdiff-backup/rdiff-backup-1.0.5.tar.gz/fa2a165fa07a94be52c52e3545bc7758/rdiff-backup-1.0.5.tar.gz
 
 [rdiff-backup]
 # Scripts only generation part for rdiff-backup
diff --git a/component/readline/buildout.cfg b/component/readline/buildout.cfg
index d023f5fa7d3f2620cf044f071aa137f300d3f59f..ba6dde560ffbb978ff3e1fca77186a2c1fca56a9 100644
--- a/component/readline/buildout.cfg
+++ b/component/readline/buildout.cfg
@@ -1,9 +1,22 @@
 [buildout]
 parts =
+  readline5
   readline
 extends =
   ../ncurses/buildout.cfg
 
+# readline-5.x is still used for GPL2 only softwares.
+[readline5]
+recipe = hexagonit.recipe.cmmi
+url = http://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz
+md5sum = e39331f32ad14009b9ff49cc10c5e751
+configure-options =
+  --enable-multibyte
+  --disable-static
+  --with-ncurses=${ncurses:location}
+environment =
+    LDFLAGS =-Wl,-rpath=${ncurses:location}/lib
+
 [readline]
 recipe = hexagonit.recipe.cmmi
 url = http://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz
diff --git a/component/slapos/buildout.cfg b/component/slapos/buildout.cfg
index 849f5f2bc929ab49de51f8e03dd10efa14b6de8a..bb5a10873ce5cdf1b4c6dac2c2cc8bba02dad4b8 100644
--- a/component/slapos/buildout.cfg
+++ b/component/slapos/buildout.cfg
@@ -98,6 +98,7 @@ initialization =
 
 # control scripts generation in order to avoid reinstalling bin/buildout
 scripts =
+  bang = slapos.bang:main
   generate-signature-key = slapos.signature:run
   slapconsole = slapos.console:run
   slapos-request = slapos.console:request
@@ -111,38 +112,37 @@ scripts =
   slapproxy = slapos.proxy:main
 
 [versions]
-zc.buildout = 1.5.3-dev-SlapOS-009
+zc.buildout = 1.6.0-dev-SlapOS-003
 Jinja2 = 2.6
-Werkzeug = 0.7.1
+Werkzeug = 0.8.1
 collective.recipe.template = 1.9
 hexagonit.recipe.cmmi = 1.5.0
-lxml = 2.3
+lxml = 2.3.2
 meld3 = 0.6.7
-netaddr = 0.7.5
+netaddr = 0.7.6
 setuptools = 0.6c12dev-r88846
-slapos.core = 0.14
-slapos.libnetworkcache = 0.9
+slapos.core = 0.20
+slapos.libnetworkcache = 0.10
 xml-marshaller = 0.9.7
 z3c.recipe.scripts = 1.0.1
 zc.recipe.egg = 1.3.2
 
 # Required by:
-# slapos.core==0.14
-Flask = 0.7.2
+# slapos.core==0.20
+Flask = 0.8
 
 # Required by:
 # hexagonit.recipe.cmmi==1.5.0
 hexagonit.recipe.download = 1.5.0
 
 # Required by:
-# slapos.core==0.14
-netifaces = 0.5
+# slapos.core==0.20
+netifaces = 0.6
 
 # Required by:
-# slapos.core==0.14
+# slapos.core==0.20
 supervisor = 3.0a10
 
 # Required by:
-# slapos.core==0.14
-zope.interface = 3.7.0
-
+# slapos.core==0.20
+zope.interface = 3.8.0
diff --git a/component/sphinx/buildout.cfg b/component/sphinx/buildout.cfg
index 10257b2e948376e12e1ba236accd964f40697cd4..bb8b0aa7c192c88870a8c49586f4aeb530ca15f3 100644
--- a/component/sphinx/buildout.cfg
+++ b/component/sphinx/buildout.cfg
@@ -18,8 +18,8 @@ filename = sphinx-1.10-beta-snowball.patch
 
 [sphinx]
 recipe = hexagonit.recipe.cmmi
-url = http://sphinxsearch.com/files/sphinx-2.0.1-beta.tar.gz
-md5sum = 95c217d81d0b7a4ff73d5297318c3481
+url = http://sphinxsearch.com/files/sphinx-2.0.2-beta.tar.gz
+md5sum = fafe0f1a71d0ded32404c067eba7d0b3
 configure-options =
   --with-mysql
   --with-mysql-includes=${mariadb:location}/include/mysql
diff --git a/component/sqlite3/buildout.cfg b/component/sqlite3/buildout.cfg
index 168ca9b5fde2c29861cb07c30e45bc441723ce57..05422fa1cb0f5e68e0159c688cb4ff0318af0257 100644
--- a/component/sqlite3/buildout.cfg
+++ b/component/sqlite3/buildout.cfg
@@ -5,8 +5,8 @@ parts =
 
 [sqlite3]
 recipe = hexagonit.recipe.cmmi
-url = http://www.sqlite.org/sqlite-autoconf-3070800.tar.gz
-md5sum = 6bfb46d73caaa1bbbcd2b52184b6c542
+url = http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz
+md5sum = dce303524736fe89a76b8ed29d566352
 configure-options =
   --disable-static
   --enable-readline
diff --git a/component/stunnel/buildout.cfg b/component/stunnel/buildout.cfg
index a2252cfe2a70d90cc0f0efc29c604234de4cb9eb..607e0c794cf329926097383bf0e2c863025bcc7e 100644
--- a/component/stunnel/buildout.cfg
+++ b/component/stunnel/buildout.cfg
@@ -17,8 +17,8 @@ filename = stunnel-4-hooks.py
 
 [stunnel-4]
 recipe = hexagonit.recipe.cmmi
-url = http://mirror.bit.nl/stunnel/stunnel-4.49.tar.gz
-md5sum = 127a1dd20526540c91b31a2024749a31
+url = http://mirror.bit.nl/stunnel/stunnel-4.50.tar.gz
+md5sum = d68b4565294496a8bdf23c728a679f53
 pre-configure-hook = ${stunnel-4-hook-download:location}/${stunnel-4-hook-download:filename}:pre_configure_hook
 configure-options =
   --enable-ipv6
diff --git a/component/xtrabackup/buildout.cfg b/component/xtrabackup/buildout.cfg
index 753376d34c0620b1809677a32c637de1e3c12695..6769e684398de27631b19fe9c324c9d954188360 100644
--- a/component/xtrabackup/buildout.cfg
+++ b/component/xtrabackup/buildout.cfg
@@ -18,7 +18,7 @@ parts =
 [xtrabackup-build-patch-download]
 recipe = hexagonit.recipe.download
 url = ${:_profile_base_location_}/${:filename}
-md5sum = 95b2c2ef625f88d85bf8876269a19372
+md5sum = b1536fe65e32592e4a0a14bf3b159885
 download-only = true
 filename = xtrabackup-1.6.2_build.patch
 
@@ -29,17 +29,33 @@ md5sum = d642ea7b30d1322a516fbece4ee100e0
 download-only = true
 filename = ${:_buildout_section_name_}
 
+[mysql-5.1-download]
+recipe = hexagonit.recipe.download
+version = 5.1.56
+url = http://s3.amazonaws.com/percona.com/downloads/community/mysql-${:version}.tar.gz
+md5sum = 15161d67f4830aad3a8a89e083749d49
+download-only = true
+filename = mysql-${:version}.tar.gz
+
+[libtar-download]
+recipe = hexagonit.recipe.download
+version = 1.2.11
+url = http://s3.amazonaws.com/percona.com/downloads/community/libtar-${:version}.tar.gz
+md5sum = 604238e8734ce6e25347a58c4f1a1d7e
+download-only = true
+filename = libtar-${:version}.tar.gz
+
 [xtrabackup]
 recipe = hexagonit.recipe.cmmi
-url = http://www.percona.com/redir/downloads/XtraBackup/xtrabackup-1.6.2/source/xtrabackup-1.6.2.tar.gz
-md5sum = 933243ae362156c98f1211eb87b3b4ea
+url = http://www.percona.com/downloads/XtraBackup/XtraBackup-1.6.3/source/xtrabackup-1.6.3.tar.gz
+md5sum = d0b827fd18cd76416101eb7b7c56a311
 make-binary = true
 patches =
   ${xtrabackup-build-patch-download:location}/${xtrabackup-build-patch-download:filename}
   ${allow_force_ibbackup.patch:location}/${allow_force_ibbackup.patch:filename}
 patch-options = -p1
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
-configure-command = utils/build.sh innodb51_builtin ${:location} ${libtool:location}
+configure-command = ln -sf ${mysql-5.1-download:location}/${mysql-5.1-download:filename} ${libtar-download:location}/${libtar-download:filename} . && utils/build.sh innodb51_builtin ${:location} ${libtool:location}
 environment =
   CPPFLAGS =-I${zlib:location}/include -I${ncurses:location}/include -I${readline:location}/include
   LDFLAGS =-L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib -L${readline:location}/lib -Wl,-rpath=${readline:location}/lib
diff --git a/component/xtrabackup/xtrabackup-1.6.2_build.patch b/component/xtrabackup/xtrabackup-1.6.2_build.patch
index 41c2188fa9429d8c9db685233aafd83931f0a57c..5357f52128860733e3e97836fa0bd81f3730649b 100644
--- a/component/xtrabackup/xtrabackup-1.6.2_build.patch
+++ b/component/xtrabackup/xtrabackup-1.6.2_build.patch
@@ -27,17 +27,16 @@ diff -ur xtrabackup-1.6.2.orig/utils/build.sh xtrabackup-1.6.2/utils/build.sh
      exit -1
  }
  
-@@ -79,7 +81,12 @@
+@@ -79,7 +81,11 @@
  {
      echo "Configuring the server"
      cd $server_dir
 -    BUILD/autorun.sh
-+    libtoolize -c -f
-+    aclocal -I $libtool_location/share/aclocal -I config/ac-macros
-+    autoheader
-+    automake -c -a -f
-+    autoconf
-+    touch sql/sql_yacc.yy
++    aclocal -I $libtool_location/share/aclocal -I config/ac-macros || die "Can't execute aclocal"
++    autoheader || die "Can't execute autoheader"
++    libtoolize --automake --force --copy || die "Can't execute libtoolize"
++    automake --add-missing --force  --copy || die "Can't execute automake"
++    autoconf || die "Can't execute autoconf"
      eval $configure_cmd
  
      echo "Building the server"
@@ -141,12 +140,3 @@ diff -ur xtrabackup-1.6.2.orig/utils/build.sh xtrabackup-1.6.2/utils/build.sh
  	;;
  
  "innodb55" | "5.5")
-@@ -230,7 +279,7 @@
- 
- 	build_server
- 
--	build_xtrabackup
-+	build_xtrabackup 
- 
- 	build_tar4ibd
- 	;;
diff --git a/component/zabbix/buildout.cfg b/component/zabbix/buildout.cfg
index a18f88e7ae552ef39b7ef99ea835198071f5c7e3..f194595c9e76b721d4bf0eb5f86401907efafbe6 100644
--- a/component/zabbix/buildout.cfg
+++ b/component/zabbix/buildout.cfg
@@ -4,8 +4,8 @@ parts =
 
 [zabbix-agent]
 recipe = hexagonit.recipe.cmmi
-url = http://prdownloads.sourceforge.net/zabbix/zabbix-1.8.5.tar.gz?download
-md5sum = 58b9253fb0eace1e20b2fe5c1fce32a3
+url = http://prdownloads.sourceforge.net/zabbix/zabbix-1.8.9.tar.gz?download
+md5sum = fc8c7fad2943dea73d4f2338cd216715
 configure-options =
   --enable-agent
   --enable-ipv6
diff --git a/setup.py b/setup.py
index 8501616c092539c47c2ebd28aa81207904cebf7e..a674d9634364bae23732bf9ba6d9e11f94c887ca 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
 import glob
 import os
 
-version = '0.32-dev'
+version = '0.39-dev'
 name = 'slapos.cookbook'
 long_description = open("README.txt").read() + "\n" + \
     open("CHANGES.txt").read() + "\n"
@@ -42,11 +42,11 @@ setup(name=name,
         'zc.buildout': [
           'apachephp = slapos.recipe.apachephp:Recipe',
           'apacheproxy = slapos.recipe.apacheproxy:Recipe',
+          'apache.zope.backend = slapos.recipe.apache_zope_backend:Recipe',
           'certificate_authority = slapos.recipe.certificate_authority:Recipe',
           'certificate_authority.request = slapos.recipe.certificate_authority:Request',
           'cron = slapos.recipe.dcron:Recipe',
           'cron.d = slapos.recipe.dcron:Part',
-          'download = slapos.recipe.download:Recipe',
           'davstorage = slapos.recipe.davstorage:Recipe',
           'dropbear = slapos.recipe.dropbear:Recipe',
           'dropbear.add_authorized_key = slapos.recipe.dropbear:AddAuthorizedKey',
@@ -56,15 +56,21 @@ setup(name=name,
           'erp5 = slapos.recipe.erp5:Recipe',
           'erp5testnode = slapos.recipe.erp5testnode:Recipe',
           'helloworld = slapos.recipe.helloworld:Recipe',
+          'generic.cloudooo = slapos.recipe.generic_cloudooo:Recipe',
+          'fontconfig = slapos.recipe.fontconfig:Recipe',
           'java = slapos.recipe.java:Recipe',
           'kumofs = slapos.recipe.kumofs:Recipe',
+          'generic.kumofs = slapos.recipe.generic_kumofs:Recipe',
+          'haproxy = slapos.recipe.haproxy:Recipe',
           'kvm = slapos.recipe.kvm:Recipe',
           'libcloud = slapos.recipe.libcloud:Recipe',
           'libcloudrequest = slapos.recipe.libcloudrequest:Recipe',
           'lockfile = slapos.recipe.lockfile:Recipe',
           'memcached = slapos.recipe.memcached:Recipe',
+          'generic.memcached = slapos.recipe.generic_memcached:Recipe',
           'mysql = slapos.recipe.mysql:Recipe',
           'mydumper = slapos.recipe.mydumper:Recipe',
+          'generic.mysql = slapos.recipe.generic_mysql:Recipe',
           'mkdirectory = slapos.recipe.mkdirectory:Recipe',
           'nbdserver = slapos.recipe.nbdserver:Recipe',
           'nosqltestbed = slapos.recipe.nosqltestbed:NoSQLTestBed',
@@ -83,17 +89,28 @@ setup(name=name,
           'proactive = slapos.recipe.proactive:Recipe',
           'request = slapos.recipe.request:Recipe',
           'sheepdogtestbed = slapos.recipe.sheepdogtestbed:SheepDogTestBed',
+          'symbolic.link = slapos.recipe.symbolic_link:Recipe',
           'softwaretype = slapos.recipe.softwaretype:Recipe',
           'siptester = slapos.recipe.siptester:SipTesterRecipe',
           'simplelogger = slapos.recipe.simplelogger:Recipe',
           'slaprunner = slapos.recipe.slaprunner:Recipe',
           'sshkeys_authority = slapos.recipe.sshkeys_authority:Recipe',
           'sshkeys_authority.request = slapos.recipe.sshkeys_authority:Request',
+          'sphinx= slapos.recipe.sphinx:Recipe',
           'stunnel = slapos.recipe.stunnel:Recipe',
           'testnode = slapos.recipe.testnode:Recipe',
-          'urlparse = slapos.recipe.urlparse_:Recipe',
+          'urlparse = slapos.recipe._urlparse:Recipe',
           'vifib = slapos.recipe.vifib:Recipe',
+          'waitfor = slapos.recipe.waitfor:Recipe',
           'xwiki = slapos.recipe.xwiki:Recipe',
           'zabbixagent = slapos.recipe.zabbixagent:Recipe',
+          'generic.zope = slapos.recipe.generic_zope:Recipe',
+          'generic.zope.zeo.client = slapos.recipe.generic_zope_zeo_client:Recipe',
+          'generate.erp5.tidstorage = slapos.recipe.generate_erp5_tidstorage:Recipe',
+          'generate.cloudooo = slapos.recipe.generate_cloudooo:Recipe',
+          'zeo = slapos.recipe.zeo:Recipe',
+          'tidstorage = slapos.recipe.tidstorage:Recipe',
+          'erp5.update = slapos.recipe.erp5_update:Recipe',
+          'erp5.test = slapos.recipe.erp5_test:Recipe',
       ]},
     )
diff --git a/slapos/recipe/README.download.txt b/slapos/recipe/README.download.txt
deleted file mode 100644
index a74c946c5cad90d54a1a8b7a8541c8b9bb4687b5..0000000000000000000000000000000000000000
--- a/slapos/recipe/README.download.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-download
-========
-
-Extremely simple recipe to download using zc.buildout download utility.
-
-Usage
------
-
-::
-
-  [buildout]
-  parts =
-    download
-
-  [download]
-  recipe = slapos.cookbook:download
-  url = https://some.url/file
-
-Such profile will download https://some.url/file and put it in
-buildout:parts-directory/download/download
-
-filename parameter can be used to change destination named filename.
-
-destination parameter allows to put explicit destination.
-
-md5sum parameter allows pass md5sum.
-
-mode (octal, so for rw-r--r-- use 0644) allows to set mode
-
-Exposes target attribute which is path to downloaded file.
-
-Notes
------
-
-This recipe suffers from buildout download utility issue, which will do not
-try to redownload resource with wrong md5sum.
diff --git a/slapos/recipe/README.lamp.txt b/slapos/recipe/README.lamp.txt
index 7a75a2033a3ed733ff5198bbce92e65b3fcb21ab..d1738526d0814dffb8256d55079f482fea2bc049 100644
--- a/slapos/recipe/README.lamp.txt
+++ b/slapos/recipe/README.lamp.txt
@@ -1,9 +1,9 @@
 lamp
 =====
 
-the lamp recipe help you to deploy simply a php based application on slapos. This recipe is 
-able to setup mariadb, apache and apache-php for your php application, is also capable to
-configure your software during installation to ensure a full compatibility.
+The lamp recipe helps you to deploy simply a php based application on slapos. This recipe is 
+able to setup mariadb, apache and apache-php for your php application, and is also capable of
+configuring your software during installation to ensure a full compatibility.
 
 
 How to use?
@@ -34,9 +34,26 @@ in this case you need to write a python script and lamp recipe must run it when
 How to use?
 -----------
 
+this part of lamp recipe work with slapos.toolbox, Therefore you must add it to your recipe.
+in software.cfg, replace instance-recipe-egg part by
+
+[instance-recipe-egg]
+recipe = zc.recipe.egg
+python = python2.7
+eggs =
+    ${mysql-python:egg}
+    ${instance-recipe:egg}
+    slapos.toolbox[lampconfigure]
+
+and add into your instance.cfg
+
+lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
+
+
 CONDITION
 --------
-the action (move, rename, launch script) only starts when the condition is filled.
+
+the action (delete, rename, script, chmod) only starts when the condition is filled.
 in instance.cfg, add 
 
 file_token = path_of_file
@@ -52,14 +69,13 @@ into mariadb databse for example table_name = admin. if you use
 name_of_table = **, the action will begin when database is ready. 
 constraint is the sql_condition to use when search entry into name_of_table for example constraint = `admin_id`=1
 
-you can no use file_token and table_name at the same time, otherwise file_token will be used in priority. attention 
-to the conditions that will never be satisfied.
+you can't use file_token and table_name at the same time, otherwise file_token will be used in priority. Beware of conditions that will never be satisfied.
 
 
 
 ACTION
 -------
-the action start when condition is true
+The action starts when condition is true
 1- delete file or folder
 into instance.cfg, use 
 
@@ -70,13 +86,23 @@ for example delete = admin
 2- rename file or folder
 into instance.cfg, use 
 
-rename = old_name1 => new_name1, old_name2 => new_name2, ... you can also use
+rename_chmod = mode (optional)
+rename = old_name1 => new_name1, old_name2 => new_name2, ... 
 
+you can also use
 rename = old_name1, old_name2 => new_name2, ... in this case old_name1 will be rename and the new name will be chose
 by joining old_name1 and mysql_user: this should give 
 rename = old_name1 => old_name1-mysql_user, old_name2 => new_name2, ...
+use rename_chmod to apply a mode to new_name1, new_name2, ...
+
+3- Change mode of file or directory
+
+this is usefull if you want to change the mode of files into your www-data, use 
+
+chmod = file1, file2, ....
+mode = mode_to_apply (ex= 0644)
 
-3- launch python script
+4- Launch python script
 
 use script = ${configure-script:location}/${configure-script:filename} into instance.cfg, add part configure-script
 into software.cfg
@@ -90,10 +116,10 @@ url = url_of_script_name.py
 filename = script_name.py
 download-only = True
 
-the script_name.py should contain a main module, sys.argv is passed to the main. you can write script_name.py like this
+The script_name.py should contain a main function, sys.argv is given to the main. you can write script_name.py like this
 ....
 def setup(args):
-    base_url, htdocs, renamed, mysql_user, mysql_password, mysql_database, mysql_host = args
+    mysql_port, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args
     .......
 
 if __name__ == '__main__':
@@ -102,3 +128,4 @@ if __name__ == '__main__':
 base_url: is the url of php software
 htdocs: is the path of www-data directory
 mysql_user, mysql_password, mysql_database, mysql_host: is the mariadb parameters
+you can also use "import MySQLdb" if you want to access to database via your python script
\ No newline at end of file
diff --git a/slapos/recipe/urlparse_.py b/slapos/recipe/_urlparse.py
similarity index 100%
rename from slapos/recipe/urlparse_.py
rename to slapos/recipe/_urlparse.py
diff --git a/slapos/recipe/apache_zope_backend/__init__.py b/slapos/recipe/apache_zope_backend/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e4b23482e552fe3d860e2f7d3112d4148e2ea83e
--- /dev/null
+++ b/slapos/recipe/apache_zope_backend/__init__.py
@@ -0,0 +1,67 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericBaseRecipe
+import pkg_resources
+
+class Recipe(GenericBaseRecipe):
+  def install(self):
+    path_list = []
+    ip = self.options['ip']
+    port = self.options['port']
+    backend = self.options['backend']
+    key = self.options['key-file']
+    certificate = self.options['cert-file']
+    access_control_string = self.options['access-control-string']
+    apache_conf = dict()
+    apache_conf['pid_file'] = self.options['pid-file']
+    apache_conf['lock_file'] = self.options['lock-file']
+    apache_conf['ip'] = ip
+    apache_conf['port'] = port
+    apache_conf['server_admin'] = 'admin@'
+    apache_conf['error_log'] = self.options['error-log']
+    apache_conf['access_log'] = self.options['access-log']
+    apache_conf['server_name'] = '%s' % apache_conf['ip']
+    apache_conf['certificate'] = certificate
+    apache_conf['key'] = key
+    apache_conf['path'] = '/'
+    apache_conf['access_control_string'] = access_control_string
+    apache_conf['rewrite_rule'] = "RewriteRule (.*) %s$1 [L,P]" % backend
+    apache_conf_string = pkg_resources.resource_string(__name__,
+          'template/apache.zope.conf.in') % apache_conf
+    apache_config_file = self.createFile(self.options['configuration-file'],
+      apache_conf_string)
+    path_list.append(apache_config_file)
+    wrapper = self.createPythonScript(self.options['wrapper'], __name__ +
+      '.apache.runApache', [
+            dict(
+              required_path_list=[key, certificate],
+              binary=self.options['apache-binary'],
+              config=apache_config_file
+            )
+          ])
+    path_list.append(wrapper)
+    return path_list
diff --git a/slapos/recipe/apache_zope_backend/apache.py b/slapos/recipe/apache_zope_backend/apache.py
new file mode 100644
index 0000000000000000000000000000000000000000..861f787d09fed9c80b38f561528fbd86b5c7ad44
--- /dev/null
+++ b/slapos/recipe/apache_zope_backend/apache.py
@@ -0,0 +1,22 @@
+import os
+import sys
+import time
+
+
+def runApache(args):
+  sleep = 60
+  conf = args[0]
+  while True:
+    ready = True
+    for f in conf.get('required_path_list', []):
+      if not os.path.exists(f):
+        print 'File %r does not exists, sleeping for %s' % (f, sleep)
+        ready = False
+    if ready:
+      break
+    time.sleep(sleep)
+  apache_wrapper_list = [conf['binary'], '-f', conf['config'], '-DFOREGROUND']
+  apache_wrapper_list.extend(sys.argv[1:])
+  sys.stdout.flush()
+  sys.stderr.flush()
+  os.execl(apache_wrapper_list[0], *apache_wrapper_list)
diff --git a/slapos/recipe/apache_zope_backend/template/apache.zope.conf.in b/slapos/recipe/apache_zope_backend/template/apache.zope.conf.in
new file mode 100644
index 0000000000000000000000000000000000000000..ac689e15fcbe647833625b98f29a369085d4e2cc
--- /dev/null
+++ b/slapos/recipe/apache_zope_backend/template/apache.zope.conf.in
@@ -0,0 +1,63 @@
+# Apache configuration file for Zope
+# Automatically generated
+
+# List of modules
+LoadModule authz_host_module modules/mod_authz_host.so
+LoadModule log_config_module modules/mod_log_config.so
+LoadModule setenvif_module modules/mod_setenvif.so
+LoadModule version_module modules/mod_version.so
+LoadModule proxy_module modules/mod_proxy.so
+LoadModule proxy_http_module modules/mod_proxy_http.so
+LoadModule ssl_module modules/mod_ssl.so
+LoadModule mime_module modules/mod_mime.so
+LoadModule dav_module modules/mod_dav.so
+LoadModule dav_fs_module modules/mod_dav_fs.so
+LoadModule negotiation_module modules/mod_negotiation.so
+LoadModule rewrite_module modules/mod_rewrite.so
+LoadModule headers_module modules/mod_headers.so
+
+# Basic server configuration
+PidFile "%(pid_file)s"
+LockFile "%(lock_file)s"
+Listen %(ip)s:%(port)s
+ServerAdmin %(server_admin)s
+TypesConfig conf/mime.types
+AddType application/x-compress .Z
+AddType application/x-gzip .gz .tgz
+
+# As backend is trusting REMOTE_USER header unset it always
+RequestHeader unset REMOTE_USER
+
+# SSL Configuration
+SSLEngine on
+SSLCertificateFile %(certificate)s
+SSLCertificateKeyFile %(key)s
+SSLRandomSeed startup builtin
+SSLRandomSeed connect builtin
+
+SSLProxyEngine On
+
+# Log configuration
+ErrorLog "%(error_log)s"
+# Default apache log format with request time in microsecond at the end
+LogFormat "%%h %%l %%u %%t \"%%r\" %%>s %%b \"%%{Referer}i\" \"%%{User-Agent}i\" %%D" combined
+CustomLog "%(access_log)s" combined
+
+# Directory protection
+<Directory />
+    Options FollowSymLinks
+    AllowOverride None
+    Order deny,allow
+    Deny from all
+</Directory>
+
+# Path protected
+<Location %(path)s>
+  Order Deny,Allow
+  Deny from all
+  Allow from %(access_control_string)s
+</Location>
+
+# Magic of Zope related rewrite
+RewriteEngine On
+%(rewrite_rule)s
diff --git a/slapos/recipe/certificate_authority/certificate_authority.py b/slapos/recipe/certificate_authority/certificate_authority.py
index a4af4ab76df89af085dd779e12b5d1a64af37ff6..d6e629f76c02d4b0353f539663d28d43990bdf16 100644
--- a/slapos/recipe/certificate_authority/certificate_authority.py
+++ b/slapos/recipe/certificate_authority/certificate_authority.py
@@ -2,6 +2,7 @@ import os
 import subprocess
 import time
 import ConfigParser
+import uuid
 
 
 def popenCommunicate(command_list, input=None):
@@ -44,7 +45,7 @@ class CertificateAuthority:
       popenCommunicate([self.openssl_binary, 'req', '-nodes', '-config',
           self.openssl_configuration, '-new', '-x509', '-extensions',
           'v3_ca', '-keyout', self.key, '-out', self.certificate,
-          '-days', '10950'], 'Automatic Certificate Authority\n')
+          '-days', '10950'], 'Certificate Authority %s\n' % uuid.uuid1())
     except:
       try:
         for f in file_list:
diff --git a/slapos/recipe/erp5/__init__.py b/slapos/recipe/erp5/__init__.py
index c867bf6d1d1a4e86b574edef95cefb3e9d0c5bf2..3d5f9724192856d219a8f8707adfff21ca3a1e22 100644
--- a/slapos/recipe/erp5/__init__.py
+++ b/slapos/recipe/erp5/__init__.py
@@ -25,130 +25,14 @@
 #
 ##############################################################################
 from slapos.recipe.librecipe import BaseSlapRecipe
-import binascii
-import os
 import pkg_resources
-import pprint
-import hashlib
 import sys
 import zc.buildout
 import zc.recipe.egg
-import ConfigParser
-import re
-
-_isurl = re.compile('([a-zA-Z0-9+.-]+)://').match
-
-# based on Zope2.utilities.mkzopeinstance.write_inituser
-def Zope2InitUser(path, username, password):
-  open(path, 'w').write('')
-  os.chmod(path, 0600)
-  open(path, "w").write('%s:{SHA}%s\n' % (
-    username,binascii.b2a_base64(hashlib.sha1(password).digest())[:-1]))
 
 class Recipe(BaseSlapRecipe):
-  def getTemplateFilename(self, template_name):
-    return pkg_resources.resource_filename(__name__,
-        'template/%s' % template_name)
-
-  site_id = 'erp5'
-
   def _install(self):
-    self.path_list = []
-    self.requirements, self.ws = self.egg.working_set()
-    # self.cron_d is a directory, where cron jobs can be registered
-    self.cron_d = self.installCrond()
-    self.logrotate_d, self.logrotate_backup = self.installLogrotate()
-    self.killpidfromfile = zc.buildout.easy_install.scripts(
-        [('killpidfromfile', __name__ + '.killpidfromfile',
-          'killpidfromfile')], self.ws, sys.executable, self.bin_directory)[0]
-    self.path_list.append(self.killpidfromfile)
-    ca_conf = self.installCertificateAuthority()
-
-    memcached_conf = self.installMemcached(ip=self.getLocalIPv4Address(),
-        port=11000)
-    kumo_conf = self.installKumo(self.getLocalIPv4Address())
-    conversion_server_conf = self.installConversionServer(
-        self.getLocalIPv4Address(), 23000, 23060)
-    mysql_conf = self.installMysqlServer(self.getLocalIPv4Address(), 45678)
-    user, password = self.installERP5()
-
-    if self.parameter_dict.get("slap_software_type", "").lower() == "cluster":
-      # Site access is done by HAProxy
-      zope_access, site_access, key_access = self.installZopeCluster(ca_conf)
-    else:
-      zope_access = self.installZopeStandalone()
-      site_access = zope_access
-      key_access = None
-
-    key, certificate = self.requestCertificate('Login Based Access')
-    apache_conf = dict(
-         apache_login=self.installBackendApache(ip=self.getGlobalIPv6Address(),
-         port=13000, backend=site_access, key=key, certificate=certificate))
-
-    connection_dict = dict(site_url=apache_conf['apache_login'])
-
-    if self.parameter_dict.get("domain_name") is not None:
-      connection_dict["backend_url"] = apache_conf['apache_login']
-      connection_dict["domain_ip"] = self.getGlobalIPv6Address()
-
-      # XXX Define a fake domain_name for now.
-      frontend_name = self.parameter_dict.get("domain_name")
-      frontend_key, frontend_certificate = \
-             self.requestCertificate(frontend_name)
-
-      connection_dict["site_url"] = self.installFrontendZopeApache(
-        ip=self.getGlobalIPv6Address(), port=4443, name=frontend_name,
-        frontend_path='/', backend_path='',
-        backend_url=apache_conf['apache_login'], key=frontend_key,
-        certificate=frontend_certificate)
-
-    default_bt5_list = []
-    if self.parameter_dict.get("flavour", "default") == 'configurator':
-      default_bt5_list = self.options.get("configurator_bt5_list", '').split()
-
-    self.installERP5Site(user, password, zope_access, mysql_conf,
-             conversion_server_conf, memcached_conf, kumo_conf,
-             self.site_id, default_bt5_list, ca_conf)
-
-    self.installTestRunner(ca_conf, mysql_conf, conversion_server_conf,
-                           memcached_conf, kumo_conf)
-    self.installTestSuiteRunner(ca_conf, mysql_conf, conversion_server_conf,
-                           memcached_conf, kumo_conf)
-    self.linkBinary()
-    connection_dict.update(**dict(
-      site_user=user,
-      site_password=password,
-      memcached_url=memcached_conf['memcached_url'],
-      kumo_url=kumo_conf['kumo_address']
-    ))
-    if key_access is not None:
-      connection_dict['key_access'] = key_access
-    if self.options.get('fulltext_search', None) == 'sphinx':
-      sphinx_searchd = self.installSphinxSearchd(ip=self.getLocalIPv4Address())
-      connection_dict.update(**sphinx_searchd)
-    self.setConnectionDict(connection_dict)
-    return self.path_list
-
-  def installZopeStandalone(self):
-    """ Install a single Zope instance without ZEO Server.
-    """
-    zodb_dir = os.path.join(self.data_root_directory, 'zodb')
-    self._createDirectory(zodb_dir)
-    zodb_root_path = os.path.join(zodb_dir, 'main.fs')
-
-    thread_amount_per_zope = int(self.options.get(
-                                 'single_zope_thread_amount', 4))
-
-    zodb_cache_size = int(self.options.get('zodb_cache_size', 5000))
-
-    return self.installZope(ip=self.getLocalIPv4Address(),
-          port=12000 + 1, name='zope_%s' % 1,
-          zodb_configuration_string=self.substituteTemplate(
-            self.getTemplateFilename('zope-zodb-snippet.conf.in'),
-            dict(zodb_root_path=zodb_root_path,
-                 zodb_cache_size=zodb_cache_size)),
-            with_timerservice=True,
-            thread_amount=thread_amount_per_zope)
+    raise NotImplementedError('Outdated.')
 
   def installKeyAuthorisationApache(self, ipv6, port, backend, key, certificate,
       ca_conf, key_auth_path='/'):
@@ -209,807 +93,6 @@ SSLCARevocationPath %(ca_crl)s"""
     else:
       return 'https://%(ip)s:%(port)s' % apache_conf
 
-  def installZopeCluster(self, ca_conf=None):
-    """ Install ERP5 using ZEO Cluster
-    """
-    site_check_path = '/%s/getId' % self.site_id
-    thread_amount_per_zope = int(self.options.get(
-                                'cluster_zope_thread_amount', 1))
-
-    activity_node_amount = int(self.options.get(
-                   "cluster_activity_node_amount", 2))
-
-    user_node_amount = int(self.options.get(
-                   "cluster_user_node_amount", 2))
-
-    key_auth_node_amount = int(self.options.get(
-                   "key_auth_node_amount", 0))
-
-    ip = self.getLocalIPv4Address()
-    storage_dict = self._requestZeoFileStorage('Zeo Server 1', 'main')
-
-    zeo_conf = self.installZeo(ip)
-    tidstorage_config = dict(host=ip, port='6001')
-
-    # XXX How to define good values for this?
-    mount_point = '/'
-    zodb_cache_size = 5000
-    zeo_client_cache_size = '20MB'
-    check_path = '/erp5/account_module'
-
-    known_tid_storage_identifier_dict = {}
-    known_tid_storage_identifier_dict[
-      (((storage_dict['ip'],storage_dict['port']),), storage_dict['storage_name'])
-        ] = (zeo_conf[storage_dict['storage_name']]['path'], check_path or mount_point)
-
-    zodb_configuration_string = self.substituteTemplate(
-        self.getTemplateFilename('zope-zeo-snippet.conf.in'), dict(
-        storage_name=storage_dict['storage_name'],
-        address='%s:%s' % (storage_dict['ip'], storage_dict['port']),
-        mount_point=mount_point, zodb_cache_size=zodb_cache_size,
-        zeo_client_cache_size=zeo_client_cache_size
-        ))
-
-    zope_port = 12000
-    # One Distribution Node (Single Thread Always)
-    zope_port += 1
-    self.installZope(ip, zope_port, 'zope_distribution', with_timerservice=True,
-        zodb_configuration_string=zodb_configuration_string,
-        tidstorage_config=tidstorage_config)
-
-    # Activity Nodes (Single Thread Always)
-    for i in range(activity_node_amount):
-      zope_port += 1
-      self.installZope(ip, zope_port, 'zope_activity_%s' % i,
-          with_timerservice=True,
-          zodb_configuration_string=zodb_configuration_string,
-          tidstorage_config=tidstorage_config)
-
-    # Four Web Page Nodes (Human access)
-    login_url_list = []
-    for i in range(user_node_amount):
-      zope_port += 1
-      login_url_list.append(self.installZope(ip, zope_port,
-        'zope_login_%s' % i, with_timerservice=False,
-        zodb_configuration_string=zodb_configuration_string,
-        tidstorage_config=tidstorage_config,
-        thread_amount=thread_amount_per_zope))
-
-    login_haproxy = self.installHaproxy(ip, 15001, 'login',
-                               site_check_path, login_url_list)
-
-    key_access = None
-    if key_auth_node_amount > 0:
-      service_url_list = []
-      for i in range(key_auth_node_amount):
-        zope_port += 1
-        service_url_list.append(self.installZope(ip, zope_port,
-          'zope_service_%s' % i, with_timerservice=False,
-          zodb_configuration_string=zodb_configuration_string,
-          tidstorage_config=tidstorage_config))
-      service_haproxy = self.installHaproxy(ip, 15000, 'service',
-          site_check_path, service_url_list)
-
-      key_auth_key, key_auth_certificate = self.requestCertificate(
-          'Key Based Access')
-      key_access = self.installKeyAuthorisationApache(True, 15500,
-          service_haproxy, key_auth_key, key_auth_certificate, ca_conf)
-
-    self.installTidStorage(tidstorage_config['host'],
-                           tidstorage_config['port'],
-            known_tid_storage_identifier_dict, 'http://' + login_haproxy)
-
-    return login_url_list[-1], login_haproxy, key_access
-
-  def _requestZeoFileStorage(self, server_name, storage_name):
-    """Local, slap.request compatible, call to ask for filestorage on Zeo
-
-    filter_kw can be used to select specific Zeo server
-
-    Someday in future it will be possible to invoke:
-
-    self.request(
-      software_release=self.computer_partition.getSoftwareRelease().getURI(),
-      software_type='Zeo Server',
-      partition_reference=storage_name,
-      filter_kw={'server_name': server_name},
-      shared=True
-    )
-
-    Thanks to this it will be possible to select precisely on which server
-    which storage will be placed.
-    """
-    base_port = 35001
-    if getattr(self, '_zeo_storage_dict', None) is None:
-      self._zeo_storage_dict = {}
-    if getattr(self, '_zeo_storage_port_dict', None) is None:
-      self._zeo_storage_port_dict = {}
-    self._zeo_storage_port_dict.setdefault(server_name,
-        base_port+len(self._zeo_storage_port_dict))
-    self._zeo_storage_dict[server_name] = self._zeo_storage_dict.get(
-        server_name, []) + [storage_name]
-    return dict(
-      ip=self.getLocalIPv4Address(),
-      port=self._zeo_storage_port_dict[server_name],
-      storage_name=storage_name
-    )
-
-  def installLogrotate(self):
-    """Installs logortate main configuration file and registers its to cron"""
-    logrotate_d = os.path.abspath(os.path.join(self.etc_directory,
-      'logrotate.d'))
-    self._createDirectory(logrotate_d)
-    logrotate_backup = self.createBackupDirectory('logrotate')
-    logrotate_conf = self.createConfigurationFile("logrotate.conf",
-        "include %s" % logrotate_d)
-    logrotate_cron = os.path.join(self.cron_d, 'logrotate')
-    state_file = os.path.join(self.data_root_directory, 'logrotate.status')
-    open(logrotate_cron, 'w').write('0 0 * * * %s -s %s %s' %
-        (self.options['logrotate_binary'], state_file, logrotate_conf))
-    self.path_list.extend([logrotate_d, logrotate_conf, logrotate_cron])
-    return logrotate_d, logrotate_backup
-
-  def registerLogRotation(self, name, log_file_list, postrotate_script):
-    """Register new log rotation requirement"""
-    open(os.path.join(self.logrotate_d, name), 'w').write(
-        self.substituteTemplate(self.getTemplateFilename(
-          'logrotate_entry.in'),
-          dict(file_list=' '.join(['"'+q+'"' for q in log_file_list]),
-            postrotate=postrotate_script, olddir=self.logrotate_backup)))
-
-  def linkBinary(self):
-    """Links binaries to instance's bin directory for easier exposal"""
-    for linkline in self.options.get('link_binary_list', '').splitlines():
-      if not linkline:
-        continue
-      target = linkline.split()
-      if len(target) == 1:
-        target = target[0]
-        path, linkname = os.path.split(target)
-      else:
-        linkname = target[1]
-        target = target[0]
-      link = os.path.join(self.bin_directory, linkname)
-      if os.path.lexists(link):
-        if not os.path.islink(link):
-          raise zc.buildout.UserError(
-              'Target link already %r exists but it is not link' % link)
-        os.unlink(link)
-      os.symlink(target, link)
-      self.logger.debug('Created link %r -> %r' % (link, target))
-      self.path_list.append(link)
-
-  def installKumo(self, ip, kumo_manager_port=13101, kumo_server_port=13201,
-      kumo_server_listen_port=13202, kumo_gateway_port=13301):
-    # XXX: kumo is not storing pid in file, unless it is not running as daemon
-    #      but running daemons is incompatible with SlapOS, so there is currently
-    #      no way to have Kumo's pid files to rotate logs and send signals to them
-    config = dict(
-      kumo_gateway_binary=self.options['kumo_gateway_binary'],
-      kumo_gateway_ip=ip,
-      kumo_gateway_log=os.path.join(self.log_directory, "kumo-gateway.log"),
-      kumo_manager_binary=self.options['kumo_manager_binary'],
-      kumo_manager_ip=ip,
-      kumo_manager_log=os.path.join(self.log_directory, "kumo-manager.log"),
-      kumo_server_binary=self.options['kumo_server_binary'],
-      kumo_server_ip=ip,
-      kumo_server_log=os.path.join(self.log_directory, "kumo-server.log"),
-      kumo_server_storage=os.path.join(self.data_root_directory, "kumodb.tch"),
-      kumo_manager_port=kumo_manager_port,
-      kumo_server_port=kumo_server_port,
-      kumo_server_listen_port=kumo_server_listen_port,
-      kumo_gateway_port=kumo_gateway_port
-    )
-
-    self.path_list.append(self.createRunningWrapper('kumo_gateway',
-      self.substituteTemplate(self.getTemplateFilename('kumo_gateway.in'),
-        config)))
-
-    self.path_list.append(self.createRunningWrapper('kumo_manager',
-      self.substituteTemplate(self.getTemplateFilename('kumo_manager.in'),
-        config)))
-
-    self.path_list.append(self.createRunningWrapper('kumo_server',
-      self.substituteTemplate(self.getTemplateFilename('kumo_server.in'),
-        config)))
-
-    return dict(
-      kumo_address = '%s:%s' % (config['kumo_gateway_ip'],
-        config['kumo_gateway_port']),
-      kumo_gateway_ip=config['kumo_gateway_ip'],
-      kumo_gateway_port=config['kumo_gateway_port'],
-    )
-
-  def installMemcached(self, ip, port):
-    config = dict(
-        memcached_binary=self.options['memcached_binary'],
-        memcached_ip=ip,
-        memcached_port=port,
-    )
-    self.path_list.append(self.createRunningWrapper('memcached',
-      self.substituteTemplate(self.getTemplateFilename('memcached.in'),
-        config)))
-    return dict(memcached_url='%s:%s' %
-        (config['memcached_ip'], config['memcached_port']),
-        memcached_ip=config['memcached_ip'],
-        memcached_port=config['memcached_port'])
-
-  def installSphinxSearchd(self, ip, port=9312, sql_port=9306):
-    data_directory = self.createDataDirectory('sphinx')
-    sphinx_conf_path = self.createConfigurationFile('sphinx.conf',
-      self.substituteTemplate(self.getTemplateFilename('sphinx.conf.in'), dict(
-          ip_address=ip,
-          port=port,
-          sql_port=sql_port,
-          data_directory=data_directory,
-          log_directory=self.log_directory,
-          )))
-    self.path_list.append(sphinx_conf_path)
-    wrapper = zc.buildout.easy_install.scripts([('sphinx_searchd',
-     'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable,
-      self.wrapper_directory, arguments=[
-        self.options['sphinx_searchd_binary'].strip(), '-c', sphinx_conf_path, '--nodetach']
-      )[0]
-    self.path_list.append(wrapper)
-    return dict(sphinx_searchd_ip=ip,
-                sphinx_searchd_port=port,
-                sphinx_searchd_sql_port=sql_port)
-
-  def installTestRunner(self, ca_conf, mysql_conf, conversion_server_conf,
-                        memcached_conf, kumo_conf):
-    """Installs bin/runUnitTest executable to run all tests using
-       bin/runUnitTest"""
-    testinstance = self.createDataDirectory('testinstance')
-    # workaround wrong assumptions of ERP5Type.tests.runUnitTest about
-    # directory existence
-    unit_test = os.path.join(testinstance, 'unit_test')
-    connection_string_list = []
-    for test_database, test_user, test_password in \
-          mysql_conf['mysql_parallel_test_dict'][-4:]:
-      connection_string_list.append(
-          '%s@%s:%s %s %s' % (test_database, mysql_conf['ip'],
-                            mysql_conf['tcp_port'], test_user, test_password))
-    if not os.path.isdir(unit_test):
-      os.mkdir(unit_test)
-    runUnitTest = zc.buildout.easy_install.scripts([
-      ('runUnitTest', __name__ + '.testrunner', 'runUnitTest')],
-      self.ws, sys.executable, self.bin_directory, arguments=[dict(
-        instance_home=testinstance,
-        prepend_path=self.bin_directory,
-        openssl_binary=self.options['openssl_binary'],
-        test_ca_path=ca_conf['certificate_authority_path'],
-        call_list=[self.options['runUnitTest_binary'],
-          '--erp5_sql_connection_string', '%(mysql_test_database)s@%'
-          '(ip)s:%(tcp_port)s %(mysql_test_user)s '
-          '%(mysql_test_password)s' % mysql_conf,
-          '--extra_sql_connection_string_list',','.join(connection_string_list),
-          '--conversion_server_hostname=%(conversion_server_ip)s' % \
-                                                         conversion_server_conf,
-          '--conversion_server_port=%(conversion_server_port)s' % \
-                                                         conversion_server_conf,
-          '--volatile_memcached_server_hostname=%(memcached_ip)s' % memcached_conf,
-          '--volatile_memcached_server_port=%(memcached_port)s' % memcached_conf,
-          '--persistent_memcached_server_hostname=%(kumo_gateway_ip)s' % kumo_conf,
-          '--persistent_memcached_server_port=%(kumo_gateway_port)s' % kumo_conf,
-      ]
-        )])[0]
-    self.path_list.append(runUnitTest)
-
-  def installTestSuiteRunner(self, ca_conf, mysql_conf, conversion_server_conf,
-                        memcached_conf, kumo_conf):
-    """Installs bin/runTestSuite executable to run all tests using
-       bin/runUnitTest"""
-    testinstance = self.createDataDirectory('test_suite_instance')
-    # workaround wrong assumptions of ERP5Type.tests.runUnitTest about
-    # directory existence
-    unit_test = os.path.join(testinstance, 'unit_test')
-    if not os.path.isdir(unit_test):
-      os.mkdir(unit_test)
-    connection_string_list = []
-    for test_database, test_user, test_password in \
-        mysql_conf['mysql_parallel_test_dict']:
-      connection_string_list.append(
-          '%s@%s:%s %s %s' % (test_database, mysql_conf['ip'],
-                              mysql_conf['tcp_port'], test_user, test_password))
-    command = zc.buildout.easy_install.scripts([
-      ('runTestSuite', __name__ + '.test_suite_runner', 'runTestSuite')],
-      self.ws, sys.executable, self.bin_directory, arguments=[dict(
-        instance_home=testinstance,
-        prepend_path=self.bin_directory,
-        openssl_binary=self.options['openssl_binary'],
-        test_ca_path=ca_conf['certificate_authority_path'],
-        call_list=[self.options['runTestSuite_binary'],
-          '--db_list', ','.join(connection_string_list),
-          '--conversion_server_hostname=%(conversion_server_ip)s' % \
-                                                         conversion_server_conf,
-          '--conversion_server_port=%(conversion_server_port)s' % \
-                                                         conversion_server_conf,
-          '--volatile_memcached_server_hostname=%(memcached_ip)s' % memcached_conf,
-          '--volatile_memcached_server_port=%(memcached_port)s' % memcached_conf,
-          '--persistent_memcached_server_hostname=%(kumo_gateway_ip)s' % kumo_conf,
-          '--persistent_memcached_server_port=%(kumo_gateway_port)s' % kumo_conf,
-      ]
-        )])[0]
-    self.path_list.append(command)
-
-  def installCrond(self):
-    timestamps = self.createDataDirectory('cronstamps')
-    cron_output = os.path.join(self.log_directory, 'cron-output')
-    self._createDirectory(cron_output)
-    catcher = zc.buildout.easy_install.scripts([('catchcron',
-      __name__ + '.catdatefile', 'catdatefile')], self.ws, sys.executable,
-      self.bin_directory, arguments=[cron_output])[0]
-    self.path_list.append(catcher)
-    cron_d = os.path.join(self.etc_directory, 'cron.d')
-    crontabs = os.path.join(self.etc_directory, 'crontabs')
-    self._createDirectory(cron_d)
-    self._createDirectory(crontabs)
-    wrapper = zc.buildout.easy_install.scripts([('crond',
-     'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable,
-      self.wrapper_directory, arguments=[
-        self.options['dcrond_binary'].strip(), '-s', cron_d, '-c', crontabs,
-        '-t', timestamps, '-f', '-l', '5', '-M', catcher]
-      )[0]
-    self.path_list.append(wrapper)
-    return cron_d
-
-  def requestCertificate(self, name):
-    hash = hashlib.sha512(name).hexdigest()
-    key = os.path.join(self.ca_private, hash + self.ca_key_ext)
-    certificate = os.path.join(self.ca_certs, hash + self.ca_crt_ext)
-    parser = ConfigParser.RawConfigParser()
-    parser.add_section('certificate')
-    parser.set('certificate', 'name', name)
-    parser.set('certificate', 'key_file', key)
-    parser.set('certificate', 'certificate_file', certificate)
-    parser.write(open(os.path.join(self.ca_request_dir, hash), 'w'))
-    return key, certificate
-
-  def installCertificateAuthority(self, ca_country_code='XX',
-      ca_email='xx@example.com', ca_state='State', ca_city='City',
-      ca_company='Company'):
-    backup_path = self.createBackupDirectory('ca')
-    self.ca_dir = os.path.join(self.data_root_directory, 'ca')
-    self._createDirectory(self.ca_dir)
-    self.ca_request_dir = os.path.join(self.ca_dir, 'requests')
-    self._createDirectory(self.ca_request_dir)
-    config = dict(ca_dir=self.ca_dir, request_dir=self.ca_request_dir)
-    self.ca_private = os.path.join(self.ca_dir, 'private')
-    self.ca_certs = os.path.join(self.ca_dir, 'certs')
-    self.ca_crl = os.path.join(self.ca_dir, 'crl')
-    self.ca_newcerts = os.path.join(self.ca_dir, 'newcerts')
-    self.ca_key_ext = '.key'
-    self.ca_crt_ext = '.crt'
-    for d in [self.ca_private, self.ca_crl, self.ca_newcerts, self.ca_certs]:
-      self._createDirectory(d)
-    for f in ['crlnumber', 'serial']:
-      if not os.path.exists(os.path.join(self.ca_dir, f)):
-        open(os.path.join(self.ca_dir, f), 'w').write('01')
-    if not os.path.exists(os.path.join(self.ca_dir, 'index.txt')):
-      open(os.path.join(self.ca_dir, 'index.txt'), 'w').write('')
-    openssl_configuration = os.path.join(self.ca_dir, 'openssl.cnf')
-    config.update(
-        working_directory=self.ca_dir,
-        country_code=ca_country_code,
-        state=ca_state,
-        city=ca_city,
-        company=ca_company,
-        email_address=ca_email,
-    )
-    self._writeFile(openssl_configuration, pkg_resources.resource_string(
-      __name__, 'template/openssl.cnf.ca.in') % config)
-    self.path_list.extend(zc.buildout.easy_install.scripts([
-      ('certificate_authority',
-        __name__ + '.certificate_authority', 'runCertificateAuthority')],
-        self.ws, sys.executable, self.wrapper_directory, arguments=[dict(
-          openssl_configuration=openssl_configuration,
-          openssl_binary=self.options['openssl_binary'],
-          certificate=os.path.join(self.ca_dir, 'cacert.pem'),
-          key=os.path.join(self.ca_private, 'cakey.pem'),
-          crl=os.path.join(self.ca_crl),
-          request_dir=self.ca_request_dir
-          )]))
-    # configure backup
-    backup_cron = os.path.join(self.cron_d, 'ca_rdiff_backup')
-    open(backup_cron, 'w').write(
-        '''0 0 * * * %(rdiff_backup)s %(source)s %(destination)s'''%dict(
-          rdiff_backup=self.options['rdiff_backup_binary'],
-          source=self.ca_dir,
-          destination=backup_path))
-    self.path_list.append(backup_cron)
-
-    return dict(
-      ca_certificate=os.path.join(config['ca_dir'], 'cacert.pem'),
-      ca_crl=os.path.join(config['ca_dir'], 'crl'),
-      certificate_authority_path=config['ca_dir']
-    )
-
-  def installConversionServer(self, ip, port, openoffice_port):
-    name = 'conversion_server'
-    working_directory = self.createDataDirectory(name)
-    conversion_server_dict = dict(
-      working_path=working_directory,
-      uno_path=self.options['ooo_uno_path'],
-      office_binary_path=self.options['ooo_binary_path'],
-      ip=ip,
-      port=port,
-      openoffice_port=openoffice_port,
-    )
-    for env_line in self.options['environment'].splitlines():
-      env_line = env_line.strip()
-      if not env_line:
-        continue
-      if '=' in env_line:
-        env_key, env_value = env_line.split('=')
-        conversion_server_dict[env_key.strip()] = env_value.strip()
-      else:
-        raise zc.buildout.UserError('Line %r in environment parameter is '
-            'incorrect' % env_line)
-    config_file = self.createConfigurationFile(name + '.cfg',
-        self.substituteTemplate(self.getTemplateFilename('cloudooo.cfg.in'),
-          conversion_server_dict))
-    self.path_list.append(config_file)
-    self.path_list.extend(zc.buildout.easy_install.scripts([(name,
-     'slapos.recipe.librecipe.execute', 'execute_with_signal_translation')], self.ws,
-      sys.executable, self.wrapper_directory,
-      arguments=[self.options['ooo_paster'].strip(), 'serve', config_file]))
-    return {
-      name + '_port': conversion_server_dict['port'],
-      name + '_ip': conversion_server_dict['ip']
-      }
-
-  def installHaproxy(self, ip, port, name, server_check_path, url_list):
-    # inter must be quite short in order to detect quickly an unresponsive node
-    #      and to detect quickly a node which is back
-    # rise must be minimal possible : 1, indeed, a node which is back don't need
-    #      to sleep more time and we can give him work immediately
-    # fall should be quite sort. with inter at 3, and fall at 2, a node will be
-    #      considered as dead after 6 seconds.
-    # maxconn should be set as the maximum thread we have per zope, like this
-    #      haproxy will manage the queue of request with the possibility to
-    #      move a request to another node if the initially selected one is dead
-    server_template = """  server %(name)s %(address)s cookie %(name)s check inter 3s rise 1 fall 2 maxconn %(cluster_zope_thread_amount)s"""
-    config = dict(name=name, ip=ip, port=port,
-        server_check_path=server_check_path,)
-    i = 1
-    server_list = []
-    cluster_zope_thread_amount = self.options.get('cluster_zope_thread_amount', 1)
-    for url in url_list:
-      server_list.append(server_template % dict(name='%s_%s' % (name, i),
-        address=url, cluster_zope_thread_amount=cluster_zope_thread_amount))
-      i += 1
-    config['server_text'] = '\n'.join(server_list)
-    haproxy_conf_path = self.createConfigurationFile('haproxy_%s.cfg' % name,
-      self.substituteTemplate(self.getTemplateFilename('haproxy.cfg.in'),
-        config))
-    self.path_list.append(haproxy_conf_path)
-    wrapper = zc.buildout.easy_install.scripts([('haproxy_%s' % name,
-     'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable,
-      self.wrapper_directory, arguments=[
-        self.options['haproxy_binary'].strip(), '-f', haproxy_conf_path]
-      )[0]
-    self.path_list.append(wrapper)
-    return '%s:%s' % (ip, port)
-
-  def installERP5(self):
-    """
-    All zope have to share file created by portal_classes
-    (until everything is integrated into the ZODB).
-    So, do not request zope instance and create multiple in the same partition.
-    """
-    # Create instance directories
-    self.erp5_directory = self.createDataDirectory('erp5shared')
-    # Create init user
-    password = self.generatePassword()
-    # XXX Unhardcoded me please
-    user = 'zope'
-    Zope2InitUser(
-        os.path.join(self.erp5_directory, "inituser"), user, password)
-
-    self._createDirectory(self.erp5_directory)
-    for directory in (
-      'Constraint',
-      'Document',
-      'Extensions',
-      'PropertySheet',
-      'import',
-      'lib',
-      'tests',
-      'Products',
-      'etc',
-      ):
-      self._createDirectory(os.path.join(self.erp5_directory, directory))
-    self._createDirectory(os.path.join(self.erp5_directory, 'etc',
-      'package-includes'))
-
-    # Symlink to BT5 repositories defined in instance config.
-    # Those paths will eventually end up in the ZODB, and having symlinks
-    # inside the XXX makes it possible to reuse such ZODB with another software
-    # release[ version].
-    # Note: this path cannot be used for development, it's really just a
-    # read-only repository.
-    repository_path = os.path.join(self.var_directory, "bt5_repository")
-    if not os.path.isdir(repository_path):
-      os.mkdir(repository_path)
-    self.path_list.append(repository_path)
-    self.bt5_repository_list = []
-    append = self.bt5_repository_list.append
-    for repository in self.options.get('bt5_repository_list', '').split():
-      repository = repository.strip()
-      if not repository:
-        continue
-
-      if _isurl(repository) and not repository.startswith("file://"):
-        # XXX: assume it's a valid URL
-        append(repository)
-        continue
-
-      if repository.startswith('file://'):
-        repository = repository.replace('file://', '', '')
-
-      if os.path.isabs(repository):
-        repo_id = hashlib.sha1(repository).hexdigest()
-        link = os.path.join(repository_path, repo_id)
-        if os.path.lexists(link):
-          if not os.path.islink(link):
-            raise zc.buildout.UserError(
-              'Target link already %r exists but it is not link' % link)
-          os.unlink(link)
-        os.symlink(repository, link)
-        self.logger.debug('Created link %r -> %r' % (link, repository_path))
-        # Always provide a URL-Type
-        append("file://" + link)
-
-    return user, password
-
-  def installERP5Site(self, user, password, zope_access, mysql_conf,
-                      conversion_server_conf=None, memcached_conf=None,
-                      kumo_conf=None,
-                      erp5_site_id='erp5', default_bt5_list=[], ca_conf={},
-                      supervisor_controlled=True):
-    """
-    Create  a script  to  automatically set  up  an erp5  site (controlled  by
-    supervisor by default) on available zope and mysql environments.
-    """
-    conversion_server = None
-    if conversion_server_conf is not None:
-      conversion_server = "%s:%s" % (conversion_server_conf['conversion_server_ip'],
-             conversion_server_conf['conversion_server_port'])
-    if memcached_conf is None:
-      memcached_conf = {}
-    if kumo_conf is None:
-      kumo_conf = {}
-    # XXX Conversion server and memcache server coordinates are not relevant
-    # for pure site creation.
-    mysql_connection_string = "%(mysql_database)s@%(ip)s:%(tcp_port)s %(mysql_user)s %(mysql_password)s" % mysql_conf
-
-    bt5_list = self.parameter_dict.get("bt5_list", "").split() or default_bt5_list
-    bt5_repository_list = self.parameter_dict.get("bt5_repository_list", "").split() \
-      or getattr(self, 'bt5_repository_list', [])
-
-    erp5_update_directory = supervisor_controlled and self.wrapper_directory or \
-        self.bin_directory
-
-    script = zc.buildout.easy_install.scripts([('erp5_update',
-            __name__ + '.erp5', 'updateERP5')], self.ws,
-                  sys.executable, erp5_update_directory,
-                  arguments=[erp5_site_id,
-                             mysql_connection_string,
-                             [user, password, zope_access],
-                             memcached_conf.get('memcached_url'),
-                             conversion_server,
-                             kumo_conf.get("kumo_address"),
-                             bt5_list,
-                             bt5_repository_list,
-                             ca_conf.get('certificate_authority_path'),
-                             self.options.get('openssl_binary')])
-
-    self.path_list.extend(script)
-
-    return []
-
-  def installZeo(self, ip):
-    zodb_dir = os.path.join(self.data_root_directory, 'zodb')
-    self._createDirectory(zodb_dir)
-    zeo_configuration_dict = {}
-    zeo_number = 0
-    for zeo_server in sorted(self._zeo_storage_dict.iterkeys()):
-      zeo_number += 1
-      zeo_event_log = os.path.join(self.log_directory, 'zeo-%s.log'% zeo_number)
-      zeo_pid = os.path.join(self.run_directory, 'zeo-%s.pid'% zeo_number)
-      self.registerLogRotation('zeo-%s' % zeo_number, [zeo_event_log],
-          self.killpidfromfile + ' ' + zeo_pid + ' SIGUSR2')
-      config = dict(
-        zeo_ip=ip,
-        zeo_port=self._zeo_storage_port_dict[zeo_server],
-        zeo_event_log=zeo_event_log,
-        zeo_pid=zeo_pid,
-      )
-      storage_definition_list = []
-      for storage_name in sorted(self._zeo_storage_dict[zeo_server]):
-        path = os.path.join(zodb_dir, '%s.fs' % storage_name)
-        storage_definition_list.append("""<filestorage %(storage_name)s>
-  path %(path)s
-</filestorage>"""% dict(storage_name=storage_name, path=path))
-        zeo_configuration_dict[storage_name] = dict(
-          ip=ip,
-          port=config['zeo_port'],
-          path=path
-          )
-      config['zeo_filestorage_snippet'] = '\n'.join(storage_definition_list)
-      zeo_conf_path = self.createConfigurationFile('zeo-%s.conf' % zeo_number,
-        self.substituteTemplate(self.getTemplateFilename('zeo.conf.in'), config))
-      self.path_list.append(zeo_conf_path)
-      wrapper = zc.buildout.easy_install.scripts([('zeo_%s' % zeo_number,
-       'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable,
-        self.wrapper_directory, arguments=[
-          self.options['runzeo_binary'].strip(), '-C', zeo_conf_path]
-        )[0]
-      self.path_list.append(wrapper)
-    return zeo_configuration_dict
-
-  def installRepozo(self, zodb_root_path):
-    """
-    Add only repozo to cron (e.g. without tidstorage) allowing full
-    and incremental backups.
-    """
-    backup_path = self.createBackupDirectory('zodb')
-    repozo_cron_path = os.path.join(self.cron_d, 'repozo')
-    repozo_cron_file = open(repozo_cron_path, 'w')
-    try:
-      repozo_cron_file.write('''
-0 0 * * 0 %(repozo_binary)s --backup --full --file="%(zodb_root_path)s" --repository="%(backup_path)s"
-0 * * * * %(repozo_binary)s --backup --file="%(zodb_root_path)s" --repository="%(backup_path)s"
-''' % dict(repozo_binary=self.options['repozo_binary'],
-           zodb_root_path=zodb_root_path,
-           backup_path=backup_path))
-    finally:
-      repozo_cron_file.close()
-
-    self.path_list.append(repozo_cron_path)
-
-  def installTidStorage(self, ip, port, known_tid_storage_identifier_dict,
-      access_url):
-    """Install TidStorage with all required backup tools
-
-      known_tid_storage_identifier_dict is a dictionary of:
-      (((ip, port),), storagename): (filestorage path, url for serialize)
-      url for serialize will be merged with access_url by internal tidstorage
-
-      """
-    backup_base_path = self.createBackupDirectory('zodb')
-    # it is time to fill known_tid_storage_identifier_dict with backup
-    # destination
-    formatted_storage_dict = dict()
-    for key, v in known_tid_storage_identifier_dict.copy().iteritems():
-      # generate unique name for each backup
-      storage_name = key[1]
-      destination = os.path.join(backup_base_path, storage_name)
-      self._createDirectory(destination)
-      formatted_storage_dict[str(key)] = (v[0], destination, v[1])
-    logfile = os.path.join(self.log_directory, 'tidstorage.log')
-    pidfile = os.path.join(self.run_directory, 'tidstorage.pid')
-    statusfile = os.path.join(self.log_directory, 'tidstorage.tid')
-    timestamp_file_path = os.path.join(self.log_directory,
-          'repozo_tidstorage_timestamp.log')
-    # shared configuration file
-    tidstorage_config = self.createConfigurationFile('tidstorage.py',
-        self.substituteTemplate(self.getTemplateFilename('tidstorage.py.in'),
-          dict(
-        known_tid_storage_identifier_dict=pprint.pformat(formatted_storage_dict),
-        base_url='%s/%%s/serialize' % access_url,
-        host=ip,
-        port=port,
-        timestamp_file_path=timestamp_file_path,
-        logfile=logfile,
-        pidfile=pidfile,
-        statusfile=statusfile
-      )))
-    # TID server
-    tidstorage_server = zc.buildout.easy_install.scripts([('tidstoraged',
-     'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable,
-      self.wrapper_directory, arguments=[
-        self.options['tidstoraged_binary'], '--nofork', '--config',
-        tidstorage_config])[0]
-    self.registerLogRotation('tidsorage', [logfile, timestamp_file_path],
-          self.killpidfromfile + ' ' + pidfile + ' SIGHUP')
-    self.path_list.append(tidstorage_config)
-    self.path_list.append(tidstorage_server)
-
-    # repozo wrapper
-    tidstorage_repozo = zc.buildout.easy_install.scripts([('tidstorage_repozo',
-     'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable,
-      self.bin_directory, arguments=[
-        self.options['tidstorage_repozo_binary'], '--config', tidstorage_config,
-      '--repozo', self.options['repozo_binary'], '-z'])[0]
-    self.path_list.append(tidstorage_repozo)
-
-    # and backup configuration
-    tidstorage_repozo_cron = os.path.join(self.cron_d, 'tidstorage_repozo')
-    open(tidstorage_repozo_cron, 'w').write('''0 0 * * * %(tidstorage_repozo)s
-0 0 * * * cp -f %(tidstorage_tid)s %(tidstorage_tid_backup)s'''%dict(
-      tidstorage_repozo=tidstorage_repozo,
-      tidstorage_tid=statusfile,
-      tidstorage_tid_backup=os.path.join(backup_base_path, 'tidstorage.tid')))
-    self.path_list.append(tidstorage_repozo_cron)
-    return dict(host=ip, port=port)
-
-  def installZope(self, ip, port, name, zodb_configuration_string,
-      with_timerservice=False, tidstorage_config=None, thread_amount=1,
-      with_deadlockdebugger=True, zope_environment=None):
-    default_zope_environment = dict(
-      TMP=self.tmp_directory,
-      TMPDIR=self.tmp_directory,
-      HOME=self.tmp_directory,
-      PATH=self.bin_directory
-    )
-    if zope_environment is None:
-      zope_environment = default_zope_environment.copy()
-    else:
-      for envk, envv in default_zope_environment.iteritems():
-        if envk not in zope_environment:
-          zope_environment[envk] = envv
-    # Create zope configuration file
-    zope_config = dict(
-        products=self.options['products'],
-        thread_amount=thread_amount
-    )
-    # configure default Zope2 zcml
-    open(os.path.join(self.erp5_directory, 'etc', 'site.zcml'), 'w').write(
-        pkg_resources.resource_string(__name__, 'template/site.zcml'))
-    zope_config['zodb_configuration_string'] = zodb_configuration_string
-    zope_config['instance'] = self.erp5_directory
-    zope_config['event_log'] = os.path.join(self.log_directory,
-        '%s-event.log' % name)
-    zope_config['z2_log'] = os.path.join(self.log_directory,
-        '%s-Z2.log' % name)
-    zope_config['pid-filename'] = os.path.join(self.run_directory,
-        '%s.pid' % name)
-    zope_config['lock-filename'] = os.path.join(self.run_directory,
-        '%s.lock' % name)
-    self.registerLogRotation(name, [zope_config['event_log'],
-      zope_config['z2_log']], self.killpidfromfile + ' ' +
-      zope_config['pid-filename'] + ' SIGUSR2')
-
-    prefixed_products = []
-    for product in reversed(zope_config['products'].split()):
-      product = product.strip()
-      if product:
-        prefixed_products.append('products %s' % product)
-    prefixed_products.insert(0, 'products %s' % os.path.join(
-                             self.erp5_directory, 'Products'))
-    zope_config['products'] = '\n'.join(prefixed_products)
-    zope_config['address'] = '%s:%s' % (ip, port)
-
-    zope_wrapper_template_location = self.getTemplateFilename('zope.conf.in')
-    zope_conf_content = self.substituteTemplate(
-        zope_wrapper_template_location, zope_config)
-    if with_timerservice:
-      zope_conf_content += self.substituteTemplate(
-          self.getTemplateFilename('zope.conf.timerservice.in'), zope_config)
-    if tidstorage_config is not None:
-      zope_conf_content += self.substituteTemplate(
-          self.getTemplateFilename('zope-tidstorage-snippet.conf.in'),
-          tidstorage_config)
-    if with_deadlockdebugger:
-      zope_conf_content += self.substituteTemplate(
-          self.getTemplateFilename('zope-deadlockdebugger-snippet.conf.in'),
-          dict(dump_url='/manage_debug_threads',
-            secret=self.generatePassword()))
-
-    zope_conf_path = self.createConfigurationFile("%s.conf" % name,
-        zope_conf_content)
-    self.path_list.append(zope_conf_path)
-    # Create init script
-    wrapper = zc.buildout.easy_install.scripts([(name,
-     'slapos.recipe.librecipe.execute', 'executee')], self.ws, sys.executable,
-      self.wrapper_directory, arguments=[
-        [self.options['runzope_binary'].strip(), '-C', zope_conf_path],
-        zope_environment
-      ])[0]
-    self.path_list.append(wrapper)
-    return zope_config['address']
-
   def _getApacheConfigurationDict(self, prefix, ip, port):
     apache_conf = dict()
     apache_conf['pid_file'] = os.path.join(self.run_directory,
@@ -1118,166 +201,3 @@ SSLCARevocationPath %(ca_crl)s"""
           ]))
     # Note: IPv6 is assumed always
     return 'https://%(server_name)s:%(port)s%(frontend_path)s' % (apache_conf)
-
-  def installBackendApache(self, ip, port, backend, key, certificate,
-      suffix='', access_control_string=None):
-    apache_conf = self._getApacheConfigurationDict('backend_apache'+suffix, ip,
-        port)
-    apache_conf['server_name'] = '%s' % apache_conf['ip']
-    apache_conf['ssl_snippet'] = pkg_resources.resource_string(__name__,
-        'template/apache.ssl-snippet.conf.in') % dict(
-        login_certificate=certificate, login_key=key)
-    apache_config_file = self._writeApacheConfiguration('backend_apache'+suffix,
-        apache_conf, backend, access_control_string)
-    self.path_list.append(apache_config_file)
-    self.path_list.extend(zc.buildout.easy_install.scripts([(
-      'backend_apache'+suffix,
-        __name__ + '.apache', 'runApache')], self.ws,
-          sys.executable, self.wrapper_directory, arguments=[
-            dict(
-              required_path_list=[key, certificate],
-              binary=self.options['httpd_binary'],
-              config=apache_config_file
-            )
-          ]))
-    # Note: IPv6 is assumed always
-    return 'https://[%(ip)s]:%(port)s' % apache_conf
-
-  def installMysqlServer(self, ip, port, database='erp5', user='user',
-      test_database='test_erp5', test_user='test_user', template_filename=None,
-      parallel_test_database_amount=100, mysql_conf=None, with_backup=True,
-      with_maatkit=True):
-    if mysql_conf is None:
-      mysql_conf = {}
-    backup_directory = self.createBackupDirectory('mysql')
-    if template_filename is None:
-      template_filename = self.getTemplateFilename('my.cnf.in')
-    error_log = os.path.join(self.log_directory, 'mysqld.log')
-    slow_query_log = os.path.join(self.log_directory, 'mysql-slow.log')
-    mysql_conf.update(
-        ip=ip,
-        data_directory=os.path.join(self.data_root_directory,
-          'mysql'),
-        tcp_port=port,
-        pid_file=os.path.join(self.run_directory, 'mysqld.pid'),
-        socket=os.path.join(self.run_directory, 'mysqld.sock'),
-        error_log=error_log,
-        slow_query_log=slow_query_log,
-        mysql_database=database,
-        mysql_user=user,
-        mysql_password=self.generatePassword(),
-        mysql_test_password=self.generatePassword(),
-        mysql_test_database=test_database,
-        mysql_test_user=test_user,
-        mysql_parallel_test_dict=[
-            ('test_%i' % x,)*2 + (self.generatePassword(),) \
-                 for x in xrange(0,parallel_test_database_amount)],
-    )
-    self.registerLogRotation('mysql', [error_log, slow_query_log],
-        '%(mysql_binary)s --no-defaults -B --user=root '
-        '--socket=%(mysql_socket)s -e "FLUSH LOGS"' % dict(
-          mysql_binary=self.options['mysql_binary'],
-          mysql_socket=mysql_conf['socket']))
-    self._createDirectory(mysql_conf['data_directory'])
-
-    mysql_conf_path = self.createConfigurationFile("my.cnf",
-        self.substituteTemplate(template_filename,
-          mysql_conf))
-
-    mysql_script_list = []
-    for x_database, x_user, x_password in \
-          [(mysql_conf['mysql_database'],
-            mysql_conf['mysql_user'],
-            mysql_conf['mysql_password']),
-           (mysql_conf['mysql_test_database'],
-            mysql_conf['mysql_test_user'],
-            mysql_conf['mysql_test_password']),
-          ] + mysql_conf['mysql_parallel_test_dict']:
-      mysql_script_list.append(pkg_resources.resource_string(__name__,
-                     'template/initmysql.sql.in') % {
-                        'mysql_database': x_database,
-                        'mysql_user': x_user,
-                        'mysql_password': x_password})
-    mysql_script_list.append('EXIT')
-    mysql_script = '\n'.join(mysql_script_list)
-    self.path_list.extend(zc.buildout.easy_install.scripts([('mysql_update',
-      __name__ + '.mysql', 'updateMysql')], self.ws,
-      sys.executable, self.wrapper_directory, arguments=[dict(
-        mysql_script=mysql_script,
-        mysql_binary=self.options['mysql_binary'].strip(),
-        mysql_upgrade_binary=self.options['mysql_upgrade_binary'].strip(),
-        socket=mysql_conf['socket'],
-        )]))
-    self.path_list.extend(zc.buildout.easy_install.scripts([('mysqld',
-      __name__ + '.mysql', 'runMysql')], self.ws,
-        sys.executable, self.wrapper_directory, arguments=[dict(
-        mysql_install_binary=self.options['mysql_install_binary'].strip(),
-        mysqld_binary=self.options['mysqld_binary'].strip(),
-        data_directory=mysql_conf['data_directory'].strip(),
-        mysql_binary=self.options['mysql_binary'].strip(),
-        socket=mysql_conf['socket'].strip(),
-        configuration_file=mysql_conf_path,
-       )]))
-    self.path_list.extend([mysql_conf_path])
-
-    if with_backup:
-      # backup configuration
-      backup_directory = self.createBackupDirectory('mysql')
-      full_backup = os.path.join(backup_directory, 'full')
-      incremental_backup = os.path.join(backup_directory, 'incremental')
-      self._createDirectory(full_backup)
-      self._createDirectory(incremental_backup)
-      innobackupex_argument_list = [self.options['perl_binary'],
-          self.options['innobackupex_binary'],
-          '--defaults-file=%s' % mysql_conf_path,
-          '--socket=%s' %mysql_conf['socket'].strip(), '--user=root',
-          '--ibbackup=%s'% self.options['xtrabackup_binary']]
-      environment = dict(PATH='%s' % self.bin_directory)
-      innobackupex_incremental = zc.buildout.easy_install.scripts([(
-        'innobackupex_incremental','slapos.recipe.librecipe.execute', 'executee')],
-        self.ws, sys.executable, self.bin_directory, arguments=[
-          innobackupex_argument_list + ['--incremental'],
-          environment])[0]
-      self.path_list.append(innobackupex_incremental)
-      innobackupex_full = zc.buildout.easy_install.scripts([('innobackupex_full',
-       'slapos.recipe.librecipe.execute', 'executee')], self.ws,
-        sys.executable, self.bin_directory, arguments=[
-          innobackupex_argument_list,
-          environment])[0]
-      self.path_list.append(innobackupex_full)
-      backup_controller = zc.buildout.easy_install.scripts([
-        ('innobackupex_controller', __name__ + '.innobackupex', 'controller')],
-        self.ws, sys.executable, self.bin_directory,
-        arguments=[innobackupex_incremental, innobackupex_full, full_backup,
-          incremental_backup])[0]
-      self.path_list.append(backup_controller)
-      mysql_backup_cron = os.path.join(self.cron_d, 'mysql_backup')
-      open(mysql_backup_cron, 'w').write('0 0 * * * ' + backup_controller)
-      self.path_list.append(mysql_backup_cron)
-
-    if with_maatkit:
-      # maatkit installation
-      for mk_script_name in (
-          'mk-variable-advisor',
-          'mk-table-usage',
-          'mk-visual-explain',
-          'mk-config-diff',
-          'mk-deadlock-logger',
-          'mk-error-log',
-          'mk-index-usage',
-          'mk-query-advisor',
-          ):
-        mk_argument_list = [self.options['perl_binary'],
-            self.options['%s_binary' % mk_script_name],
-            '--defaults-file=%s' % mysql_conf_path,
-            '--socket=%s' %mysql_conf['socket'].strip(), '--user=root',
-            ]
-        environment = dict(PATH='%s' % self.bin_directory)
-        mk_exe = zc.buildout.easy_install.scripts([(
-          mk_script_name,'slapos.recipe.librecipe.execute', 'executee')],
-          self.ws, sys.executable, self.bin_directory, arguments=[
-            mk_argument_list, environment])[0]
-        self.path_list.append(mk_exe)
-
-    # The return could be more explicit database, user ...
-    return mysql_conf
diff --git a/slapos/recipe/erp5/catdatefile.py b/slapos/recipe/erp5/catdatefile.py
deleted file mode 100644
index d3de298b272cce0eba88570aa6734ee74115e58e..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/catdatefile.py
+++ /dev/null
@@ -1,14 +0,0 @@
-import os
-import sys
-import time
-def catdatefile(args):
-  directory = args[0]
-  try:
-    suffix = args[1]
-  except IndexError:
-    suffix = '.log'
-  f = open(os.path.join(directory,
-    time.strftime('%Y-%m-%d.%H:%M.%s') + suffix), 'aw')
-  for line in sys.stdin.read():
-    f.write(line)
-  f.close()
diff --git a/slapos/recipe/erp5/certificate_authority.py b/slapos/recipe/erp5/certificate_authority.py
deleted file mode 100644
index 8caffc0c21b2852f259a9b6f85bda5e311965c47..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/certificate_authority.py
+++ /dev/null
@@ -1,112 +0,0 @@
-import os
-import subprocess
-import time
-import ConfigParser
-
-
-def popenCommunicate(command_list, input=None):
-  subprocess_kw = dict(stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-  if input is not None:
-    subprocess_kw.update(stdin=subprocess.PIPE)
-  popen = subprocess.Popen(command_list, **subprocess_kw)
-  result = popen.communicate(input)[0]
-  if popen.returncode is None:
-    popen.kill()
-  if popen.returncode != 0:
-    raise ValueError('Issue during calling %r, result was:\n%s' % (
-      command_list, result))
-  return result
-
-
-class CertificateAuthority:
-  def __init__(self, key, certificate, openssl_binary,
-      openssl_configuration, request_dir):
-    self.key = key
-    self.certificate = certificate
-    self.openssl_binary = openssl_binary
-    self.openssl_configuration = openssl_configuration
-    self.request_dir = request_dir
-
-  def checkAuthority(self):
-    file_list = [ self.key, self.certificate ]
-    ca_ready = True
-    for f in file_list:
-      if not os.path.exists(f):
-        ca_ready = False
-        break
-    if ca_ready:
-      return
-    for f in file_list:
-      if os.path.exists(f):
-        os.unlink(f)
-    try:
-      # no CA, let us create new one
-      popenCommunicate([self.openssl_binary, 'req', '-nodes', '-config',
-          self.openssl_configuration, '-new', '-x509', '-extensions',
-          'v3_ca', '-keyout', self.key, '-out', self.certificate,
-          '-days', '10950'], 'Automatic Certificate Authority\n')
-    except:
-      try:
-        for f in file_list:
-          if os.path.exists(f):
-            os.unlink(f)
-      except:
-        # do not raise during cleanup
-        pass
-      raise
-
-  def _checkCertificate(self, common_name, key, certificate):
-    file_list = [key, certificate]
-    ready = True
-    for f in file_list:
-      if not os.path.exists(f):
-        ready = False
-        break
-    if ready:
-      return False
-    for f in file_list:
-      if os.path.exists(f):
-        os.unlink(f)
-    csr = certificate + '.csr'
-    try:
-      popenCommunicate([self.openssl_binary, 'req', '-config',
-        self.openssl_configuration, '-nodes', '-new', '-keyout',
-        key, '-out', csr, '-days', '3650'],
-        common_name + '\n')
-      try:
-        popenCommunicate([self.openssl_binary, 'ca', '-batch', '-config',
-          self.openssl_configuration, '-out', certificate,
-          '-infiles', csr])
-      finally:
-        if os.path.exists(csr):
-          os.unlink(csr)
-    except:
-      try:
-        for f in file_list:
-          if os.path.exists(f):
-            os.unlink(f)
-      except:
-        # do not raise during cleanup
-        pass
-      raise
-    else:
-      return True
-
-  def checkRequestDir(self):
-    for request_file in os.listdir(self.request_dir):
-      parser = ConfigParser.RawConfigParser()
-      parser.readfp(open(os.path.join(self.request_dir, request_file), 'r'))
-      if self._checkCertificate(parser.get('certificate', 'name'),
-          parser.get('certificate', 'key_file'), parser.get('certificate',
-            'certificate_file')):
-        print 'Created certificate %r' % parser.get('certificate', 'name')
-
-def runCertificateAuthority(args):
-  ca_conf = args[0]
-  ca = CertificateAuthority(ca_conf['key'], ca_conf['certificate'],
-      ca_conf['openssl_binary'], ca_conf['openssl_configuration'],
-      ca_conf['request_dir'])
-  while True:
-    ca.checkAuthority()
-    ca.checkRequestDir()
-    time.sleep(60)
diff --git a/slapos/recipe/erp5/killpidfromfile.py b/slapos/recipe/erp5/killpidfromfile.py
deleted file mode 100644
index 8082ea1b76408b0a5c9c078e946482c8e2a84a58..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/killpidfromfile.py
+++ /dev/null
@@ -1,12 +0,0 @@
-import sys
-import os
-import signal
-def killpidfromfile():
-  file = sys.argv[1]
-  sig = getattr(signal, sys.argv[2], None)
-  if sig is None:
-    raise ValueError('Unknwon signal name %s' % sys.argv[2])
-  if os.path.exists(file):
-    pid = int(open(file).read())
-    print 'Killing pid %s with signal %s' % (pid, sys.argv[2])
-    os.kill(pid, sig)
diff --git a/slapos/recipe/erp5/template/apache.ssl-snippet.conf.in b/slapos/recipe/erp5/template/apache.ssl-snippet.conf.in
index f85a164cb87fee8995a4ee4bfe8f99a18906cc80..8da5b7b1982c372c4efee8e083cde9460e93cff7 100644
--- a/slapos/recipe/erp5/template/apache.ssl-snippet.conf.in
+++ b/slapos/recipe/erp5/template/apache.ssl-snippet.conf.in
@@ -3,5 +3,7 @@ SSLCertificateFile %(login_certificate)s
 SSLCertificateKeyFile %(login_key)s
 SSLRandomSeed startup builtin
 SSLRandomSeed connect builtin
+SSLProtocol -ALL +SSLv3 +TLSv1
+SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM
 
 SSLProxyEngine On
diff --git a/slapos/recipe/erp5/template/apache.zope.conf.in b/slapos/recipe/erp5/template/apache.zope.conf.in
index f24a5327b68651531f1f7e25832dfd36d85cded3..a63d292996d3842c9883126a7ba44b2da1b16564 100644
--- a/slapos/recipe/erp5/template/apache.zope.conf.in
+++ b/slapos/recipe/erp5/template/apache.zope.conf.in
@@ -26,6 +26,10 @@ TypesConfig conf/mime.types
 AddType application/x-compress .Z
 AddType application/x-gzip .gz .tgz
 
+ServerTokens Prod
+ServerSignature Off
+TraceEnable Off
+
 # As backend is trusting REMOTE_USER header unset it always
 RequestHeader unset REMOTE_USER
 
diff --git a/slapos/recipe/erp5/template/logrotate_entry.in b/slapos/recipe/erp5/template/logrotate_entry.in
deleted file mode 100644
index 14461dccf875d9ae57ef4728bc77525855a20041..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/template/logrotate_entry.in
+++ /dev/null
@@ -1,13 +0,0 @@
-%(file_list)s {
-  daily
-  dateext
-  rotate 3650
-  compress
-  notifempty
-  sharedscripts
-  create
-  postrotate
-    %(postrotate)s
-  endscript
-  olddir %(olddir)s
-}
diff --git a/slapos/recipe/erp5/template/mysql-init-function.sql.in b/slapos/recipe/erp5/template/mysql-init-function.sql.in
new file mode 100644
index 0000000000000000000000000000000000000000..c4d0cbde46c01372b3808db3601e517e14788b4e
--- /dev/null
+++ b/slapos/recipe/erp5/template/mysql-init-function.sql.in
@@ -0,0 +1,5 @@
+USE mysql;
+DROP FUNCTION IF EXISTS last_insert_grn_id;
+CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME 'ha_groonga.so';
+DROP FUNCTION IF EXISTS sphinx_snippets;
+CREATE FUNCTION sphinx_snippets RETURNS STRING SONAME 'sphinx.so';
diff --git a/slapos/recipe/erp5/template/openssl.cnf.ca.in b/slapos/recipe/erp5/template/openssl.cnf.ca.in
deleted file mode 100644
index 8a450a68762145e72923635273e06a00e80d34ca..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/template/openssl.cnf.ca.in
+++ /dev/null
@@ -1,350 +0,0 @@
-#
-# OpenSSL example configuration file.
-# This is mostly being used for generation of certificate requests.
-#
-
-# This definition stops the following lines choking if HOME isn't
-# defined.
-HOME			= .
-RANDFILE		= $ENV::HOME/.rnd
-
-# Extra OBJECT IDENTIFIER info:
-#oid_file		= $ENV::HOME/.oid
-oid_section		= new_oids
-
-# To use this configuration file with the "-extfile" option of the
-# "openssl x509" utility, name here the section containing the
-# X.509v3 extensions to use:
-# extensions		= 
-# (Alternatively, use a configuration file that has only
-# X.509v3 extensions in its main [= default] section.)
-
-[ new_oids ]
-
-# We can add new OIDs in here for use by 'ca', 'req' and 'ts'.
-# Add a simple OID like this:
-# testoid1=1.2.3.4
-# Or use config file substitution like this:
-# testoid2=${testoid1}.5.6
-
-# Policies used by the TSA examples.
-tsa_policy1 = 1.2.3.4.1
-tsa_policy2 = 1.2.3.4.5.6
-tsa_policy3 = 1.2.3.4.5.7
-
-####################################################################
-[ ca ]
-default_ca	= CA_default		# The default ca section
-
-####################################################################
-[ CA_default ]
-
-dir		= %(working_directory)s		# Where everything is kept
-certs		= $dir/certs		# Where the issued certs are kept
-crl_dir		= $dir/crl		# Where the issued crl are kept
-database	= $dir/index.txt	# database index file.
-#unique_subject	= no			# Set to 'no' to allow creation of
-					# several ctificates with same subject.
-new_certs_dir	= $dir/newcerts		# default place for new certs.
-
-certificate	= $dir/cacert.pem 	# The CA certificate
-serial		= $dir/serial 		# The current serial number
-crlnumber	= $dir/crlnumber	# the current crl number
-					# must be commented out to leave a V1 CRL
-crl		= $dir/crl.pem 		# The current CRL
-private_key	= $dir/private/cakey.pem # The private key
-RANDFILE	= $dir/private/.rand	# private random number file
-
-x509_extensions	= usr_cert		# The extentions to add to the cert
-
-# Comment out the following two lines for the "traditional"
-# (and highly broken) format.
-name_opt 	= ca_default		# Subject Name options
-cert_opt 	= ca_default		# Certificate field options
-
-# Extension copying option: use with caution.
-# copy_extensions = copy
-
-# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
-# so this is commented out by default to leave a V1 CRL.
-# crlnumber must also be commented out to leave a V1 CRL.
-# crl_extensions	= crl_ext
-
-default_days	= 3650			# how long to certify for
-default_crl_days= 30			# how long before next CRL
-default_md	= default		# use public key default MD
-preserve	= no			# keep passed DN ordering
-
-# A few difference way of specifying how similar the request should look
-# For type CA, the listed attributes must be the same, and the optional
-# and supplied fields are just that :-)
-policy		= policy_match
-
-# For the CA policy
-[ policy_match ]
-countryName		= match
-stateOrProvinceName	= match
-organizationName	= match
-organizationalUnitName	= optional
-commonName		= supplied
-emailAddress		= optional
-
-# For the 'anything' policy
-# At this point in time, you must list all acceptable 'object'
-# types.
-[ policy_anything ]
-countryName		= optional
-stateOrProvinceName	= optional
-localityName		= optional
-organizationName	= optional
-organizationalUnitName	= optional
-commonName		= supplied
-emailAddress		= optional
-
-####################################################################
-[ req ]
-default_bits		= 2048
-default_md		= sha1
-default_keyfile 	= privkey.pem
-distinguished_name	= req_distinguished_name
-#attributes		= req_attributes
-x509_extensions	= v3_ca	# The extentions to add to the self signed cert
-
-# Passwords for private keys if not present they will be prompted for
-# input_password = secret
-# output_password = secret
-
-# This sets a mask for permitted string types. There are several options. 
-# default: PrintableString, T61String, BMPString.
-# pkix	 : PrintableString, BMPString (PKIX recommendation before 2004)
-# utf8only: only UTF8Strings (PKIX recommendation after 2004).
-# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
-# MASK:XXXX a literal mask value.
-# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.
-string_mask = utf8only
-
-# req_extensions = v3_req # The extensions to add to a certificate request
-
-[ req_distinguished_name ]
-countryName			= Country Name (2 letter code)
-countryName_value		= %(country_code)s
-countryName_min			= 2
-countryName_max			= 2
-
-stateOrProvinceName		= State or Province Name (full name)
-stateOrProvinceName_value	= %(state)s
-
-localityName			= Locality Name (eg, city)
-localityName_value		= %(city)s
-
-0.organizationName		= Organization Name (eg, company)
-0.organizationName_value	= %(company)s
-
-# we can do this but it is not needed normally :-)
-#1.organizationName		= Second Organization Name (eg, company)
-#1.organizationName_default	= World Wide Web Pty Ltd
-
-commonName			= Common Name (eg, your name or your server\'s hostname)
-commonName_max			= 64
-
-emailAddress			= Email Address
-emailAddress_value = %(email_address)s
-emailAddress_max		= 64
-
-# SET-ex3			= SET extension number 3
-
-#[ req_attributes ]
-#challengePassword		= A challenge password
-#challengePassword_min		= 4
-#challengePassword_max		= 20
-#
-#unstructuredName		= An optional company name
-
-[ usr_cert ]
-
-# These extensions are added when 'ca' signs a request.
-
-# This goes against PKIX guidelines but some CAs do it and some software
-# requires this to avoid interpreting an end user certificate as a CA.
-
-basicConstraints=CA:FALSE
-
-# Here are some examples of the usage of nsCertType. If it is omitted
-# the certificate can be used for anything *except* object signing.
-
-# This is OK for an SSL server.
-# nsCertType			= server
-
-# For an object signing certificate this would be used.
-# nsCertType = objsign
-
-# For normal client use this is typical
-# nsCertType = client, email
-
-# and for everything including object signing:
-# nsCertType = client, email, objsign
-
-# This is typical in keyUsage for a client certificate.
-# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-# This will be displayed in Netscape's comment listbox.
-nsComment			= "OpenSSL Generated Certificate"
-
-# PKIX recommendations harmless if included in all certificates.
-subjectKeyIdentifier=hash
-authorityKeyIdentifier=keyid,issuer
-
-# This stuff is for subjectAltName and issuerAltname.
-# Import the email address.
-# subjectAltName=email:copy
-# An alternative to produce certificates that aren't
-# deprecated according to PKIX.
-# subjectAltName=email:move
-
-# Copy subject details
-# issuerAltName=issuer:copy
-
-#nsCaRevocationUrl		= http://www.domain.dom/ca-crl.pem
-#nsBaseUrl
-#nsRevocationUrl
-#nsRenewalUrl
-#nsCaPolicyUrl
-#nsSslServerName
-
-# This is required for TSA certificates.
-# extendedKeyUsage = critical,timeStamping
-
-[ v3_req ]
-
-# Extensions to add to a certificate request
-
-basicConstraints = CA:FALSE
-keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-[ v3_ca ]
-
-
-# Extensions for a typical CA
-
-
-# PKIX recommendation.
-
-subjectKeyIdentifier=hash
-
-authorityKeyIdentifier=keyid:always,issuer
-
-# This is what PKIX recommends but some broken software chokes on critical
-# extensions.
-#basicConstraints = critical,CA:true
-# So we do this instead.
-basicConstraints = CA:true
-
-# Key usage: this is typical for a CA certificate. However since it will
-# prevent it being used as an test self-signed certificate it is best
-# left out by default.
-# keyUsage = cRLSign, keyCertSign
-
-# Some might want this also
-# nsCertType = sslCA, emailCA
-
-# Include email address in subject alt name: another PKIX recommendation
-# subjectAltName=email:copy
-# Copy issuer details
-# issuerAltName=issuer:copy
-
-# DER hex encoding of an extension: beware experts only!
-# obj=DER:02:03
-# Where 'obj' is a standard or added object
-# You can even override a supported extension:
-# basicConstraints= critical, DER:30:03:01:01:FF
-
-[ crl_ext ]
-
-# CRL extensions.
-# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
-
-# issuerAltName=issuer:copy
-authorityKeyIdentifier=keyid:always
-
-[ proxy_cert_ext ]
-# These extensions should be added when creating a proxy certificate
-
-# This goes against PKIX guidelines but some CAs do it and some software
-# requires this to avoid interpreting an end user certificate as a CA.
-
-basicConstraints=CA:FALSE
-
-# Here are some examples of the usage of nsCertType. If it is omitted
-# the certificate can be used for anything *except* object signing.
-
-# This is OK for an SSL server.
-# nsCertType			= server
-
-# For an object signing certificate this would be used.
-# nsCertType = objsign
-
-# For normal client use this is typical
-# nsCertType = client, email
-
-# and for everything including object signing:
-# nsCertType = client, email, objsign
-
-# This is typical in keyUsage for a client certificate.
-# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
-
-# This will be displayed in Netscape's comment listbox.
-nsComment			= "OpenSSL Generated Certificate"
-
-# PKIX recommendations harmless if included in all certificates.
-subjectKeyIdentifier=hash
-authorityKeyIdentifier=keyid,issuer
-
-# This stuff is for subjectAltName and issuerAltname.
-# Import the email address.
-# subjectAltName=email:copy
-# An alternative to produce certificates that aren't
-# deprecated according to PKIX.
-# subjectAltName=email:move
-
-# Copy subject details
-# issuerAltName=issuer:copy
-
-#nsCaRevocationUrl		= http://www.domain.dom/ca-crl.pem
-#nsBaseUrl
-#nsRevocationUrl
-#nsRenewalUrl
-#nsCaPolicyUrl
-#nsSslServerName
-
-# This really needs to be in place for it to be a proxy certificate.
-proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
-
-####################################################################
-[ tsa ]
-
-default_tsa = tsa_config1	# the default TSA section
-
-[ tsa_config1 ]
-
-# These are used by the TSA reply generation only.
-dir		= /etc/pki/tls		# TSA root directory
-serial		= $dir/tsaserial	# The current serial number (mandatory)
-crypto_device	= builtin		# OpenSSL engine to use for signing
-signer_cert	= $dir/tsacert.pem 	# The TSA signing certificate
-					# (optional)
-certs		= $dir/cacert.pem	# Certificate chain to include in reply
-					# (optional)
-signer_key	= $dir/private/tsakey.pem # The TSA private key (optional)
-
-default_policy	= tsa_policy1		# Policy if request did not specify it
-					# (optional)
-other_policies	= tsa_policy2, tsa_policy3	# acceptable policies (optional)
-digests		= md5, sha1		# Acceptable message digests (mandatory)
-accuracy	= secs:1, millisecs:500, microsecs:100	# (optional)
-clock_precision_digits  = 0	# number of digits after dot. (optional)
-ordering		= yes	# Is ordering defined for timestamps?
-				# (optional, default: no)
-tsa_name		= yes	# Must the TSA name be included in the reply?
-				# (optional, default: no)
-ess_cert_id_chain	= no	# Must the ESS cert id chain be included?
-				# (optional, default: no)
diff --git a/slapos/recipe/erp5/template/tidstorage.py.in b/slapos/recipe/erp5/template/tidstorage.py.in
deleted file mode 100644
index 88892982e2cb1c7d4d544d23f93aecf22256e2c9..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/template/tidstorage.py.in
+++ /dev/null
@@ -1,15 +0,0 @@
-known_tid_storage_identifier_dict = %(known_tid_storage_identifier_dict)s
-base_url = '%(base_url)s'
-address = '%(host)s'
-port = %(port)s
-
-#fork = False
-#setuid = None
-#setgid = None
-burst_period = 30
-full_dump_period = 300
-
-timestamp_file_path = '%(timestamp_file_path)s'
-logfile_name = '%(logfile)s'
-pidfile_name = '%(pidfile)s'
-status_file = '%(statusfile)s'
diff --git a/slapos/recipe/erp5/template/zope-deadlockdebugger-snippet.conf.in b/slapos/recipe/erp5/template/zope-deadlockdebugger-snippet.conf.in
deleted file mode 100644
index 22df184d3de0b5d64d0fb3f1fe6f632b10f454db..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/template/zope-deadlockdebugger-snippet.conf.in
+++ /dev/null
@@ -1,7 +0,0 @@
-
-# DeadlockDebugger configuration
-<product-config DeadlockDebugger>
-  dump_url %(dump_url)s
-  secret %(secret)s
-</product-config>
-
diff --git a/slapos/recipe/erp5/template/zope-tidstorage-snippet.conf.in b/slapos/recipe/erp5/template/zope-tidstorage-snippet.conf.in
deleted file mode 100644
index cced8c752a35a8ae7d7698c0831fced42b6aa0c7..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/template/zope-tidstorage-snippet.conf.in
+++ /dev/null
@@ -1,6 +0,0 @@
-
-# TIDStorage connection
-<product-config TIDStorage>
-  backend-ip %(host)s
-  backend-port %(port)s
-</product-config>
diff --git a/slapos/recipe/erp5/template/zope-zeo-snippet.conf.in b/slapos/recipe/erp5/template/zope-zeo-snippet.conf.in
deleted file mode 100644
index dbd9bcac222f08ad6697e74c5e8cd62017ce9648..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/template/zope-zeo-snippet.conf.in
+++ /dev/null
@@ -1,10 +0,0 @@
-<zodb_db %(storage_name)s>
-  cache-size %(zodb_cache_size)d
-  mount-point %(mount_point)s
-  <zeoclient>
-    cache-size %(zeo_client_cache_size)s
-    server %(address)s
-    storage %(storage_name)s
-    name %(storage_name)s
-  </zeoclient>
-</zodb_db>
diff --git a/slapos/recipe/erp5/template/zope-zodb-snippet.conf.in b/slapos/recipe/erp5/template/zope-zodb-snippet.conf.in
deleted file mode 100644
index 4eb6a051bdcbc2a575d34bf9f299dfdfb43b1596..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/template/zope-zodb-snippet.conf.in
+++ /dev/null
@@ -1,7 +0,0 @@
-<zodb_db root>
-    cache-size %(zodb_cache_size)d
-    <filestorage>
-      path %(zodb_root_path)s
-    </filestorage>
-    mount-point /
-</zodb_db>
diff --git a/slapos/recipe/erp5/test_suite_runner.py b/slapos/recipe/erp5/test_suite_runner.py
deleted file mode 100644
index f58d6ad47fdb138c61c6082aeeb49d0613a5e2bf..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/test_suite_runner.py
+++ /dev/null
@@ -1,23 +0,0 @@
-import os
-import sys
-def runTestSuite(args):
-  env = os.environ.copy()
-  d = args[0]
-  env['OPENSSL_BINARY'] = d['openssl_binary']
-  env['TEST_CA_PATH'] = d['test_ca_path']
-  env['PATH'] = ':'.join([d['prepend_path']] + os.environ['PATH'].split(':'))
-  env['INSTANCE_HOME'] = d['instance_home']
-  env['REAL_INSTANCE_HOME'] = d['instance_home']
-  # Deal with Shebang size limitation
-  executable_filepath = d['call_list'][0]
-  file_object = open(executable_filepath, 'r')
-  line = file_object.readline()
-  file_object.close()
-  argument_list = []
-  if line[:2] == '#!':
-    executable_filepath = line[2:].strip()
-    argument_list.append(executable_filepath)
-  argument_list.extend(d['call_list'])
-  argument_list.extend(sys.argv[1:])
-  argument_list.append(env)
-  os.execle(executable_filepath, *argument_list)
diff --git a/slapos/recipe/erp5/testrunner.py b/slapos/recipe/erp5/testrunner.py
deleted file mode 100644
index 5aa09c11b65ea039828f84e8c2e43714339865c1..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5/testrunner.py
+++ /dev/null
@@ -1,23 +0,0 @@
-import os
-import sys
-def runUnitTest(args):
-  env = os.environ.copy()
-  d = args[0]
-  env['OPENSSL_BINARY'] = d['openssl_binary']
-  env['TEST_CA_PATH'] = d['test_ca_path']
-  env['PATH'] = ':'.join([d['prepend_path']] + os.environ['PATH'].split(':'))
-  env['INSTANCE_HOME'] = d['instance_home']
-  env['REAL_INSTANCE_HOME'] = d['instance_home']
-  # Deal with Shebang size limitation
-  executable_filepath = d['call_list'][0]
-  file_object = open(executable_filepath, 'r')
-  line = file_object.readline()
-  file_object.close()
-  argument_list = []
-  if line[:2] == '#!':
-    executable_filepath = line[2:].strip()
-    argument_list.append(executable_filepath)
-  argument_list.extend(d['call_list'])
-  argument_list.extend(sys.argv[1:])
-  argument_list.append(env)
-  os.execle(executable_filepath, *argument_list)
diff --git a/slapos/recipe/erp5_test/__init__.py b/slapos/recipe/erp5_test/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..1aeea2c5c78044b9116786ac04d4aef1e70c63ca
--- /dev/null
+++ b/slapos/recipe/erp5_test/__init__.py
@@ -0,0 +1,74 @@
+##############################################################################
+#
+# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericBaseRecipe
+import urlparse
+
+class Recipe(GenericBaseRecipe):
+  def install(self):
+    testinstance = self.options['test-instance-path']
+    mysql_connection_string_list = []
+    path_list = []
+    # XXX: assume existence of 100 test databases, because slaves are not
+    # functional yet in slapos: testdb_0...testdb_100, with testuser_N
+    mysql_template = "%s@%s:%s %s %s"
+    mysql_parsed = urlparse.urlparse(self.options['mysql-url'])
+    for i in range(0, 100):
+      mysql_connection_string_list.append(mysql_template % ('testdb_%s'% i,
+        mysql_parsed.hostname, mysql_parsed.port, 'testuser_%s'% i, mysql_parsed.password))
+    mysql_connection_string = mysql_template % ('erp5_test', mysql_parsed.hostname,
+      mysql_parsed.port, 'erp5_test', mysql_parsed.password)
+    cloudooo_parsed = urlparse.urlparse(self.options['cloudooo-url'])
+    memcached_parsed = urlparse.urlparse(self.options['memcached-url'])
+    kumofs_parsed = urlparse.urlparse(self.options['kumofs-url'])
+    common_dict = dict(
+        instance_home=testinstance,
+        prepend_path=self.options['prepend-path'],
+        openssl_binary=self.options['openssl-binary'],
+        test_ca_path=self.options['certificate-authority-path'],
+    )
+    common_list = [
+      '--conversion_server_hostname=%s' % cloudooo_parsed.hostname,
+      '--conversion_server_port=%s' % cloudooo_parsed.port,
+      '--volatile_memcached_server_hostname=%s' % memcached_parsed.hostname,
+      '--volatile_memcached_server_port=%s' % memcached_parsed.port,
+      '--persistent_memcached_server_hostname=%s' % kumofs_parsed.hostname,
+      '--persistent_memcached_server_port=%s' % kumofs_parsed.port,
+    ]
+    path_list.append(self.createPythonScript(self.options['run-unit-test'],
+        __name__ + '.test.runUnitTest', [dict(
+        call_list=[self.options['run-unit-test-binary'],
+          '--erp5_sql_connection_string', mysql_connection_string,
+          '--extra_sql_connection_string_list', ','.join(
+            mysql_connection_string_list),
+          ] + common_list, **common_dict)]))
+    path_list.append(self.createPythonScript(self.options['run-test-suite'],
+        __name__ + '.test.runUnitTest', [dict(
+        call_list=[self.options['run-test-suite-binary'],
+          '--db_list', ','.join(mysql_connection_string_list),
+          ] + common_list, **common_dict)]))
+
+    return path_list
diff --git a/slapos/recipe/erp5_test/test.py b/slapos/recipe/erp5_test/test.py
new file mode 100644
index 0000000000000000000000000000000000000000..249c871c389ca6fd79ebb8fbf01fbc7a12b3c135
--- /dev/null
+++ b/slapos/recipe/erp5_test/test.py
@@ -0,0 +1,72 @@
+##############################################################################
+#
+# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+import os
+import sys
+def runTestSuite(args):
+  env = os.environ.copy()
+  d = args[0]
+  env['OPENSSL_BINARY'] = d['openssl_binary']
+  env['TEST_CA_PATH'] = d['test_ca_path']
+  env['PATH'] = ':'.join([d['prepend_path']] + os.environ['PATH'].split(':'))
+  env['INSTANCE_HOME'] = d['instance_home']
+  env['REAL_INSTANCE_HOME'] = d['instance_home']
+  # Deal with Shebang size limitation
+  executable_filepath = d['call_list'][0]
+  file_object = open(executable_filepath, 'r')
+  line = file_object.readline()
+  file_object.close()
+  argument_list = []
+  if line[:2] == '#!':
+    executable_filepath = line[2:].strip()
+    argument_list.append(executable_filepath)
+  argument_list.extend(d['call_list'])
+  argument_list.extend(sys.argv[1:])
+  argument_list.append(env)
+  os.execle(executable_filepath, *argument_list)
+
+def runUnitTest(args):
+  env = os.environ.copy()
+  d = args[0]
+  env['OPENSSL_BINARY'] = d['openssl_binary']
+  env['TEST_CA_PATH'] = d['test_ca_path']
+  env['PATH'] = ':'.join([d['prepend_path']] + os.environ.get('PATH', '').split(':'))
+  env['INSTANCE_HOME'] = d['instance_home']
+  env['REAL_INSTANCE_HOME'] = d['instance_home']
+  # Deal with Shebang size limitation
+  executable_filepath = d['call_list'][0]
+  file_object = open(executable_filepath, 'r')
+  line = file_object.readline()
+  file_object.close()
+  argument_list = []
+  if line[:2] == '#!':
+    executable_filepath = line[2:].strip()
+    argument_list.append(executable_filepath)
+  argument_list.extend(d['call_list'])
+  argument_list.extend(sys.argv[1:])
+  argument_list.append(env)
+  os.execle(executable_filepath, *argument_list)
+
diff --git a/slapos/recipe/erp5_update/__init__.py b/slapos/recipe/erp5_update/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..1f702b8904a0d1f51d1042493696f877f87a4183
--- /dev/null
+++ b/slapos/recipe/erp5_update/__init__.py
@@ -0,0 +1,73 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+import urlparse
+from slapos.recipe.librecipe import GenericSlapRecipe
+
+class Recipe(GenericSlapRecipe):
+  def _install(self):
+    conversion_server = None
+    if 'cloudooo-url' in self.options and self.options['cloudooo-url']:
+      parsed = urlparse.urlparse(self.options['cloudooo-url'])
+      conversion_server = "%s:%s" % (parsed.hostname, parsed.port)
+    memcached = None
+    if 'memcached-url' in self.options and self.options['memcached-url']:
+      parsed = urlparse.urlparse(self.options['memcached-url'])
+      memcached = "%s:%s" % (parsed.hostname, parsed.port)
+    kumofs = None
+    if 'kumofs-url' in self.options and self.options['kumofs-url']:
+      parsed = urlparse.urlparse(self.options['kumofs-url'])
+      kumofs = "%s:%s" % (parsed.hostname, parsed.port)
+
+    parsed = urlparse.urlparse(self.options['mysql-url'])
+    mysql_connection_string = "%(database)s@%(hostname)s:%(port)s "\
+        "%(username)s %(password)s" % dict(
+      database=parsed.path.split('/')[1],
+      hostname=parsed.hostname,
+      port=parsed.port,
+      username=parsed.username,
+      password=parsed.password
+    )
+
+    parsed = urlparse.urlparse(self.options['url'])
+    zope_user = parsed.username
+    zope_password = parsed.password
+    zope_host = '%s:%s' % (parsed.hostname, parsed.port)
+    bt5_list = []
+    if len(self.parameter_dict.get("bt5_list", "").strip()):
+      bt5_list = self.parameter_dict["bt5_list"].split()
+    elif self.parameter_dict.get("flavour", "default") == 'configurator':
+      bt5_list = self.options['configurator-bt5-list'].split()
+    bt5_repository_list = self.parameter_dict.get("bt5_repository_list",
+      "").split() or self.options['bt5-repository-list'].split()
+
+    script = self.createPythonScript(self.options['update-wrapper'],
+      __name__+'.erp5.updateERP5', [
+        self.options['site-id'], mysql_connection_string,
+        [zope_user, zope_password, zope_host],
+        memcached, conversion_server, kumofs, bt5_list, bt5_repository_list,
+        self.options['cadir-path'], self.options['openssl-binary']])
+    return [script]
diff --git a/slapos/recipe/erp5/erp5.py b/slapos/recipe/erp5_update/erp5.py
similarity index 96%
rename from slapos/recipe/erp5/erp5.py
rename to slapos/recipe/erp5_update/erp5.py
index c5cadbade50f191ca6927d6aac0dc06a199976f8..80e942191e504b8db01a0d4ce9b9f6686d2f2458 100644
--- a/slapos/recipe/erp5/erp5.py
+++ b/slapos/recipe/erp5_update/erp5.py
@@ -251,16 +251,6 @@ class ERP5Updater(object):
       return True
     return False
 
-  def isCertificateAuthorityConfigured(self):
-    """ Check if certificate Authority is configured correctly. """
-    external_connection_dict = self.system_signature_dict[
-      'external_connection_dict']
-    if self.certificate_authority_path == external_connection_dict.get(
-          'portal_certificate_authority/certificate_authority_path') and \
-       self.openssl_binary == external_connection_dict.get(
-          'portal_certificate_authority/openssl_binary'):
-      return True
-    return False
   def isCertificateAuthorityConfigured(self):
     """ Check if certificate Authority is configured correctly. """
     external_connection_dict = self.system_signature_dict[
@@ -303,6 +293,7 @@ class ERP5Updater(object):
 
   def updateERP5Site(self):
     if not self.isERP5Present():
+      self.log('INFO', 'No site present, adding new with id %r' % self.site_id)
       self.POST('/manage_addProduct/ERP5/manage_addERP5Site', {
           "id": self.site_id,
           "erp5_catalog_storage": self.erp5_catalog_storage,
@@ -330,6 +321,7 @@ class ERP5Updater(object):
   def run(self):
     """ Keep running until kill"""
     while 1:
+      self.log('INFO', 'Sleeping for %s' % self.short_sleeping_time)
       time.sleep(self.short_sleeping_time)
       if not self.updateERP5Site():
         self.loadSystemSignatureDict()
diff --git a/slapos/recipe/erp5testnode/SlapOSControler.py b/slapos/recipe/erp5testnode/SlapOSControler.py
deleted file mode 100644
index e9ed42f711874efb143e05787cf30f4cc6787eac..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5testnode/SlapOSControler.py
+++ /dev/null
@@ -1,94 +0,0 @@
-import slapos.slap, subprocess, os, time
-from xml_marshaller import xml_marshaller
-
-class SlapOSControler(object):
-
-  def __init__(self, config, process_group_pid_set=None):
-    self.config = config
-    # By erasing everything, we make sure that we are able to "update"
-    # existing profiles. This is quite dirty way to do updates...
-    if os.path.exists(config['proxy_database']):
-      os.unlink(config['proxy_database'])
-    proxy = subprocess.Popen([config['slapproxy_binary'],
-      config['slapos_config']], close_fds=True, preexec_fn=os.setsid)
-    process_group_pid_set.add(proxy.pid)
-    # XXX: dirty, giving some time for proxy to being able to accept
-    # connections
-    time.sleep(10)
-    slap = slapos.slap.slap()
-    slap.initializeConnection(config['master_url'])
-    # register software profile
-    self.software_profile = config['custom_profile_path']
-    slap.registerSupply().supply(
-        self.software_profile,
-        computer_guid=config['computer_id'])
-    computer = slap.registerComputer(config['computer_id'])
-    # create partition and configure computer
-    partition_reference = config['partition_reference']
-    partition_path = os.path.join(config['instance_root'], partition_reference)
-    if not os.path.exists(partition_path):
-      os.mkdir(partition_path)
-      os.chmod(partition_path, 0750)
-    computer.updateConfiguration(xml_marshaller.dumps({
- 'address': config['ipv4_address'],
- 'instance_root': config['instance_root'],
- 'netmask': '255.255.255.255',
- 'partition_list': [{'address_list': [{'addr': config['ipv4_address'],
-                                       'netmask': '255.255.255.255'},
-                                      {'addr': config['ipv6_address'],
-                                       'netmask': 'ffff:ffff:ffff::'},
-                      ],
-                     'path': partition_path,
-                     'reference': partition_reference,
-                     'tap': {'name': partition_reference},
-                     }
-                    ],
- 'reference': config['computer_id'],
- 'software_root': config['software_root']}))
-
-  def runSoftwareRelease(self, config, environment, process_group_pid_set=None,
-                         stdout=None, stderr=None):
-    print "SlapOSControler.runSoftwareRelease"
-    cpu_count = os.sysconf("SC_NPROCESSORS_ONLN")
-    os.putenv('MAKEFLAGS', '-j%s' % cpu_count)
-    os.environ['PATH'] = environment['PATH']
-    slapgrid = subprocess.Popen([config['slapgrid_software_binary'], '-v', '-c',
-      #'--buildout-parameter',"'-U -N' -o",
-      config['slapos_config']],
-      stdout=stdout, stderr=stderr,
-      close_fds=True, preexec_fn=os.setsid)
-    process_group_pid_set.add(slapgrid.pid)
-    slapgrid.wait()
-    stdout.seek(0)
-    stderr.seek(0)
-    process_group_pid_set.remove(slapgrid.pid)
-    status_dict = {'status_code':slapgrid.returncode,
-                    'stdout':stdout.read(),
-                    'stderr':stderr.read()}
-    stdout.close()
-    stderr.close()
-    return status_dict
-
-  def runComputerPartition(self, config, environment,
-                           process_group_pid_set=None,
-                           stdout=None, stderr=None):
-    print "SlapOSControler.runSoftwareRelease"
-    slap = slapos.slap.slap()
-    slap.registerOpenOrder().request(self.software_profile,
-        partition_reference='testing partition',
-        partition_parameter_kw=config['instance_dict'])
-    slapgrid = subprocess.Popen([config['slapgrid_partition_binary'],
-      config['slapos_config'], '-c', '-v'],
-      stdout=stdout, stderr=stderr,
-      close_fds=True, preexec_fn=os.setsid)
-    process_group_pid_set.add(slapgrid.pid)
-    slapgrid.wait()
-    stdout.seek(0)
-    stderr.seek(0)
-    process_group_pid_set.remove(slapgrid.pid)
-    status_dict = {'status_code':slapgrid.returncode,
-                    'stdout':stdout.read(),
-                    'stderr':stderr.read()}
-    stdout.close()
-    stderr.close()
-    return status_dict
diff --git a/slapos/recipe/erp5testnode/Updater.py b/slapos/recipe/erp5testnode/Updater.py
deleted file mode 100644
index 83ea60a1e7738bdd55316ce4bb7c5937f838203c..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5testnode/Updater.py
+++ /dev/null
@@ -1,189 +0,0 @@
-import os, sys, subprocess, re, threading
-from testnode import SubprocessError
-
-_format_command_search = re.compile("[[\\s $({?*\\`#~';<>&|]").search
-_format_command_escape = lambda s: "'%s'" % r"'\''".join(s.split("'"))
-def format_command(*args, **kw):
-  cmdline = []
-  for k, v in sorted(kw.items()):
-    if _format_command_search(v):
-      v = _format_command_escape(v)
-    cmdline.append('%s=%s' % (k, v))
-  for v in args:
-    if _format_command_search(v):
-      v = _format_command_escape(v)
-    cmdline.append(v)
-  return ' '.join(cmdline)
-
-def subprocess_capture(p, quiet=False):
-  def readerthread(input, output, buffer):
-    while True:
-      data = input.readline()
-      if not data:
-        break
-      output(data)
-      buffer.append(data)
-  if p.stdout:
-    stdout = []
-    output = quiet and (lambda data: None) or sys.stdout.write
-    stdout_thread = threading.Thread(target=readerthread,
-                                     args=(p.stdout, output, stdout))
-    stdout_thread.setDaemon(True)
-    stdout_thread.start()
-  if p.stderr:
-    stderr = []
-    stderr_thread = threading.Thread(target=readerthread,
-                                     args=(p.stderr, sys.stderr.write, stderr))
-    stderr_thread.setDaemon(True)
-    stderr_thread.start()
-  if p.stdout:
-    stdout_thread.join()
-  if p.stderr:
-    stderr_thread.join()
-  p.wait()
-  return (p.stdout and ''.join(stdout),
-          p.stderr and ''.join(stderr))
-
-GIT_TYPE = 'git'
-SVN_TYPE = 'svn'
-
-class Updater(object):
-
-  _git_cache = {}
-  realtime_output = True
-  stdin = file(os.devnull)
-
-  def __init__(self, repository_path, revision=None, git_binary=None):
-    self.revision = revision
-    self._path_list = []
-    self.repository_path = repository_path
-    self.git_binary = git_binary
-
-  def getRepositoryPath(self):
-    return self.repository_path
-
-  def getRepositoryType(self):
-    try:
-      return self.repository_type
-    except AttributeError:
-      # guess the type of repository we have
-      if os.path.isdir(os.path.join(
-                       self.getRepositoryPath(), '.git')):
-        repository_type = GIT_TYPE
-      elif os.path.isdir(os.path.join(
-                       self.getRepositoryPath(), '.svn')):
-        repository_type = SVN_TYPE
-      else:
-        raise NotImplementedError
-      self.repository_type = repository_type
-      return repository_type
-
-  def deletePycFiles(self, path):
-    """Delete *.pyc files so that deleted/moved files can not be imported"""
-    for path, dir_list, file_list in os.walk(path):
-      for file in file_list:
-        if file[-4:] in ('.pyc', '.pyo'):
-          # allow several processes clean the same folder at the same time
-          try:
-            os.remove(os.path.join(path, file))
-          except OSError, e:
-            if e.errno != errno.ENOENT:
-              raise
-
-  def spawn(self, *args, **kw):
-    quiet = kw.pop('quiet', False)
-    env = kw and dict(os.environ, **kw) or None
-    command = format_command(*args, **kw)
-    print '\n$ ' + command
-    sys.stdout.flush()
-    p = subprocess.Popen(args, stdin=self.stdin, stdout=subprocess.PIPE,
-                         stderr=subprocess.PIPE, env=env,
-                         cwd=self.getRepositoryPath())
-    if self.realtime_output:
-      stdout, stderr = subprocess_capture(p, quiet)
-    else:
-      stdout, stderr = p.communicate()
-      if not quiet:
-        sys.stdout.write(stdout)
-      sys.stderr.write(stderr)
-    result = dict(status_code=p.returncode, command=command,
-                  stdout=stdout, stderr=stderr)
-    if p.returncode:
-      raise SubprocessError(result)
-    return result
-
-  def _git(self, *args, **kw):
-    return self.spawn(self.git_binary, *args, **kw)['stdout'].strip()
-
-  def _git_find_rev(self, ref):
-    try:
-      return self._git_cache[ref]
-    except KeyError:
-      if os.path.exists('.git/svn'):
-        r = self._git('svn', 'find-rev', ref)
-        assert r
-        self._git_cache[ref[0] != 'r' and 'r%u' % int(r) or r] = ref
-      else:
-        r = self._git('rev-list', '--topo-order', '--count', ref), ref
-      self._git_cache[ref] = r
-      return r
-
-  def getRevision(self, *path_list):
-    if not path_list:
-      path_list = self._path_list
-    if self.getRepositoryType() == GIT_TYPE:
-      h = self._git('log', '-1', '--format=%H', '--', *path_list)
-      return self._git_find_rev(h)
-    elif self.getRepositoryType() == SVN_TYPE:
-      stdout = self.spawn('svn', 'info', *path_list)['stdout']
-      return str(max(map(int, SVN_CHANGED_REV.findall(stdout))))
-    raise NotImplementedError
-
-  def checkout(self, *path_list):
-    if not path_list:
-      path_list = '.',
-    revision = self.revision
-    if self.getRepositoryType() == GIT_TYPE:
-      # edit .git/info/sparse-checkout if you want sparse checkout
-      if revision:
-        if type(revision) is str:
-          h = revision
-        else:
-          h = revision[1]
-        if h != self._git('rev-parse', 'HEAD'):
-          self.deletePycFiles('.')
-          self._git('reset', '--merge', h)
-      else:
-        self.deletePycFiles('.')
-        if os.path.exists('.git/svn'):
-          self._git('svn', 'rebase')
-        else:
-          self._git('pull', '--ff-only')
-        self.revision = self._git_find_rev(self._git('rev-parse', 'HEAD'))
-    elif self.getRepositoryType() == SVN_TYPE:
-      # following code allows sparse checkout
-      def svn_mkdirs(path):
-        path = os.path.dirname(path)
-        if path and not os.path.isdir(path):
-          svn_mkdirs(path)
-          self.spawn(*(args + ['--depth=empty', path]))
-      for path in path_list:
-        args = ['svn', 'up', '--force', '--non-interactive']
-        if revision:
-          args.append('-r%s' % revision)
-        svn_mkdirs(path)
-        args += '--set-depth=infinity', path
-        self.deletePycFiles(path)
-        try:
-          status_dict = self.spawn(*args)
-        except SubprocessError, e:
-          if 'cleanup' not in e.stderr:
-            raise
-          self.spawn('svn', 'cleanup', path)
-          status_dict = self.spawn(*args)
-        if not revision:
-          self.revision = revision = SVN_UP_REV.findall(
-            status_dict['stdout'].splitlines()[-1])[0]
-    else:
-      raise NotImplementedError
-    self._path_list += path_list
diff --git a/slapos/recipe/erp5testnode/__init__.py b/slapos/recipe/erp5testnode/__init__.py
index cd8f0f53b69913c533cfb7b276a8fe0c50a923aa..af7177dc2b0ef95e2c56373f4c37a9aa10182f97 100644
--- a/slapos/recipe/erp5testnode/__init__.py
+++ b/slapos/recipe/erp5testnode/__init__.py
@@ -31,129 +31,79 @@ import zc.buildout
 import zc.recipe.egg
 import sys
 
-CONFIG = dict(
-  proxy_port='5000',
-  computer_id='COMPUTER',
-  partition_reference='test0',
-)
-
 class Recipe(BaseSlapRecipe):
   def __init__(self, buildout, name, options):
     self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options)
     BaseSlapRecipe.__init__(self, buildout, name, options)
 
-  def installSlapOs(self):
+  def _install(self):
+    self.requirements, self.ws = self.egg.working_set()
+    path_list = []
+    CONFIG = dict()
     CONFIG['slapos_directory'] = self.createDataDirectory('slapos')
     CONFIG['working_directory'] = self.createDataDirectory('testnode')
-    CONFIG['software_root'] = os.path.join(CONFIG['slapos_directory'],
-        'software')
-    CONFIG['instance_root'] = os.path.join(CONFIG['slapos_directory'],
-        'instance')
-    CONFIG['proxy_database'] = os.path.join(CONFIG['slapos_directory'],
-        'proxy.db')
+    CONFIG['test_suite_directory'] = self.createDataDirectory('test_suite')
     CONFIG['proxy_host'] = self.getLocalIPv4Address()
-    CONFIG['master_url'] = 'http://%s:%s' % (CONFIG['proxy_host'],
-        CONFIG['proxy_port'])
-    self._createDirectory(CONFIG['software_root'])
-    self._createDirectory(CONFIG['instance_root'])
-    CONFIG['slapos_config'] = self.createConfigurationFile('slapos.cfg',
-        self.substituteTemplate(pkg_resources.resource_filename(__name__,
-          'template/slapos.cfg.in'), CONFIG))
-    self.path_list.append(CONFIG['slapos_config'])
-
-  def setupRunningWrapper(self):
-    self.path_list.extend(zc.buildout.easy_install.scripts([(
-      'testnode',
-        __name__+'.testnode', 'run')], self.ws,
-          sys.executable, self.wrapper_directory, arguments=[
-            dict(
-              computer_id=CONFIG['computer_id'],
-              instance_dict=eval(self.parameter_dict.get('instance_dict', '{}')),
-              instance_root=CONFIG['instance_root'],
-              ipv4_address=self.getLocalIPv4Address(),
-              ipv6_address=self.getGlobalIPv6Address(),
-              master_url=CONFIG['master_url'],
-              profile_path=self.parameter_dict['profile_path'],
-              proxy_database=CONFIG['proxy_database'],
-              proxy_port=CONFIG['proxy_port'],
-              slapgrid_partition_binary=self.options['slapgrid_partition_binary'],
-              slapgrid_software_binary=self.options['slapgrid_software_binary'],
-              slapos_config=CONFIG['slapos_config'],
-              slapproxy_binary=self.options['slapproxy_binary'],
-              git_binary=self.options['git_binary'],
-              software_root=CONFIG['software_root'],
-              working_directory=CONFIG['working_directory'],
-              vcs_repository_list=eval(self.parameter_dict.get('vcs_repository_list'),),
-              node_quantity=self.parameter_dict.get('node_quantity', '1'),
-              test_suite_master_url=self.parameter_dict.get(
-                                'test_suite_master_url', None),
-              test_suite=self.parameter_dict.get('test_suite'),
-              test_suite_title=self.parameter_dict.get('test_suite_title'),
-              test_node_title=self.parameter_dict.get('test_node_title'),
-              project_title=self.parameter_dict.get('project_title'),
-              bin_directory=self.bin_directory,
-              # botenvironemnt is splittable string of key=value to substitute
-              # environment of running bot
-              bot_environment=self.parameter_dict.get('bot_environment', ''),
-              partition_reference=CONFIG['partition_reference'],
-              environment=dict(PATH=os.environ['PATH']),
-              vcs_authentication_list=eval(self.parameter_dict.get(
-                     'vcs_authentication_list', 'None')),
-            )
-          ]))
-
-  def installLocalGit(self):
-    git_dict = dict(git_binary = self.options['git_binary'])
-    git_dict.update(self.parameter_dict)
-    double_slash_end_position = 1
-    # XXX, this should be provided by slapos
-    print "bin_directory : %r" % self.bin_directory
-    home_directory = os.path.join(*os.path.split(self.bin_directory)[0:-1])
-    print "home_directory : %r" % home_directory
-    git_dict.setdefault("git_server_name", "git.erp5.org")
-    if git_dict.get('vcs_authentication_list', None) is not None:
-      vcs_authentication_list = eval(git_dict['vcs_authentication_list'])
-      netrc_file = open(os.path.join(home_directory, '.netrc'), 'w')
-      for vcs_authentication_dict in vcs_authentication_list:
-        netrc_file.write("""
-machine %(host)s
-login %(user_name)s
-password %(password)s
-""" % vcs_authentication_dict)
-      netrc_file.close()
+    CONFIG['proxy_port'] = '5000'
+    CONFIG['log_directory'] = self.createDataDirectory('testnodelog')
+    CONFIG['run_directory'] = self.createDataDirectory('testnoderun')
+    CONFIG['test_suite_title'] = self.parameter_dict.get('test_suite_title')
+    CONFIG['test_node_title'] = self.parameter_dict.get('test_node_title')
+    CONFIG['test_suite'] = self.parameter_dict.get('test_suite')
+    CONFIG['node_quantity'] = self.parameter_dict.get('node_quantity', '1')
+    CONFIG['project_title'] = self.parameter_dict.get('project_title')
+    CONFIG['ipv4_address'] = self.getLocalIPv4Address()
+    CONFIG['ipv6_address'] = self.getGlobalIPv6Address()
+    CONFIG['test_suite_master_url'] = self.parameter_dict.get(
+                                'test_suite_master_url', None)
+    CONFIG['git_binary'] = self.options['git_binary']
+    CONFIG['slapgrid_partition_binary'] = self.options[
+      'slapgrid_partition_binary']
+    CONFIG['slapgrid_software_binary'] = self.options[
+      'slapgrid_software_binary']
+    CONFIG['slapproxy_binary'] = self.options['slapproxy_binary']
+    CONFIG['zip_binary'] = self.options['zip_binary']
+    CONFIG['PATH'] = os.environ['PATH']
+    additional_bt5_repository_id = \
+        self.parameter_dict.get('additional_bt5_repository_id')
 
-  def installLocalRepository(self):
-    self.installLocalGit()
+    CONFIG['bt5_path'] = None
+    if additional_bt5_repository_id is not None:
+      CONFIG['bt5_path'] = ""
+      additional_bt5_repository_id_list = additional_bt5_repository_id.split(",")
+      for id in additional_bt5_repository_id_list:
+        id_path = os.path.join(CONFIG['slapos_directory'], id)
+        bt_path = os.path.join(id_path, "bt5")
+        CONFIG['bt5_path'] += "%s,%s," % (id_path, bt_path)
+    CONFIG['instance_dict'] = ''
+    if 'instance_dict' in self.parameter_dict:
+      CONFIG['instance_dict'] = '[instance_dict]\n'
+      for k,v in eval(self.parameter_dict['instance_dict']).iteritems():
+        CONFIG['instance_dict'] += '%s = %s\n' % (k,v)
 
-  def installLocalZip(self):
-    zip = os.path.join(self.bin_directory, 'zip')
-    if os.path.lexists(zip):
-      os.unlink(zip)
-    os.symlink(self.options['zip_binary'], zip)
-
-  def installLocalPython(self):
-    """Installs local python fully featured with eggs"""
-    self.path_list.extend(zc.buildout.easy_install.scripts([], self.ws,
-          sys.executable, self.bin_directory, scripts=None,
-          interpreter='python'))
-
-  def installLocalRunUnitTest(self):
-    link = os.path.join(self.bin_directory, 'runUnitTest')
-    destination = os.path.join(CONFIG['instance_root'],
-        CONFIG['partition_reference'], 'bin', 'runUnitTest')
-    if os.path.lexists(link):
-      if not os.readlink(link) != destination:
-        os.unlink(link)
-    if not os.path.lexists(link):
-      os.symlink(destination, link)
-
-  def _install(self):
-    self.requirements, self.ws = self.egg.working_set()
-    self.path_list = []
-    self.installSlapOs()
-    self.setupRunningWrapper()
-    self.installLocalRepository()
-    self.installLocalZip()
-    self.installLocalPython()
-    self.installLocalRunUnitTest()
-    return self.path_list
+    CONFIG['repository_list'] = ''
+    i = 0
+    for repository in eval(self.parameter_dict['vcs_repository_list']):
+      CONFIG['repository_list'] += '[vcs_repository_%s]\n' % i
+      CONFIG['repository_list'] += 'url = %s\n' % repository['url']
+      if 'branch' in repository:
+        CONFIG['repository_list'] += 'branch = %s\n' % repository['branch']
+      if 'profile_path' in repository:
+        CONFIG['repository_list'] += 'profile_path = %s\n' % repository[
+          'profile_path']
+      if 'buildout_section_id' in repository:
+        CONFIG['repository_list'] += 'buildout_section_id = %s\n' % repository[
+          'buildout_section_id']
+      CONFIG['repository_list'] += '\n'
+      i += 1
+    testnode_config = self.createConfigurationFile('erp5testnode.cfg',
+        self.substituteTemplate(pkg_resources.resource_filename(__name__,
+          'template/erp5testnode.cfg.in'), CONFIG))
+    testnode_log = os.path.join(self.log_directory, 'erp5testnode.log')
+    wrapper = zc.buildout.easy_install.scripts([('erp5testnode',
+     'slapos.recipe.librecipe.execute', 'executee')], self.ws, sys.executable,
+      self.wrapper_directory, arguments=[[self.options['testnode'], '-l',
+      testnode_log, testnode_config], {'GIT_SSL_NO_VERIFY': '1'}])[0]
+    path_list.append(testnode_config)
+    path_list.append(wrapper)
+    return path_list
diff --git a/slapos/recipe/erp5testnode/template/erp5testnode.cfg.in b/slapos/recipe/erp5testnode/template/erp5testnode.cfg.in
new file mode 100644
index 0000000000000000000000000000000000000000..08c4619a211392c6e48094b9b0f333e4ceaa9bb6
--- /dev/null
+++ b/slapos/recipe/erp5testnode/template/erp5testnode.cfg.in
@@ -0,0 +1,31 @@
+[testnode]
+slapos_directory = %(slapos_directory)s
+working_directory = %(slapos_directory)s
+test_suite_directory = %(test_suite_directory)s
+log_directory = %(log_directory)s
+run_directory = %(run_directory)s
+proxy_host = %(proxy_host)s
+proxy_port = %(proxy_port)s
+test_suite_title = %(test_suite_title)s
+test_suite = %(test_suite)s
+node_quantity = %(node_quantity)s
+test_node_title = %(test_node_title)s
+project_title= %(project_title)s
+ipv4_address = %(ipv4_address)s
+ipv6_address = %(ipv6_address)s
+test_suite_master_url = %(test_suite_master_url)s
+bt5_path = %(bt5_path)s
+
+# Binaries
+git_binary = %(git_binary)s
+slapgrid_partition_binary = %(slapgrid_partition_binary)s
+slapgrid_software_binary = %(slapgrid_software_binary)s
+slapproxy_binary = %(slapproxy_binary)s
+zip_binary = %(zip_binary)s
+
+[environment]
+PATH = %(PATH)s
+
+%(instance_dict)s
+
+%(repository_list)s
diff --git a/slapos/recipe/erp5testnode/template/slapos.cfg.in b/slapos/recipe/erp5testnode/template/slapos.cfg.in
deleted file mode 100644
index 713f719a322502bca230db83a0c2aa4c6678607c..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5testnode/template/slapos.cfg.in
+++ /dev/null
@@ -1,10 +0,0 @@
-[slapos]
-software_root = %(software_root)s
-instance_root = %(instance_root)s
-master_url = %(master_url)s
-computer_id = %(computer_id)s
-
-[slapproxy]
-host = %(proxy_host)s
-port = %(proxy_port)s
-database_uri = %(proxy_database)s
diff --git a/slapos/recipe/erp5testnode/testnode.py b/slapos/recipe/erp5testnode/testnode.py
deleted file mode 100644
index f090a3a8668fcc91f4a1012dcac5593156a0334b..0000000000000000000000000000000000000000
--- a/slapos/recipe/erp5testnode/testnode.py
+++ /dev/null
@@ -1,245 +0,0 @@
-from xml_marshaller import xml_marshaller
-import os, xmlrpclib, time, imp
-from glob import glob
-import signal
-import slapos.slap
-import subprocess
-import sys
-import socket
-import pprint
-from SlapOSControler import SlapOSControler
-
-
-class SubprocessError(EnvironmentError):
-  def __init__(self, status_dict):
-    self.status_dict = status_dict
-  def __getattr__(self, name):
-    return self.status_dict[name]
-  def __str__(self):
-    return 'Error %i' % self.status_code
-
-
-from Updater import Updater
-
-process_group_pid_set = set()
-process_pid_file_list = []
-process_command_list = []
-def sigterm_handler(signal, frame):
-  for pgpid in process_group_pid_set:
-    try:
-      os.killpg(pgpid, signal.SIGTERM)
-    except:
-      pass
-  for pid_file in process_pid_file_list:
-    try:
-      os.kill(int(open(pid_file).read().strip()), signal.SIGTERM)
-    except:
-      pass
-  for p in process_command_list:
-    try:
-      subprocess.call(p)
-    except:
-      pass
-  sys.exit(1)
-
-signal.signal(signal.SIGTERM, sigterm_handler)
-
-def safeRpcCall(function, *args):
-  retry = 64
-  while True:
-    try:
-      return function(*args)
-    except (socket.error, xmlrpclib.ProtocolError), e:
-      print >>sys.stderr, e
-      pprint.pprint(args, file(function._Method__name, 'w'))
-      time.sleep(retry)
-      retry += retry >> 1
-
-def getInputOutputFileList(config, command_name):
-  stdout = open(os.path.join(
-                config['instance_root'],'.%s_out' % command_name),
-                'w+')
-  stdout.write("%s\n" % command_name)
-  stderr = open(os.path.join(
-                config['instance_root'],'.%s_err' % command_name),
-                'w+')
-  return (stdout, stderr)
-
-slapos_controler = None
-
-def run(args):
-  config = args[0]
-  slapgrid = None
-  supervisord_pid_file = os.path.join(config['instance_root'], 'var', 'run',
-        'supervisord.pid')
-  subprocess.check_call([config['git_binary'],
-                "config", "--global", "http.sslVerify", "false"])
-  previous_revision = None
-
-  run_software = True
-  # Write our own software.cfg to use the local repository
-  custom_profile_path = os.path.join(config['working_directory'], 'software.cfg')
-  config['custom_profile_path'] = custom_profile_path
-  vcs_repository_list = config['vcs_repository_list']
-  profile_content = None
-  assert len(vcs_repository_list), "we must have at least one repository"
-  for vcs_repository in vcs_repository_list:
-    url = vcs_repository['url']
-    buildout_section_id = vcs_repository.get('buildout_section_id', None)
-    repository_id = buildout_section_id or \
-                                  url.split('/')[-1].split('.')[0]
-    repository_path = os.path.join(config['working_directory'],repository_id)
-    vcs_repository['repository_id'] = repository_id
-    vcs_repository['repository_path'] = repository_path
-    if profile_content is None:
-      profile_content = """
-[buildout]
-extends = %(software_config_path)s
-""" %  {'software_config_path': os.path.join(repository_path,
-                                          config['profile_path'])}
-    if not(buildout_section_id is None):
-      profile_content += """
-[%(buildout_section_id)s]
-repository = %(repository_path)s
-branch = %(branch)s
-""" %  {'buildout_section_id': buildout_section_id,
-        'repository_path' : repository_path,
-        'branch' : vcs_repository.get('branch','master')}
-
-  custom_profile = open(custom_profile_path, 'w')
-  custom_profile.write(profile_content)
-  custom_profile.close()
-  config['repository_path'] = repository_path
-  sys.path.append(repository_path)
-  test_suite_title = config['test_suite_title'] or config['test_suite']
-
-  retry_software = False
-  try:
-    while True:
-      # kill processes from previous loop if any
-      try:
-        for pgpid in process_group_pid_set:
-          try:
-            os.killpg(pgpid, signal.SIGTERM)
-          except:
-            pass
-        process_group_pid_set.clear()
-        full_revision_list = []
-        # Make sure we have local repository
-        for vcs_repository in vcs_repository_list:
-          repository_path = vcs_repository['repository_path']
-          repository_id = vcs_repository['repository_id']
-          if not os.path.exists(repository_path):
-            parameter_list = [config['git_binary'], 'clone',
-                              vcs_repository['url']]
-            if vcs_repository.get('branch') is not None:
-              parameter_list.extend(['-b',vcs_repository.get('branch')])
-            parameter_list.append(repository_path)
-            subprocess.check_call(parameter_list)
-          # Make sure we have local repository
-          updater = Updater(repository_path, git_binary=config['git_binary'])
-          updater.checkout()
-          revision = "-".join(updater.getRevision())
-          full_revision_list.append('%s=%s' % (repository_id, revision))
-        revision = ','.join(full_revision_list)
-        if previous_revision == revision:
-          time.sleep(120)
-          if not(retry_software):
-            continue
-        retry_software = False
-        previous_revision = revision
-
-        print config
-        portal_url = config['test_suite_master_url']
-        test_result_path = None
-        test_result = (test_result_path, revision)
-        if portal_url:
-          if portal_url[-1] != '/':
-            portal_url += '/'
-          portal = xmlrpclib.ServerProxy("%s%s" %
-                      (portal_url, 'portal_task_distribution'),
-                      allow_none=1)
-          master = portal.portal_task_distribution
-          assert master.getProtocolRevision() == 1
-          test_result = safeRpcCall(master.createTestResult,
-            config['test_suite'], revision, [],
-            False, test_suite_title,
-            config['test_node_title'], config['project_title'])
-        print "testnode, test_result : %r" % (test_result,)
-        if test_result:
-          test_result_path, test_revision = test_result
-          if revision != test_revision:
-            for i, repository_revision in enumerate(test_revision.split(',')):
-              vcs_repository = vcs_repository_list[i]
-              repository_path = vcs_repository['repository_path']
-              # other testnodes on other boxes are already ready to test another
-              # revision
-              updater = Updater(repository_path, git_binary=config['git_binary'],
-                                revision=repository_revision.split('-')[1])
-              updater.checkout()
-
-          # Now prepare the installation of SlapOS and create instance
-          slapos_controler = SlapOSControler(config,
-            process_group_pid_set=process_group_pid_set)
-          for method_name in ("runSoftwareRelease", "runComputerPartition"):
-            stdout, stderr = getInputOutputFileList(config, method_name)
-            slapos_method = getattr(slapos_controler, method_name)
-            status_dict = slapos_method(config,
-              environment=config['environment'],
-              process_group_pid_set=process_group_pid_set,
-              stdout=stdout, stderr=stderr
-              )
-            if status_dict['status_code'] != 0:
-              break
-          if status_dict['status_code'] != 0:
-            safeRpcCall(master.reportTaskFailure,
-              test_result_path, status_dict, config['test_node_title'])
-            retry_software = True
-            continue
-
-          partition_path = os.path.join(config['instance_root'],
-                                        config['partition_reference'])
-          run_test_suite_path = os.path.join(partition_path, 'bin',
-                                            'runTestSuite')
-          if not os.path.exists(run_test_suite_path):
-            raise ValueError('No %r provided' % run_test_suite_path)
-
-          run_test_suite_revision = revision
-          if isinstance(revision, tuple):
-            revision = ','.join(revision)
-          # Deal with Shebang size limitation
-          file_object = open(run_test_suite_path, 'r')
-          line = file_object.readline()
-          file_object.close()
-          invocation_list = []
-          if line[:2] == '#!':
-            invocation_list = line[2:].split()
-          invocation_list.extend([run_test_suite_path,
-                                  '--test_suite', config['test_suite'],
-                                  '--revision', revision,
-                                  '--test_suite_title', test_suite_title,
-                                  '--node_quantity', config['node_quantity'],
-                                  '--master_url', config['test_suite_master_url']])
-          run_test_suite = subprocess.Popen(invocation_list)
-          process_group_pid_set.add(run_test_suite.pid)
-          run_test_suite.wait()
-          process_group_pid_set.remove(run_test_suite.pid)
-      except SubprocessError:
-        time.sleep(120)
-        continue
-
-  finally:
-    # Nice way to kill *everything* generated by run process -- process
-    # groups working only in POSIX compilant systems
-    # Exceptions are swallowed during cleanup phase
-    print "going to kill %r" % (process_group_pid_set,)
-    for pgpid in process_group_pid_set:
-      try:
-        os.killpg(pgpid, signal.SIGTERM)
-      except:
-        pass
-    try:
-      if os.path.exists(supervisord_pid_file):
-        os.kill(int(open(supervisord_pid_file).read().strip()), signal.SIGTERM)
-    except:
-      pass
\ No newline at end of file
diff --git a/slapos/recipe/fontconfig/__init__.py b/slapos/recipe/fontconfig/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..c60e42b5aa6a608ccba654d7d49bbd98f2e4c3ea
--- /dev/null
+++ b/slapos/recipe/fontconfig/__init__.py
@@ -0,0 +1,85 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericBaseRecipe
+import pkg_resources
+import os
+import zc.buildout
+
+class Recipe(GenericBaseRecipe):
+  """
+  fontconfig instance configuration.
+
+  conf-path -- location of the configuration file
+
+  font-system-folder -- fonts installed by software release
+
+  font-folder -- location where to download fonts
+
+  url-list -- From where to download fonts
+  """
+
+  def install(self):
+    created_file_list = []
+    font_folder = self.options['font-folder']
+    service_folder = self.options['service-folder']
+    snippet_filename = self.getTemplateFilename(
+                                    'fontconfig-snippet.cfg.in')
+    font_snippet_list = [self.substituteTemplate(snippet_filename,
+                    dict(font_folder_path=self.options['font-system-folder']))]
+    font_snippet_list.append(self.substituteTemplate(snippet_filename,
+                                           dict(font_folder_path=font_folder)))
+
+    config = dict(
+        font_folder_path_snippet=''.join(font_snippet_list),
+        )
+    template_filename = self.getTemplateFilename('fontconfig.cfg.in')
+    configuration_path = self.createFile(
+        self.options['conf-path'],
+        self.substituteTemplate(template_filename, config))
+
+    created_file_list.append(configuration_path)
+    # Instanciate onetimedownloads, one for each url
+    wrapper_template_location = pkg_resources.resource_filename(
+                                        __name__, os.path.join(
+                                        'template', 'onetimedownload_run.in'))
+
+    onetimedownload_config = {}
+    onetimedownload_config.update(self.options)
+    for index, url in enumerate(self.options['url-list'].split()):
+      if not url.strip():
+        continue
+      bin_path = os.path.join(service_folder, 'onetimedownload%s' % index)
+      file_path = os.path.join(font_folder, '%s' % index)
+      onetimedownload_config['url'] = url
+      onetimedownload_config['file_path'] = file_path
+      onetimedownload_runner_path = self.createExecutable(bin_path,
+          self.substituteTemplate(wrapper_template_location, 
+                                  onetimedownload_config))
+
+      created_file_list.append(onetimedownload_runner_path)
+
+    return created_file_list
diff --git a/slapos/recipe/fontconfig/template/fontconfig-snippet.cfg.in b/slapos/recipe/fontconfig/template/fontconfig-snippet.cfg.in
new file mode 100644
index 0000000000000000000000000000000000000000..adfb6a2a47d101f79064f120a8b9b041dfdfd700
--- /dev/null
+++ b/slapos/recipe/fontconfig/template/fontconfig-snippet.cfg.in
@@ -0,0 +1 @@
+<dir>%(font_folder_path)s</dir>
diff --git a/slapos/recipe/fontconfig/template/fontconfig.cfg.in b/slapos/recipe/fontconfig/template/fontconfig.cfg.in
new file mode 100644
index 0000000000000000000000000000000000000000..c6799d21dc15414354306d605ec3f9abd4fc8f4a
--- /dev/null
+++ b/slapos/recipe/fontconfig/template/fontconfig.cfg.in
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+%(font_folder_path_snippet)s
+</fontconfig>
\ No newline at end of file
diff --git a/slapos/recipe/fontconfig/template/onetimedownload_run.in b/slapos/recipe/fontconfig/template/onetimedownload_run.in
new file mode 100644
index 0000000000000000000000000000000000000000..0060b06c0b056b8e4a7ba4ff85ee7b76c40f482c
--- /dev/null
+++ b/slapos/recipe/fontconfig/template/onetimedownload_run.in
@@ -0,0 +1,4 @@
+#!/bin/sh
+# BEWARE: This file is operated by slapgrid
+# BEWARE: It will be overwritten automatically
+exec %(onetimedownload_path)s "%(url)s" "%(file_path)s"
diff --git a/slapos/recipe/generate_cloudooo.py b/slapos/recipe/generate_cloudooo.py
new file mode 100644
index 0000000000000000000000000000000000000000..0a119a796df8790d63bc724222e9f7b34fd748ed
--- /dev/null
+++ b/slapos/recipe/generate_cloudooo.py
@@ -0,0 +1,60 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericSlapRecipe
+import os
+import json
+import traceback
+
+
+class Recipe(GenericSlapRecipe):
+  def _options(self, options):
+    self.dirname = os.path.join(self.buildout['buildout']['parts-directory'],
+                                self.name)
+    options['output'] = os.path.join(self.dirname, self.name + '.cfg')
+
+  def _generateRealTemplate(self):
+    # TODO check json against schema
+    json_data = {}
+    if self.parameter_dict.get('cloudooo-json', None):
+      json_data = json.loads(self.parameter_dict['cloudooo-json'])
+    # dymanic fonts
+    font_url_list = json_data.get('font_url_list', [])
+    fontconfig_template = open(self.options['template']).read()
+    fontconfig = open(self.options['snippet-fontconfig']).read()
+    fontconfig_extension = fontconfig % dict(font_url_list=' '.join(font_url_list))
+    with open(self.options['output'], 'w') as f:
+      f.write(fontconfig_template + fontconfig_extension)
+
+  def _install(self):
+    if not os.path.exists(self.dirname):
+      os.mkdir(self.dirname)
+    try:
+      self._generateRealTemplate()
+    except Exception:
+      print 'Ignored issue during template generation:\n%s' % \
+        traceback.format_exc()
+    return [self.dirname]
diff --git a/slapos/recipe/generate_erp5_tidstorage.py b/slapos/recipe/generate_erp5_tidstorage.py
new file mode 100644
index 0000000000000000000000000000000000000000..2f8dcba706c6ff5afbae2c9e58efbd5ed2b29f33
--- /dev/null
+++ b/slapos/recipe/generate_erp5_tidstorage.py
@@ -0,0 +1,179 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericSlapRecipe
+import os
+import json
+import traceback
+
+SECTION_BACKEND_PUBLISHER = """[publish-apache-backend-list]
+recipe = slapos.cookbook:publish"""
+ZOPE_PORT_BASE = 12000
+ZEO_PORT_BASE = 15000
+HAPROXY_PORT_BASE = 11000
+APACHE_PORT_BASE = 10000
+
+class Recipe(GenericSlapRecipe):
+  def _options(self, options):
+    self.dirname = os.path.join(self.buildout['buildout']['parts-directory'],
+      self.name)
+    options['output'] = os.path.join(self.dirname, self.name + '.cfg')
+
+  def _generateRealTemplate(self):
+    current_zeo_port = ZEO_PORT_BASE
+    current_zope_port = ZOPE_PORT_BASE
+    current_apache_port = APACHE_PORT_BASE
+    current_haproxy_port = HAPROXY_PORT_BASE
+    json_data = json.loads(self.parameter_dict['json'])
+    site_id = str(json_data['site-id'])
+    # prepare zeo
+    output = ''
+    part_list = []
+    zope_dict = {}
+    zope_connection_dict = {}
+    known_tid_storage_identifier_dict = {}
+    snippet_zeo = open(self.options['snippet-zeo']).read()
+    for zeo_id, zeo_configuration_list in json_data['zeo'].iteritems():
+      storage_list = []
+      a = storage_list.append
+      for zeo_slave in zeo_configuration_list:
+        zope_connection_dict[zeo_slave['storage-name']] = {
+          'zope-cache-size': zeo_slave['zope-cache-size'],
+          'zeo-cache-size': zeo_slave['zeo-cache-size'],
+          'mount-point': zeo_slave['mount-point'] % {'site-id': site_id},
+          'storage-name': zeo_slave['storage-name'],
+          'server': '${zeo-instance-%(zeo-id)s:ip}:${zeo-instance-%(zeo-id)s:port}' % {'zeo-id': zeo_id}
+        }
+        zodb_path = os.path.join('${directory:zodb}', zeo_slave['storage-name'] + '.fs')
+        a('  storage-name=%(storage-name)s zodb-path=%(zodb-path)s' % {'zodb-path': zodb_path, 'storage-name': zeo_slave['storage-name']})
+        known_tid_storage_identifier_dict[
+          "((('%(ip)s', %(port)s),), '%(storage_name)s')" % dict(
+            ip='${zeo-instance-%s:ip}' % zeo_id,
+            port='${zeo-instance-%s:port}' % zeo_id,
+            storage_name=zeo_slave['storage-name'])] = (zodb_path, '${directory:zodb-backup}/%s/' % zeo_slave['storage-name'], zeo_slave['serialize-path'] % {'site-id': site_id})
+      current_zeo_port += 1
+      output += snippet_zeo % dict(
+        zeo_id=zeo_id,
+        zeo_port=current_zeo_port,
+        storage_list='\n'.join(storage_list)
+      )
+      part_list.extend([
+        "zeo-instance-%s" % zeo_id,
+        "logrotate-entry-zeo-%s" % zeo_id
+      ])
+
+    zeo_connection_list = []
+    a = zeo_connection_list.append
+    for k, v in zope_connection_dict.iteritems():
+      a('  zeo-cache-size=%(zeo-cache-size)s zope-cache-size=%(zope-cache-size)s server=%(server)s mount-point=%(mount-point)s storage-name=%(storage-name)s' % v)
+    zeo_connection_string = '\n'.join(zeo_connection_list)
+    zope_dict.update(
+      timezone=json_data['timezone'],
+      zeo_connection_string=zeo_connection_string
+    )
+    # always one distribution node
+    current_zope_port += 1
+    snippet_zope = open(self.options['snippet-zope']).read()
+    zope_id = 'zope-distribution'
+    part_list.append(zope_id)
+    part_list.append('logrotate-entry-%s' % zope_id)
+    output += snippet_zope % dict(zope_thread_amount=1, zope_id=zope_id,
+      zope_port=current_zope_port, zope_timeserver=True, **zope_dict)
+    # always one admin node
+    current_zope_port += 1
+    zope_id = 'zope-admin'
+    part_list.append(zope_id)
+    part_list.append('logrotate-entry-%s' % zope_id)
+    output += snippet_zope % dict(zope_thread_amount=1, zope_id=zope_id,
+      zope_port=current_zope_port, zope_timeserver=False, **zope_dict)
+    # handle activity key
+    for q in range(1, json_data['activity']['zopecount'] + 1):
+      current_zope_port += 1
+      part_name = 'zope-activity-%s' % q
+      part_list.append(part_name)
+      part_list.append('logrotate-entry-%s' % part_name)
+      output += snippet_zope % dict(zope_thread_amount=1, zope_id=part_name,
+        zope_port=current_zope_port, zope_timeserver=True, **zope_dict)
+    # handle backend key
+    snippet_backend = open(self.options['snippet-backend']).read()
+    publish_url_list = []
+    for backend_name, backend_configuration in json_data['backend'].iteritems():
+      haproxy_backend_list = []
+      for q in range(1, backend_configuration['zopecount'] + 1):
+        current_zope_port += 1
+        part_name = 'zope-%s-%s' % (backend_name, q)
+        part_list.append(part_name)
+        part_list.append('logrotate-entry-%s' % part_name)
+        output += snippet_zope % dict(
+          zope_thread_amount=backend_configuration['thread-amount'],
+          zope_id=part_name, zope_port=current_zope_port, zope_timeserver=False,
+          **zope_dict)
+        haproxy_backend_list.append('${%(part_name)s:ip}:${%(part_name)s:port}' % dict(part_name=part_name))
+      # now generate backend access
+      current_apache_port += 1
+      current_haproxy_port += 1
+      part_list.append('apache-%(backend_name)s ca-apache-%(backend_name)s logrotate-entry-apache-%(backend_name)s haproxy-%(backend_name)s' % dict(backend_name=backend_name))
+      backend_dict = dict(
+        backend_name=backend_name,
+        apache_port=current_apache_port,
+        haproxy_port=current_haproxy_port,
+        access_control_string=backend_configuration['access-control-string'],
+        maxconn=backend_configuration['maxconn'],
+        server_check_path='/%s/getId' % site_id,
+        haproxy_backend_list=' '.join(haproxy_backend_list)
+      )
+      publish_url_list.append('url-%(backend_name)s = https://[${apache-%(backend_name)s:ip}]:${apache-%(backend_name)s:port}' % dict(
+        backend_name=backend_name))
+      output += snippet_backend % backend_dict
+    output += SECTION_BACKEND_PUBLISHER + '\n'
+    output += '\n'.join(publish_url_list)
+    part_list.append('publish-apache-backend-list')
+    prepend = open(self.options['snippet-master']).read() % dict(
+        part_list='  \n'.join(['  '+q for q in part_list]),
+        known_tid_storage_identifier_dict=known_tid_storage_identifier_dict,
+        haproxy_section="haproxy-%s" % backend_name,
+        zope_section=zope_id,
+        site_id=site_id,
+        **self.parameter_dict
+        )
+    output = prepend + output
+    with open(self.options['output'], 'w') as f:
+      f.write(output)
+
+  def _install(self):
+    if not os.path.exists(self.dirname):
+      os.mkdir(self.dirname)
+    if not "json" in self.parameter_dict:
+      # no json transimtted, nothing to do
+      with open(self.options['output'], 'w') as f:
+        f.write("[buildout]\nparts =\n")
+    else:
+      try:
+        self._generateRealTemplate()
+      except Exception:
+        print 'Ignored issue during template generation:\n%s' % \
+          traceback.format_exc()
+    return [self.dirname]
diff --git a/slapos/recipe/generic_cloudooo/__init__.py b/slapos/recipe/generic_cloudooo/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..86e59ff6459043a9b313f664ce13f69434ba5493
--- /dev/null
+++ b/slapos/recipe/generic_cloudooo/__init__.py
@@ -0,0 +1,58 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+import zc.buildout
+from slapos.recipe.librecipe import GenericBaseRecipe
+
+class Recipe(GenericBaseRecipe):
+  def install(self):
+    path_list = []
+    conversion_server_dict = dict(
+      working_path=self.options['data-directory'],
+      uno_path=self.options['ooo-uno-path'],
+      office_binary_path=self.options['ooo-binary-path'],
+      ip=self.options['ip'],
+      port=int(self.options['port']),
+      openoffice_port=int(self.options['openoffice-port']),
+    )
+    for env_line in self.options['environment'].splitlines():
+      env_line = env_line.strip()
+      if not env_line:
+        continue
+      if '=' in env_line:
+        env_key, env_value = env_line.split('=')
+        conversion_server_dict[env_key.strip()] = env_value.strip()
+      else:
+        raise zc.buildout.UserError('Line %r in environment parameter is '
+            'incorrect' % env_line)
+    config_file = self.createFile(self.options['configuration-file'],
+        self.substituteTemplate(self.getTemplateFilename('cloudooo.cfg.in'),
+          conversion_server_dict))
+    path_list.append(config_file)
+    path_list.append(self.createPythonScript(self.options['wrapper'],
+     'slapos.recipe.librecipe.execute.execute_with_signal_translation',
+      [self.options['ooo-paster'].strip(), 'serve', config_file]))
+    return path_list
diff --git a/slapos/recipe/erp5/template/cloudooo.cfg.in b/slapos/recipe/generic_cloudooo/template/cloudooo.cfg.in
similarity index 97%
rename from slapos/recipe/erp5/template/cloudooo.cfg.in
rename to slapos/recipe/generic_cloudooo/template/cloudooo.cfg.in
index 17ead81aaa67488fd3334c5b369363b2a70d9d08..156f7e4aeca9507cc84f90c84c8a8e14e592671f 100644
--- a/slapos/recipe/erp5/template/cloudooo.cfg.in
+++ b/slapos/recipe/generic_cloudooo/template/cloudooo.cfg.in
@@ -34,6 +34,7 @@ application_hostname = %(ip)s
 openoffice_port = %(openoffice_port)s
 # LD_LIBRARY_PATH passed to OpenOffice
 env-LD_LIBRARY_PATH = %(LD_LIBRARY_PATH)s
+env-FONTCONFIG_FILE = %(FONTCONFIG_FILE)s
 
 #
 # Mimetype Registry
diff --git a/slapos/recipe/generic_kumofs/__init__.py b/slapos/recipe/generic_kumofs/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..0b939c8879e7282e1e528c248aefe3e86e20afc0
--- /dev/null
+++ b/slapos/recipe/generic_kumofs/__init__.py
@@ -0,0 +1,70 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+import os
+from slapos.recipe.librecipe import GenericBaseRecipe
+
+class Recipe(GenericBaseRecipe):
+  def install(self):
+    ip = self.options['ip']
+    kumo_manager_port = int(self.options['manager-port'])
+    kumo_server_port = int(self.options['server-port'])
+    kumo_server_listen_port = int(self.options['server-listen-port'])
+    kumo_gateway_port = int(self.options['gateway-port'])
+    path_list = []
+    # XXX: kumo is not storing pid in file, unless it is not running as daemon
+    #      but running daemons is incompatible with SlapOS, so there is currently
+    #      no way to have Kumo's pid files to rotate logs and send signals to them
+    config = dict(
+      kumo_gateway_binary=self.options['kumo-gateway-binary'],
+      kumo_gateway_ip=ip,
+      kumo_gateway_log=self.options['kumo-gateway-log'],
+      kumo_manager_binary=self.options['kumo-manager-binary'],
+      kumo_manager_ip=ip,
+      kumo_manager_log=self.options['kumo-manager-log'],
+      kumo_server_binary=self.options['kumo-server-binary'],
+      kumo_server_ip=ip,
+      kumo_server_log=self.options['kumo-server-log'],
+      kumo_server_storage=os.path.join(self.options['data-directory'], "kumodb.tch"),
+      kumo_manager_port=kumo_manager_port,
+      kumo_server_port=kumo_server_port,
+      kumo_server_listen_port=kumo_server_listen_port,
+      kumo_gateway_port=kumo_gateway_port
+    )
+
+    path_list.append(self.createExecutable(self.options['gateway-wrapper'],
+      self.substituteTemplate(self.getTemplateFilename('kumo_gateway.in'),
+        config)))
+
+    path_list.append(self.createExecutable(self.options['manager-wrapper'],
+      self.substituteTemplate(self.getTemplateFilename('kumo_manager.in'),
+        config)))
+
+    path_list.append(self.createExecutable(self.options['server-wrapper'],
+      self.substituteTemplate(self.getTemplateFilename('kumo_server.in'),
+        config)))
+
+    return path_list
diff --git a/slapos/recipe/erp5/template/kumo_gateway.in b/slapos/recipe/generic_kumofs/template/kumo_gateway.in
similarity index 100%
rename from slapos/recipe/erp5/template/kumo_gateway.in
rename to slapos/recipe/generic_kumofs/template/kumo_gateway.in
diff --git a/slapos/recipe/erp5/template/kumo_manager.in b/slapos/recipe/generic_kumofs/template/kumo_manager.in
similarity index 100%
rename from slapos/recipe/erp5/template/kumo_manager.in
rename to slapos/recipe/generic_kumofs/template/kumo_manager.in
diff --git a/slapos/recipe/erp5/template/kumo_server.in b/slapos/recipe/generic_kumofs/template/kumo_server.in
similarity index 100%
rename from slapos/recipe/erp5/template/kumo_server.in
rename to slapos/recipe/generic_kumofs/template/kumo_server.in
diff --git a/slapos/recipe/generic_memcached/__init__.py b/slapos/recipe/generic_memcached/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..7a3a77a2a63034bef5e35acc34dd04b8f0da9334
--- /dev/null
+++ b/slapos/recipe/generic_memcached/__init__.py
@@ -0,0 +1,56 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericBaseRecipe
+
+class Recipe(GenericBaseRecipe):
+  """
+  memcached instance configuration.
+
+  wrapper-path -- location of the init script to generate
+
+  binary-path -- location of the memcached command
+
+  ip -- ip of the memcached server
+
+  port -- port of the memcached server
+  """
+
+  def install(self):
+    template_filename = self.getTemplateFilename('memcached.in')
+
+    config = dict(
+        memcached_binary=self.options['binary_path'],
+        memcached_ip=self.options['ip'],
+        memcached_port=self.options['port'],
+    )
+
+    executable_path = self.createExecutable(
+      self.options['wrapper_path'],
+      self.substituteTemplate(self.getTemplateFilename('memcached.in'),
+                              config))
+
+    return [executable_path]
diff --git a/slapos/recipe/erp5/template/memcached.in b/slapos/recipe/generic_memcached/template/memcached.in
similarity index 100%
rename from slapos/recipe/erp5/template/memcached.in
rename to slapos/recipe/generic_memcached/template/memcached.in
diff --git a/slapos/recipe/generic_mysql/__init__.py b/slapos/recipe/generic_mysql/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..6c36637d99ede3a452307337e9a5b94a15a6a26f
--- /dev/null
+++ b/slapos/recipe/generic_mysql/__init__.py
@@ -0,0 +1,179 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericBaseRecipe
+import os
+
+class Recipe(GenericBaseRecipe):
+
+  def _options(self, options):
+    options['password'] = self.generatePassword()
+    options['test-password'] = self.generatePassword()
+    for x in xrange(0, int(options['parallel-test-database-amount'])):
+      options['test-password-%s' % x] = self.generatePassword()
+
+  def install(self):
+    path_list = []
+
+    template_filename = self.getTemplateFilename('my.cnf.in')
+
+    mysql_conf = dict(
+        ip=self.options['ip'],
+        data_directory=self.options['data-directory'],
+        tcp_port=self.options['port'],
+        pid_file=self.options['pid-file'],
+        socket=self.options['socket'],
+        error_log=self.options['error-log'],
+        slow_query_log=self.options['slow-query-log'],
+        mysql_database=self.options['database'],
+        mysql_user=self.options['user'],
+        mysql_password=self.options['password'],
+        mysql_test_database=self.options['test-database'],
+        mysql_test_user=self.options['test-user'],
+        mysql_test_password=self.options['test-password'],
+    )
+
+    mysql_binary = self.options['mysql-binary']
+    socket = self.options['socket'],
+
+    mysql_conf_file = self.createFile(
+      self.options['conf-file'],
+      self.substituteTemplate(template_filename, mysql_conf)
+    )
+    path_list.append(mysql_conf_file)
+
+    mysql_script_list = []
+
+    # real database
+    mysql_script_list.append(self.substituteTemplate(
+      self.getTemplateFilename('initmysql.sql.in'),
+      {
+        'mysql_database': mysql_conf['mysql_database'],
+        'mysql_user': mysql_conf['mysql_user'],
+        'mysql_password': mysql_conf['mysql_password']
+      }
+    ))
+    # default test database
+    mysql_script_list.append(self.substituteTemplate(
+      self.getTemplateFilename('initmysql.sql.in'),
+      {
+        'mysql_database': mysql_conf['mysql_test_database'],
+        'mysql_user': mysql_conf['mysql_test_user'],
+        'mysql_password': mysql_conf['mysql_test_password']
+      }
+    ))
+    # parallel test databases
+    for x in xrange(0, int(self.options['parallel-test-database-amount'])):
+      mysql_script_list.append(self.substituteTemplate(
+        self.getTemplateFilename('initmysql.sql.in'),
+        {
+          'mysql_database': self.options['mysql-test-database-base'] + '_%s' % x,
+          'mysql_user': self.options['mysql-test-user-base'] + '_%s' % x,
+          'mysql_password': self.options['test-password-%s' % x]
+        }
+      ))
+    mysql_script_list.append('EXIT')
+    mysql_script = '\n'.join(mysql_script_list)
+
+    mysql_upgrade_binary = self.options['mysql-upgrade-binary']
+    mysql_update = self.createPythonScript(
+      self.options['update-wrapper'],
+      '%s.mysql.updateMysql' % __name__,
+      [dict(
+        mysql_script=mysql_script,
+        mysql_binary=mysql_binary,
+        mysql_upgrade_binary=mysql_upgrade_binary,
+        socket=socket,
+      )]
+    )
+    path_list.append(mysql_update)
+
+    mysqld_binary = self.options['mysqld-binary']
+    mysqld = self.createPythonScript(
+      self.options['wrapper'],
+      '%s.mysql.runMysql' % __name__,
+      [dict(
+        mysql_install_binary=self.options['mysql-install-binary'],
+        mysqld_binary=mysqld_binary,
+        data_directory=mysql_conf['data_directory'],
+        mysql_binary=mysql_binary,
+        socket=socket,
+        configuration_file=mysql_conf_file,
+       )]
+    )
+    path_list.append(mysqld)
+    # backup configuration
+    full_backup = self.options['full-backup-directory']
+    incremental_backup = self.options['incremental-backup-directory']
+    innobackupex_argument_list = [self.options['perl-binary'],
+        self.options['innobackupex-binary'],
+        '--defaults-file=%s' % mysql_conf_file,
+        '--socket=%s' %mysql_conf['socket'].strip(), '--user=root',
+        '--ibbackup=%s'% self.options['xtrabackup-binary']]
+    environment = dict(PATH='%s' % self.options['bin-directory'])
+    innobackupex_incremental = self.createPythonScript(self.options['innobackupex-incremental'], 'slapos.recipe.librecipe.execute.executee', [innobackupex_argument_list + ['--incremental'], environment])
+    path_list.append(innobackupex_incremental)
+    innobackupex_full = self.createPythonScript(self.options['innobackupex-full'], 'slapos.recipe.librecipe.execute.executee', [innobackupex_argument_list, environment])
+    path_list.append(innobackupex_full)
+    backup_controller = self.createPythonScript(self.options['backup-script'], __name__ + '.innobackupex.controller', [innobackupex_incremental, innobackupex_full, full_backup, incremental_backup])
+    path_list.append(backup_controller)
+    # maatkit installation
+    for pt_script_name in (
+        'pt-archiver',
+        'pt-config-diff',
+        'pt-deadlock-logger',
+        'pt-duplicate-key-checker',
+        'pt-fifo-split',
+        'pt-find',
+        'pt-fk-error-logger',
+        'pt-heartbeat',
+        'pt-index-usage',
+        'pt-kill',
+        'pt-log-player',
+        'pt-online-schema-change',
+        'pt-query-advisor',
+        'pt-query-digest',
+        'pt-show-grants',
+        'pt-slave-delay',
+        'pt-slave-find',
+        'pt-slave-restart',
+        'pt-table-checksum',
+        'pt-table-sync',
+        'pt-tcp-model',
+        'pt-trend',
+        'pt-upgrade',
+        'pt-variable-advisor',
+        'pt-visual-explain',
+        ):
+      pt_argument_list = [self.options['perl-binary'],
+          self.options['%s-binary' % pt_script_name],
+          '--defaults-file=%s' % mysql_conf_file,
+          '--socket=%s' %mysql_conf['socket'].strip(), '--user=root',
+          ]
+      pt_exe = self.createPythonScript(os.path.join(self.options['bin-directory'], pt_script_name), 'slapos.recipe.librecipe.execute.executee', [pt_argument_list, environment])
+      path_list.append(pt_exe)
+
+    return path_list
diff --git a/slapos/recipe/erp5/innobackupex.py b/slapos/recipe/generic_mysql/innobackupex.py
similarity index 100%
rename from slapos/recipe/erp5/innobackupex.py
rename to slapos/recipe/generic_mysql/innobackupex.py
diff --git a/slapos/recipe/erp5/mysql.py b/slapos/recipe/generic_mysql/mysql.py
similarity index 100%
rename from slapos/recipe/erp5/mysql.py
rename to slapos/recipe/generic_mysql/mysql.py
diff --git a/slapos/recipe/erp5/template/initmysql.sql.in b/slapos/recipe/generic_mysql/template/initmysql.sql.in
similarity index 100%
rename from slapos/recipe/erp5/template/initmysql.sql.in
rename to slapos/recipe/generic_mysql/template/initmysql.sql.in
diff --git a/slapos/recipe/erp5/template/my.cnf.in b/slapos/recipe/generic_mysql/template/my.cnf.in
similarity index 87%
rename from slapos/recipe/erp5/template/my.cnf.in
rename to slapos/recipe/generic_mysql/template/my.cnf.in
index 632d35c996e4badff3d09e5b6f84ef4dbc6b252f..25d951e863b594e5ac3ca2709897da3763c45754 100644
--- a/slapos/recipe/erp5/template/my.cnf.in
+++ b/slapos/recipe/generic_mysql/template/my.cnf.in
@@ -15,12 +15,17 @@ socket = %(socket)s
 datadir = %(data_directory)s
 pid-file = %(pid_file)s
 log-error = %(error_log)s
-log-slow-file = %(slow_query_log)s
+slow_query_log
+slow_query_log_file = %(slow_query_log)s
 long_query_time = 5
 max_allowed_packet = 128M
 query_cache_size = 32M
 
-plugin-load = ha_innodb_plugin.so
+plugin-load = ha_groonga.so;ha_sphinx.so
+
+# By default only 100 connections are allowed, when using zeo
+# we may have much more connections
+# max_connections = 1000
 
 # The following are important to configure and depend a lot on to the size of
 # your database and the available resources.
diff --git a/slapos/recipe/generic_zope/__init__.py b/slapos/recipe/generic_zope/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..0c29ac934228aa025b2363d9e4947e7ec6129827
--- /dev/null
+++ b/slapos/recipe/generic_zope/__init__.py
@@ -0,0 +1,135 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericBaseRecipe
+import binascii
+import hashlib
+import os
+import re
+import zc.buildout
+
+_isurl = re.compile('([a-zA-Z0-9+.-]+)://').match
+
+# based on Zope2.utilities.mkzopeinstance.write_inituser
+def Zope2InitUser(path, username, password):
+  open(path, 'w').write('')
+  os.chmod(path, 0600)
+  open(path, "w").write('%s:{SHA}%s\n' % (
+    username,binascii.b2a_base64(hashlib.sha1(password).digest())[:-1]))
+
+class Recipe(GenericBaseRecipe):
+  def _options(self, options):
+    options['password'] = self.generatePassword()
+    options['deadlock-password'] = self.generatePassword()
+
+  def install(self):
+    """
+    All zope have to share file created by portal_classes
+    (until everything is integrated into the ZODB).
+    So, do not request zope instance and create multiple in the same partition.
+    """
+    path_list = []
+    Zope2InitUser(self.options['inituser'], self.options['user'],
+      self.options['password'])
+
+    # Symlink to BT5 repositories defined in instance config.
+    # Those paths will eventually end up in the ZODB, and having symlinks
+    # inside the XXX makes it possible to reuse such ZODB with another software
+    # release[ version].
+    # Note: this path cannot be used for development, it's really just a
+    # read-only repository.
+    repository_path = self.options['bt5-repository']
+
+    self.bt5_repository_list = []
+    append = self.bt5_repository_list.append
+    for repository in self.options.get('bt5-repository-list', '').split():
+      repository = repository.strip()
+      if not repository:
+        continue
+
+      if _isurl(repository) and not repository.startswith("file://"):
+        # XXX: assume it's a valid URL
+        append(repository)
+        continue
+
+      if repository.startswith('file://'):
+        repository = repository.replace('file://', '', '')
+
+      if os.path.isabs(repository):
+        repo_id = hashlib.sha1(repository).hexdigest()
+        link = os.path.join(repository_path, repo_id)
+        if os.path.lexists(link):
+          if not os.path.islink(link):
+            raise zc.buildout.UserError(
+              'Target link already %r exists but it is not link' % link)
+          os.unlink(link)
+        os.symlink(repository, link)
+        self.logger.debug('Created link %r -> %r' % (link, repository_path))
+        # Always provide a URL-Type
+        append("file://" + link)
+
+    # Create zope configuration file
+    zope_config = dict(
+        products=self.options['products'],
+        thread_amount=self.options['thread-amount'],
+        zodb_root_path=self.options['zodb-path'],
+        zodb_cache_size=int(self.options['zodb-cache-size']),
+    )
+    zope_environment = dict(
+      TMP=self.options['tmp-path'],
+      TMPDIR=self.options['tmp-path'],
+      HOME=self.options['tmp-path'],
+      PATH=self.options['bin-path']
+    )
+    # configure default Zope2 zcml
+    open(self.options['site-zcml'], 'w').write(open(self.getTemplateFilename(
+        'site.zcml')).read())
+    zope_config['instance'] = self.options['instance-path']
+    zope_config['event_log'] = self.options['event-log']
+    zope_config['z2_log'] = self.options['z2-log']
+    zope_config['pid-filename'] = self.options['pid-file']
+    zope_config['lock-filename'] = self.options['lock-file']
+    prefixed_products = []
+    for product in reversed(zope_config['products'].split()):
+      product = product.strip()
+      if product:
+        prefixed_products.append('products %s' % product)
+    prefixed_products.insert(0, 'products %s' % self.options[
+      'instance-products'])
+    zope_config['products'] = '\n'.join(prefixed_products)
+    zope_config['address'] = '%s:%s' % (self.options['ip'], self.options['port'])
+    zope_config.update(dump_url=self.options['deadlock-path'],
+      secret=self.options['deadlock-password'])
+
+    zope_wrapper_template_location = self.getTemplateFilename('zope.conf.in')
+    zope_conf_content = self.substituteTemplate(zope_wrapper_template_location,
+      zope_config)
+
+    zope_conf_path = self.createFile(self.options['configuration-file'], zope_conf_content)
+    path_list.append(zope_conf_path)
+    # Create init script
+    path_list.append(self.createPythonScript(self.options['wrapper'], 'slapos.recipe.librecipe.execute.executee', [[self.options['runzope-binary'].strip(), '-C', zope_conf_path], zope_environment]))
+    return path_list
diff --git a/slapos/recipe/erp5/template/site.zcml b/slapos/recipe/generic_zope/template/site.zcml
similarity index 100%
rename from slapos/recipe/erp5/template/site.zcml
rename to slapos/recipe/generic_zope/template/site.zcml
diff --git a/slapos/recipe/generic_zope/template/zope.conf.in b/slapos/recipe/generic_zope/template/zope.conf.in
new file mode 100644
index 0000000000000000000000000000000000000000..3853b0d641c8d5aa664890f9f2c5e050b61db921
--- /dev/null
+++ b/slapos/recipe/generic_zope/template/zope.conf.in
@@ -0,0 +1,73 @@
+## Zope 2 configuration file generated by SlapOS
+
+# Some defines
+%%define INSTANCE %(instance)s
+instancehome $INSTANCE
+
+# Used products
+%(products)s
+
+# Environment is setup in running wrapper script
+# Reason: zope.conf is read too late for some componets
+
+# No need to debug
+debug-mode off
+
+# One thread is safe enough
+zserver-threads %(thread_amount)s
+
+# File location
+pid-filename %(pid-filename)s
+lock-filename %(lock-filename)s
+
+# Temporary storage database (for sessions)
+<zodb_db temporary>
+     <temporarystorage>
+       name temporary storage for sessioning
+     </temporarystorage>
+     mount-point /temp_folder
+     container-class Products.TemporaryFolder.TemporaryContainer
+</zodb_db>
+
+# Logging configuration
+<eventlog>
+  <logfile>
+    dateformat
+    path %(event_log)s
+  </logfile>
+</eventlog>
+<logger access>
+  <logfile>
+    dateformat
+    path %(z2_log)s
+  </logfile>
+</logger>
+
+# Serving configuration
+<http-server>
+  address %(address)s
+</http-server>
+
+# ZODB configuration
+<zodb_db root>
+    cache-size %(zodb_cache_size)d
+    <filestorage>
+      path %(zodb_root_path)s
+    </filestorage>
+    mount-point /
+</zodb_db>
+<zoperunner>
+    program $INSTANCE/bin/runzope
+</zoperunner>
+
+# DeadlockDebugger configuration
+<product-config DeadlockDebugger>
+  dump_url %(dump_url)s
+  secret %(secret)s
+</product-config>
+
+# ERP5 Timer Service
+%%import timerserver
+<timer-server>
+  interval 5
+</timer-server>
diff --git a/slapos/recipe/generic_zope_zeo_client/__init__.py b/slapos/recipe/generic_zope_zeo_client/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..23880676b158245605dcf70c0c6b213d18c6d93b
--- /dev/null
+++ b/slapos/recipe/generic_zope_zeo_client/__init__.py
@@ -0,0 +1,151 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericBaseRecipe
+import binascii
+import hashlib
+import os
+import re
+import zc.buildout
+
+_isurl = re.compile('([a-zA-Z0-9+.-]+)://').match
+
+# based on Zope2.utilities.mkzopeinstance.write_inituser
+def Zope2InitUser(path, username, password):
+  open(path, 'w').write('')
+  os.chmod(path, 0600)
+  open(path, "w").write('%s:{SHA}%s\n' % (
+    username,binascii.b2a_base64(hashlib.sha1(password).digest())[:-1]))
+
+class Recipe(GenericBaseRecipe):
+  def _options(self, options):
+    options['password'] = self.generatePassword()
+    options['deadlock-password'] = self.generatePassword()
+
+  def install(self):
+    """
+    All zope have to share file created by portal_classes
+    (until everything is integrated into the ZODB).
+    So, do not request zope instance and create multiple in the same partition.
+    """
+    path_list = []
+    Zope2InitUser(self.options['inituser'], self.options['user'],
+      self.options['password'])
+
+    # Symlink to BT5 repositories defined in instance config.
+    # Those paths will eventually end up in the ZODB, and having symlinks
+    # inside the XXX makes it possible to reuse such ZODB with another software
+    # release[ version].
+    # Note: this path cannot be used for development, it's really just a
+    # read-only repository.
+    repository_path = self.options['bt5-repository']
+
+    self.bt5_repository_list = []
+    append = self.bt5_repository_list.append
+    for repository in self.options.get('bt5-repository-list', '').split():
+      repository = repository.strip()
+      if not repository:
+        continue
+
+      if _isurl(repository) and not repository.startswith("file://"):
+        # XXX: assume it's a valid URL
+        append(repository)
+        continue
+
+      if repository.startswith('file://'):
+        repository = repository.replace('file://', '', '')
+
+      if os.path.isabs(repository):
+        repo_id = hashlib.sha1(repository).hexdigest()
+        link = os.path.join(repository_path, repo_id)
+        if os.path.lexists(link):
+          if not os.path.islink(link):
+            raise zc.buildout.UserError(
+              'Target link already %r exists but it is not link' % link)
+          os.unlink(link)
+        os.symlink(repository, link)
+        self.logger.debug('Created link %r -> %r' % (link, repository_path))
+        # Always provide a URL-Type
+        append("file://" + link)
+
+    # Generate Zeo connections
+    zeo_snippet_template = open(self.getTemplateFilename('zope.zeo.entry.conf.in'
+      )).read()
+    zeo_snippet_list = []
+    for zeo_line in self.options['zeo-connection-string'].splitlines():
+      zeo_line.strip()
+      if not zeo_line:
+        continue
+      d = dict()
+      for param in zeo_line.split():
+        k, v = param.split('=')
+        d[k.strip()] = v.strip()
+      zeo_snippet_list.append(zeo_snippet_template % d)
+    # Create zope configuration file
+    zope_config = dict(
+        products=self.options['products'],
+        thread_amount=self.options['thread-amount'],
+        zodb_configuration='\n'.join(zeo_snippet_list)
+    )
+    zope_environment = dict(
+      TMP=self.options['tmp-path'],
+      TMPDIR=self.options['tmp-path'],
+      HOME=self.options['tmp-path'],
+      PATH=self.options['bin-path'],
+      TIMEZONE=self.options['timezone'],
+    )
+    # configure default Zope2 zcml
+    open(self.options['site-zcml'], 'w').write(open(self.getTemplateFilename(
+        'site.zcml')).read())
+    zope_config['instance'] = self.options['instance-path']
+    zope_config['event_log'] = self.options['event-log']
+    zope_config['z2_log'] = self.options['z2-log']
+    zope_config['pid-filename'] = self.options['pid-file']
+    zope_config['lock-filename'] = self.options['lock-file']
+    prefixed_products = []
+    for product in reversed(zope_config['products'].split()):
+      product = product.strip()
+      if product:
+        prefixed_products.append('products %s' % product)
+    prefixed_products.insert(0, 'products %s' % self.options[
+      'instance-products'])
+    zope_config['products'] = '\n'.join(prefixed_products)
+    zope_config['address'] = '%s:%s' % (self.options['ip'], self.options['port'])
+    zope_config.update(dump_url=self.options['deadlock-path'],
+      secret=self.options['deadlock-password'])
+
+    zope_wrapper_template_location = self.getTemplateFilename('zope.conf.in')
+    zope_conf_content = self.substituteTemplate(zope_wrapper_template_location,
+      zope_config)
+    if self.isTrueValue(self.options['timeserver']):
+      zope_conf_content += self.substituteTemplate(self.getTemplateFilename(
+          'zope.conf.timeserver.in'), {})
+
+    zope_conf_path = self.createFile(self.options['configuration-file'], zope_conf_content)
+    path_list.append(zope_conf_path)
+    # Create init script
+    path_list.append(self.createPythonScript(self.options['wrapper'], 'slapos.recipe.librecipe.execute.executee', [[self.options['runzope-binary'].strip(), '-C', zope_conf_path], zope_environment]))
+    return path_list
diff --git a/slapos/recipe/generic_zope_zeo_client/template/site.zcml b/slapos/recipe/generic_zope_zeo_client/template/site.zcml
new file mode 100644
index 0000000000000000000000000000000000000000..47454428ef0282edeab26b4bb96edf57bce2f33c
--- /dev/null
+++ b/slapos/recipe/generic_zope_zeo_client/template/site.zcml
@@ -0,0 +1,26 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:meta="http://namespaces.zope.org/meta"
+    xmlns:five="http://namespaces.zope.org/five">
+
+  <include package="Products.Five" />
+  <meta:redefinePermission from="zope2.Public" to="zope.Public" />
+
+
+  <!-- Load the meta -->
+  <include files="package-includes/*-meta.zcml" />
+  <five:loadProducts file="meta.zcml"/>
+
+  <!-- Load the configuration -->
+  <include files="package-includes/*-configure.zcml" />
+  <five:loadProducts />
+
+  <!-- Load the configuration overrides-->
+  <includeOverrides files="package-includes/*-overrides.zcml" />
+  <five:loadProductsOverrides />
+
+
+  <securityPolicy
+      component="Products.Five.security.FiveSecurityPolicy" />
+
+</configure>
diff --git a/slapos/recipe/erp5/template/zope.conf.in b/slapos/recipe/generic_zope_zeo_client/template/zope.conf.in
similarity index 85%
rename from slapos/recipe/erp5/template/zope.conf.in
rename to slapos/recipe/generic_zope_zeo_client/template/zope.conf.in
index e8576401314fb57a5154abd98bba69cb744f43d6..9f64fff798c1af0a03901b565e825229ff5ff521 100644
--- a/slapos/recipe/erp5/template/zope.conf.in
+++ b/slapos/recipe/generic_zope_zeo_client/template/zope.conf.in
@@ -31,12 +31,14 @@ lock-filename %(lock-filename)s
 
 # Logging configuration
 <eventlog>
+  level info
   <logfile>
     dateformat
     path %(event_log)s
   </logfile>
 </eventlog>
 <logger access>
+  level WARN
   <logfile>
     dateformat
     path %(z2_log)s
@@ -49,7 +51,14 @@ lock-filename %(lock-filename)s
 </http-server>
 
 # ZODB configuration
-%(zodb_configuration_string)s
+%(zodb_configuration)s
+
 <zoperunner>
     program $INSTANCE/bin/runzope
 </zoperunner>
+
+# DeadlockDebugger configuration
+<product-config DeadlockDebugger>
+  dump_url %(dump_url)s
+  secret %(secret)s
+</product-config>
diff --git a/slapos/recipe/erp5/template/zope.conf.timerservice.in b/slapos/recipe/generic_zope_zeo_client/template/zope.conf.timeserver.in
similarity index 100%
rename from slapos/recipe/erp5/template/zope.conf.timerservice.in
rename to slapos/recipe/generic_zope_zeo_client/template/zope.conf.timeserver.in
diff --git a/slapos/recipe/generic_zope_zeo_client/template/zope.zeo.entry.conf.in b/slapos/recipe/generic_zope_zeo_client/template/zope.zeo.entry.conf.in
new file mode 100644
index 0000000000000000000000000000000000000000..3ef43f2624460f2abca48b5992a82248a440d991
--- /dev/null
+++ b/slapos/recipe/generic_zope_zeo_client/template/zope.zeo.entry.conf.in
@@ -0,0 +1,10 @@
+<zodb_db %(storage-name)s>
+  cache-size %(zope-cache-size)s
+  mount-point %(mount-point)s
+  <zeoclient>
+    cache-size %(zeo-cache-size)s
+    server %(server)s
+    storage %(storage-name)s
+    name %(storage-name)s
+  </zeoclient>
+</zodb_db>
diff --git a/slapos/recipe/haproxy/__init__.py b/slapos/recipe/haproxy/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..ac7a0643311b0215069764acbfafbadc98870a74
--- /dev/null
+++ b/slapos/recipe/haproxy/__init__.py
@@ -0,0 +1,101 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericBaseRecipe
+
+class Recipe(GenericBaseRecipe):
+  """
+  haproxy instance configuration.
+
+  name -- local name of the haproxy
+
+  wrapper-path -- location of the init script to generate
+
+  binary-path -- location of the haproxy command
+
+  conf-path -- location of the configuration file
+
+  ip -- ip of the haproxy server
+
+  port -- port of the haproxy server
+
+  server-check-path -- path of the domain to check
+
+  address -- string with list of all url to check
+    Example: 127.0.0.1:12004 127.0.0.1:12005
+  """
+
+  def install(self):
+    # inter must be quite short in order to detect quickly an unresponsive node
+    #      and to detect quickly a node which is back
+    # rise must be minimal possible : 1, indeed, a node which is back don't need
+    #      to sleep more time and we can give him work immediately
+    # fall should be quite sort. with inter at 3, and fall at 2, a node will be
+    #      considered as dead after 6 seconds.
+    # maxconn should be set as the maximum thread we have per zope, like this
+    #      haproxy will manage the queue of request with the possibility to
+    #      move a request to another node if the initially selected one is dead
+    # maxqueue is the number of waiting request in the queue of every zope client.
+    #      It allows to make sure that there is not a zope client handling all
+    #      the work while other clients are doing nothing. This was happening
+    #      even thoug we have round robin distribution because when a node dies
+    #      some seconds, all request are dispatched to other nodes, and then users
+    #      stick in other nodes and are not coming back. Please note this option
+    #      is not an issue if you have more than (maxqueue * node_quantity) requests
+    #      because haproxy will handle a top-level queue
+
+    snippet_filename = self.getTemplateFilename(
+                                    'haproxy-server-snippet.cfg.in')
+    # Prepare all filestorages
+    server_snippet = ""
+    i = 0
+    name = self.options['name']
+    for address in self.options['backend-list'].split():
+      i += 1
+      server_snippet += self.substituteTemplate(
+          snippet_filename, dict(
+             name='%s_%s' % (name, i), 
+             address=address,
+             cluster_zope_thread_amount=self.options['maxconn']))
+
+    config = dict(
+        name=name, 
+        ip=self.options['ip'], 
+        port=self.options['port'],
+        server_text=server_snippet,
+        server_check_path=self.options['server-check-path'],)
+    template_filename = self.getTemplateFilename('haproxy.cfg.in')
+    configuration_path = self.createFile(
+        self.options['conf-path'],
+        self.substituteTemplate(template_filename, config))
+
+    # Create running wrapper
+    wrapper_path = self.createPythonScript(
+      self.options['wrapper-path'],
+      'slapos.recipe.librecipe.execute.execute',
+      arguments=[self.options['binary-path'].strip(), '-f', configuration_path],)
+
+    return [configuration_path, wrapper_path]
diff --git a/slapos/recipe/haproxy/template/haproxy-server-snippet.cfg.in b/slapos/recipe/haproxy/template/haproxy-server-snippet.cfg.in
new file mode 100644
index 0000000000000000000000000000000000000000..28f24a06db444c74b49a908364c936ba7d9f29b9
--- /dev/null
+++ b/slapos/recipe/haproxy/template/haproxy-server-snippet.cfg.in
@@ -0,0 +1,2 @@
+  server %(name)s %(address)s cookie %(name)s check inter 3s rise 1 fall 2 maxqueue 5 maxconn %(cluster_zope_thread_amount)s
+
diff --git a/slapos/recipe/erp5/template/haproxy.cfg.in b/slapos/recipe/haproxy/template/haproxy.cfg.in
similarity index 92%
rename from slapos/recipe/erp5/template/haproxy.cfg.in
rename to slapos/recipe/haproxy/template/haproxy.cfg.in
index aa8f8a865ecb58d166cfebcc911c681780651ae8..a732c3bc89b926dbb70b787ee32f9c2c957294d8 100644
--- a/slapos/recipe/erp5/template/haproxy.cfg.in
+++ b/slapos/recipe/haproxy/template/haproxy.cfg.in
@@ -22,12 +22,12 @@ defaults
   timeout connect 5s
   # As requested in haproxy doc, make this "at least equal to timeout server".
   timeout client 305s
-  # Use "option httpclose" to not preserve client & server persistent connections
+  # Use "option forceclose" to not preserve client & server persistent connections
   # while handling every incoming request individually, dispatching them one after
   # another to servers, in HTTP close mode. This is really needed when haproxy
   # is configured with maxconn to 1, without this options browser are unable
   # to render a page
-  option httpclose
+  option forceclose
 
 listen %(name)s %(ip)s:%(port)s
   cookie  SERVERID insert
diff --git a/slapos/recipe/kvm/__init__.py b/slapos/recipe/kvm/__init__.py
index 40c123135c85fddd8b483295c3664e09872f2899..e4d5688562bd5d1590f8922d144ef582d86965ec 100644
--- a/slapos/recipe/kvm/__init__.py
+++ b/slapos/recipe/kvm/__init__.py
@@ -59,7 +59,8 @@ class Recipe(BaseSlapRecipe):
 
     # Install the socket_connection_attempt script
     catcher = zc.buildout.easy_install.scripts(
-      [('check_port_listening', __name__ + 'socket_connection_attempt', 'connection_attempt')],
+      [('check_port_listening', 'slapos.recipe.kvm.socket_connection_attempt',
+        'connection_attempt')],
       self.ws,
       sys.executable,
       self.bin_directory,
@@ -84,11 +85,11 @@ class Recipe(BaseSlapRecipe):
 
     self.linkBinary()
     self.computer_partition.setConnectionDict(dict(
-        url = "https://[%s]:%s/vnc.html?host=[%s]&port=%s&encrypt=1" % (noVNC_conf['source_ip'],
-                                                     noVNC_conf['source_port'],
-                                                     noVNC_conf['source_ip'],
-                                                     noVNC_conf['source_port']
-                                                     ),
+        url = "https://[%s]:%s/vnc_auto.html?host=[%s]&port=%s&encrypt=1" % (
+            noVNC_conf['source_ip'],
+            noVNC_conf['source_port'],
+            noVNC_conf['source_ip'],
+            noVNC_conf['source_port']),
         password = kvm_conf['vnc_passwd']))
 
     return self.path_list
@@ -155,7 +156,8 @@ class Recipe(BaseSlapRecipe):
 
     # Instanciate KVM
     kvm_template_location = pkg_resources.resource_filename(
-      __name__, 'template/kvm_run.in')
+                                             __name__, os.path.join(
+                                             'template', 'kvm_run.in'))
 
     kvm_runner_path = self.createRunningWrapper("kvm",
           self.substituteTemplate(kvm_template_location,
@@ -165,7 +167,9 @@ class Recipe(BaseSlapRecipe):
 
     # Instanciate KVM controller
     kvm_controller_template_location = pkg_resources.resource_filename(
-      __name__, 'template/kvm_controller_run.in')
+                                             __name__, os.path.join(
+                                             'template',
+                                             'kvm_controller_run.in' ))
 
     kvm_controller_runner_path = self.createRunningWrapper("kvm_controller",
           self.substituteTemplate(kvm_controller_template_location,
@@ -205,34 +209,24 @@ class Recipe(BaseSlapRecipe):
     """
 
     noVNC_conf = {}
-   
+
     noVNC_conf['source_ip']   = source_ip
     noVNC_conf['source_port'] = source_port
-    
-    # Install numpy.
-    # XXX-Cedric : this looks like a hack. Do we have better solution, knowing
-    # That websockify is not an egg?
-    numpy = zc.buildout.easy_install.install(['numpy'], self.options['eggs-directory'])
-    environment = dict(PYTHONPATH='%s' % numpy.entries[0])
-    
-    # Instanciate Websockify
-    websockify_runner_path = zc.buildout.easy_install.scripts([('websockify',
-      'slapos.recipe.librecipe.execute', 'executee_wait')], self.ws,
-      sys.executable, self.wrapper_directory, arguments=[
-        [sys.executable.strip(),
-         self.options['websockify_path'],
-         '--web',
-         self.options['noVNC_location'],
-         '--key=%s' % (self.key_path),
-         '--cert=%s' % (self.certificate_path),
-         '--ssl-only',
-         '%s:%s' % (source_ip, source_port),
-         '%s:%s' % (target_ip, target_port)],
-        [self.certificate_path, self.key_path],
-        environment]
-       )[0]
-
-    self.path_list.append(websockify_runner_path)
+
+    execute_arguments = [[
+        self.options['websockify'].strip(),
+        '--web',
+        self.options['noVNC_location'],
+        '--key=%s' % (self.key_path),
+        '--cert=%s' % (self.certificate_path),
+        '--ssl-only',
+        '%s:%s' % (source_ip, source_port),
+        '%s:%s' % (target_ip, target_port)],
+        [self.certificate_path, self.key_path]]
+
+    self.path_list.extend(zc.buildout.easy_install.scripts([('websockify',
+      'slapos.recipe.librecipe.execute', 'execute_wait')], self.ws, sys.executable,
+      self.wrapper_directory, arguments=execute_arguments))
 
     # Add noVNC promise
     self.port_listening_promise_conf.update(hostname=noVNC_conf['source_ip'],
diff --git a/slapos/recipe/kvm/certificate_authority.py b/slapos/recipe/kvm/certificate_authority.py
index 8caffc0c21b2852f259a9b6f85bda5e311965c47..d05a460649c01edefd09e5caa09f3feab899ddcf 100755
--- a/slapos/recipe/kvm/certificate_authority.py
+++ b/slapos/recipe/kvm/certificate_authority.py
@@ -2,6 +2,7 @@ import os
 import subprocess
 import time
 import ConfigParser
+import uuid
 
 
 def popenCommunicate(command_list, input=None):
@@ -42,9 +43,10 @@ class CertificateAuthority:
     try:
       # no CA, let us create new one
       popenCommunicate([self.openssl_binary, 'req', '-nodes', '-config',
-          self.openssl_configuration, '-new', '-x509', '-extensions',
-          'v3_ca', '-keyout', self.key, '-out', self.certificate,
-          '-days', '10950'], 'Automatic Certificate Authority\n')
+          self.openssl_configuration, '-new', '-x509', '-extensions', 'v3_ca',
+          '-keyout', self.key, '-out', self.certificate, '-days', '10950'],
+          # Authority name will be random, so no instance has the same issuer
+          'Certificate Authority %s\n' % uuid.uuid1())
     except:
       try:
         for f in file_list:
diff --git a/slapos/recipe/lamp/__init__.py b/slapos/recipe/lamp/__init__.py
index 973d656e58f02bb492cd9840012bacf72c141e78..55ae815bcc6c859406b57b352b13c3c0eeef2bfa 100644
--- a/slapos/recipe/lamp/__init__.py
+++ b/slapos/recipe/lamp/__init__.py
@@ -127,9 +127,11 @@ class BaseRecipe(BaseSlapRecipe):
         self.substituteTemplate(pkg_resources.resource_filename(__name__,
           'template/apache.in'), apache_config))
     self.path_list.append(config_file)
+    php_ini = pkg_resources.resource_filename(__name__, 'template/php.ini.in')
+    if self.options.has_key('php_ini'):
+      php_ini = os.path.join(self.options['php_ini'], 'php.ini.in')
     self.path_list.append(self.createConfigurationFile('php.ini',
-        self.substituteTemplate(pkg_resources.resource_filename(__name__,
-          'template/php.ini.in'), dict(tmp_directory=self.tmp_directory))))
+        self.substituteTemplate(php_ini, dict(tmp_directory=self.tmp_directory))))
     self.path_list.extend(zc.buildout.easy_install.scripts([(
       'httpd',
         __name__ + '.apache', 'runApache')], self.ws,
@@ -153,20 +155,33 @@ class BaseRecipe(BaseSlapRecipe):
     destination = os.path.join(path, file)
     open(destination, 'w').write(open(template, 'r').read() % d)
 
-  def configureInstallation(self, document_root, mysql_conf, url):
+  def configureInstallation(self, document_root, url, mysql_conf):
     """Start process which can launch python scripts, move or remove files or 
     directories when installing software.
     """
-    if not self.options.has_key('delete') and not \
-        self.options.has_key('rename') and not self.options.has_key('script'):
-      return
+    if not self.options.has_key('delete') and not self.options.has_key('rename') and not\
+        self.options.has_key('chmod') and not self.options.has_key('script'):
+      return ""
     delete = []
+    chmod = []
+    data = []
     rename = []
     rename_list = ""
-    data = {}
+    argument = [self.options['lampconfigure_directory'].strip(),
+                             "-H", mysql_conf['mysql_host'], "-P", mysql_conf['mysql_port'],
+                             "-p", mysql_conf['mysql_password'], "-u", mysql_conf['mysql_user']]
+    if not self.options.has_key('file_token'):
+      argument = argument + ["-d", mysql_conf['mysql_database'],
+                             "--table", self.options['table_name'].strip(), "--cond",
+                             self.options['constraint'].strip()]
+    else:
+      argument = argument + ["-f", self.options['file_token'].strip()]
+    argument += ["-t", document_root]
+    
     if self.options.has_key('delete'):
+      delete = ["delete"]
       for fname in self.options['delete'].split(','):
-        delete.append(os.path.join(document_root, fname.strip()))
+        delete.append(fname.strip())
     if self.options.has_key('rename'):
       for fname in self.options['rename'].split(','):
         if fname.find("=>") < 0:
@@ -176,28 +191,22 @@ class BaseRecipe(BaseSlapRecipe):
           fname.append(old_name + '-' + mysql_conf['mysql_user'])
         else:
           fname = fname.split("=>")
-        rename.append(dict(old = os.path.join(document_root, fname[0].strip()),
-                           new = os.path.join(document_root, fname[1].strip())
-                           ))
-        rename_list += fname[0] + "=> " + fname[1] + ", "
-    if not self.options.has_key('file_token'):
-      token = dict(
-        table = self.options['table_name'].strip(),
-        constraint=self.options['constraint'].strip()
-      )
-    else:
-      token = os.path.join(document_root, self.options['file_token'].strip())
+        cmd = ["rename"]
+        if self.options.has_key('rename_chmod'):
+          cmd += ["--chmod", self.options['rename_chmod'].strip()]
+        rename.append(cmd + [fname[0].strip(), fname[1].strip()])
+        rename_list += fname[0] + " to " + fname[1] + " "
+    if self.options.has_key('chmod'):
+      chmod = ["chmod", self.options['mode'].strip()]
+      for fname in self.options['chmod'].split(','):
+        chmod.append(fname.strip())
     if self.options.has_key('script') and \
         self.options['script'].strip().endswith(".py"):
-      data = dict(htdocs = document_root,
-                  base_url = url,
-                  script = self.options['script'].strip(),
-                  renamed = rename_list
-                  )
+      data = ["run", self.options['script'].strip(), "-v", mysql_conf['mysql_database'], url, document_root]
     self.path_list.extend(zc.buildout.easy_install.scripts(
         [('configureInstall', __name__ + '.runner', 'executeRunner')], self.ws,
-        sys.executable, self.wrapper_directory, arguments=[delete, rename,
-            token, mysql_conf,data]))
+        sys.executable, self.wrapper_directory, arguments=[argument, delete, rename,
+            chmod, data]))
     return rename_list
 
 class Static(BaseRecipe):
@@ -218,14 +227,17 @@ class Simple(BaseRecipe):
     self.createHtdocs(self.options['source'].strip(), document_root)
     mysql_conf = self.installMysqlServer()
     url = self.installApache(document_root)
-    renamed = self.configureInstallation(document_root, mysql_conf, url)
-    self.setConnectionDict(dict(
-      url=url,
-      rename=renamed,
+    renamed = self.configureInstallation(document_root, url, mysql_conf)
+    connectionDict = dict(
+      url=url,      
       **mysql_conf
-    ))
-    self.createConfiguration(self.options['template'], document_root,
-        self.options['configuration'], mysql_conf)
+    )
+    if not renamed == "":
+      connectionDict['rename'] = renamed
+    self.setConnectionDict(connectionDict)
+    if self.options.has_key('template') and self.options.has_key('configuration'):
+      self.createConfiguration(self.options['template'], document_root,
+          self.options['configuration'], mysql_conf)
     return self.path_list
 
 class Request(BaseRecipe):
diff --git a/slapos/recipe/lamp/runner.py b/slapos/recipe/lamp/runner.py
index a04649595420ae800c054f88f6d7bcbecbfea1ee..8ec60ce88a9ec26dda687520d288b148509019c3 100644
--- a/slapos/recipe/lamp/runner.py
+++ b/slapos/recipe/lamp/runner.py
@@ -1,82 +1,27 @@
-import os
-import time
 import sys
-import shutil
-import MySQLdb
+import subprocess
     
 def executeRunner(args):
-  """Start the instance runner. this may run a python script, move or/and rename 
+  """Start the instance configure. this may run a python script, move or/and rename 
   file or directory when dondition is filled. the condition may be when file exist or when an entry
   exist into database.
   """
-  delete, rename, token, mysql_config, script_data = args
-  timeout = 5;
-  while True:
-    if not checkAction(token, mysql_config):
-      print "Waiting for 3s and retrying"
-      time.sleep(3)
-      continue
-    time.sleep(timeout)
-    for path in delete:
-      if not os.path.exists(path):
-        print "Error when deleting: '%s': no such file or directory" % path
-        continue
-      if os.path.isdir(path):
-        shutil.rmtree(path)
-      else:
-        os.remove(path)
-    for data in rename:
-      if not os.path.exists(data['old']):
-        print "Error when moving: '%s': no such file or directory" % data['old']
-        continue
-      os.rename(data['old'], data['new'])
-    if script_data != {}:
-      script = script_data['script']
-      if os.path.exists(script):
-        import subprocess
-        #run python script with predefined data
-        return_code = subprocess.call([sys.executable, script, script_data['base_url'],
-                         script_data['htdocs'], script_data['renamed'], 
-                         mysql_config['mysql_user'], mysql_config['mysql_password'], 
-                         mysql_config['mysql_database'], mysql_config['mysql_host']])
-        if return_code != 0:
-          print "Error: execution of script %r failed with code: %s" % (script, return_code)
-      else:
-        print "Error: can not read file '%s'" % script
+  arguments, delete, rename, chmod, data = args
+  if delete != []:
+    print "Calling lampconfigure with 'delete' arguments"
+    result = subprocess.Popen(arguments + delete)
+    result.wait()
+  if rename != []:
+    for parameters in rename:
+      print "Calling lampconfigure with 'rename' arguments"
+      result = subprocess.Popen(arguments + parameters)
+      result.wait()
+  if chmod != []:
+    print "Calling lampconfigure with 'chmod' arguments"
+    result = subprocess.Popen(arguments + chmod)
+    result.wait()
+  if data != []:
+    print "Calling lampconfigure with 'run' arguments"
+    result = subprocess.Popen(arguments + data)
+    result.wait()
     return
-
-def checkAction(token, mysql_config):
-  """Check if condition is filled. If token is string(that represent a path), the function check if file exist
-  otherwise token is a dictionary and mysql_config is used to check condition into database
-  """
-  if type(token) is dict:
-    try:
-      conn = MySQLdb.connect (host = mysql_config['mysql_host'],
-                        port = int(mysql_config['mysql_port']),
-                        user = mysql_config['mysql_user'],
-                        passwd = mysql_config['mysql_password'],
-                        db = mysql_config['mysql_database'])
-    except:
-      #Mysql is not ready yet?...
-      return False
-    if token['table'] == "**":
-      #only detect if mysql has been started
-      conn.close()
-      return True
-    cursor = conn.cursor ()
-    cursor.execute("SHOW TABLES LIKE '%" + token['table'] + "'") #Check if table has been created
-    row = cursor.fetchone ()
-    if row == None:
-      conn.close()
-      return False
-    else:
-      token['table'] = row[0]
-    cursor.execute ("SELECT * FROM " + token['table'] + " WHERE " + token['constraint'])
-    row = cursor.fetchone ()
-    conn.close()
-    if row == None:
-      return False
-    else:
-      return True
-  else:
-    return os.path.exists(token)
\ No newline at end of file
diff --git a/slapos/recipe/lamp/template/my.cnf.in b/slapos/recipe/lamp/template/my.cnf.in
index 043fb3ad56bbea3b3e35766a9b019cd8dbf7cc77..00eb280232a8e41206dccdca6be7fe15e58a1591 100644
--- a/slapos/recipe/lamp/template/my.cnf.in
+++ b/slapos/recipe/lamp/template/my.cnf.in
@@ -15,12 +15,13 @@ socket = %(socket)s
 datadir = %(data_directory)s
 pid-file = %(pid_file)s
 log-error = %(error_log)s
-log-slow-file = %(slow_query_log)s
+slow_query_log
+slow_query_log_file = %(slow_query_log)s
 long_query_time = 5
 max_allowed_packet = 128M
 query_cache_size = 32M
 
-plugin-load = ha_innodb_plugin.so
+plugin-load = ha_groonga.so;ha_sphinx.so
 
 # The following are important to configure and depend a lot on to the size of
 # your database and the available resources.
diff --git a/slapos/recipe/librecipe/genericslap.py b/slapos/recipe/librecipe/genericslap.py
index 63e6a29d662504d5e596954bd42f914d81acc2fc..16f93dd7a7efeade88c72601de991c4780a3d738 100644
--- a/slapos/recipe/librecipe/genericslap.py
+++ b/slapos/recipe/librecipe/genericslap.py
@@ -34,8 +34,8 @@ class GenericSlapRecipe(GenericBaseRecipe):
 
   def __init__(self, buildout, name, options):
     """Default initialisation"""
-    GenericBaseRecipe.__init__(self, buildout, name, options)
     options['eggs'] = 'slapos.cookbook'
+    GenericBaseRecipe.__init__(self, buildout, name, options)
     self.slap = slap.slap()
 
     # SLAP related information
@@ -47,15 +47,6 @@ class GenericSlapRecipe(GenericBaseRecipe):
     self.key_file = slap_connection.get('key-file')
     self.cert_file = slap_connection.get('cert-file')
 
-    # setup auto uninstall/install
-    self._setupAutoInstallUninstall()
-
-  def _setupAutoInstallUninstall(self):
-    """By default SlapOS recipes are reinstalled each time"""
-    # Note: It is possible to create in future subclass which will do no-op in
-    # this method
-    self.options['slapos-timestamp'] = str(time.time())
-
   def install(self):
     self.slap.initializeConnection(self.server_url, self.key_file,
         self.cert_file)
diff --git a/slapos/recipe/logrotate.py b/slapos/recipe/logrotate.py
index 9551952d80696883462224718d686139ccfda66e..42959a1c00f38372b45d6fa435e974d78c9d424e 100644
--- a/slapos/recipe/logrotate.py
+++ b/slapos/recipe/logrotate.py
@@ -30,87 +30,55 @@ from slapos.recipe.librecipe import GenericBaseRecipe
 
 class Recipe(GenericBaseRecipe):
 
-  def _options(self, options):
-    if 'name' not in options:
-      options['name'] = self.name
-
   def install(self):
-    path_list = []
-
     logrotate_backup = self.options['backup']
     logrotate_d = self.options['logrotate-entries']
     logrotate_conf_file = self.options['conf']
 
-    logrotate_conf = []
-    logrotate_conf.append("include %s" % logrotate_d)
-    logrotate_conf.append("olddir %s" % logrotate_backup)
-    logrotate_conf.append("dateext")
-
-    frequency = 'daily'
-    if 'frequency' in self.options:
-      frequency = self.options['frequency']
-    logrotate_conf.append(frequency)
-
-    num_rotate = 30
-    if 'num-rotate' in self.options:
-      num_rotate = self.options['num-rotate']
-    logrotate_conf.append("rotate %s" % num_rotate)
-
-    logrotate_conf.append("compress")
-    logrotate_conf.append("compresscmd %s" % self.options['gzip-binary'])
-    logrotate_conf.append("compressoptions -9")
-    logrotate_conf.append("uncompresscmd %s" % self.options['gunzip-binary'])
-
-    logrotate_conf_file = self.createFile(logrotate_conf_file, '\n'.join(logrotate_conf))
-    logrotate_conf.append(logrotate_conf_file)
+    logrotate_conf = [
+      'daily',
+      'dateext',
+      'rotate 3650',
+      'compress',
+      'compresscmd %s' % self.options['gzip-binary'],
+      'compressoptions -9',
+      'uncompresscmd %s' % self.options['gunzip-binary'],
+      'notifempty',
+      'sharedscripts',
+      'create',
+      'include %s' % logrotate_d,
+      'olddir %s' % logrotate_backup,
+    ]
+
+    logrotate_conf_file = self.createFile(logrotate_conf_file, 
+        '\n'.join(logrotate_conf))
 
     state_file = self.options['state-file']
 
     logrotate = self.createPythonScript(
       self.options['wrapper'],
-      'slapos.recipe.librecipe.exceute.execute',
+      'slapos.recipe.librecipe.execute.execute',
       [self.options['logrotate-binary'], '-s', state_file, logrotate_conf_file, ]
     )
-    path_list.append(logrotate)
 
-    return path_list
+    return [logrotate, logrotate_conf_file]
 
 class Part(GenericBaseRecipe):
 
-  def _options(self, options):
-    if 'name' not in options:
-      options['name'] = self.name
-
   def install(self):
 
     logrotate_d = self.options['logrotate-entries']
 
-    part_path = os.path.join(logrotate_d, self.options['name'])
-
     conf = []
 
-    if 'frequency' in self.options:
-      conf.append(self.options['frequency'])
-    if 'num-rotate' in self.options:
-      conf.append('rotate %s' % self.options['num-rotate'])
-
     if 'post' in self.options:
       conf.append("postrotate\n%s\nendscript" % self.options['post'])
     if 'pre' in self.options:
       conf.append("prerotate\n%s\nendscript" % self.options['pre'])
 
-    if self.optionIsTrue('sharedscripts', False):
-      conf.append("sharedscripts")
-
-    if self.optionIsTrue('notifempty', False):
-      conf.append('notifempty')
-
-    if self.optionIsTrue('create', True):
-      conf.append('create')
-
     log = self.options['log']
 
-    self.createFile(os.path.join(logrotate_d, self.options['name']),
+    part_path = self.createFile(os.path.join(logrotate_d, self.options['name']),
                     "%(logfiles)s {\n%(conf)s\n}" % {
                       'logfiles': log,
                       'conf': '\n'.join(conf),
diff --git a/slapos/recipe/mkdirectory.py b/slapos/recipe/mkdirectory.py
index d715da3d5932d5d0ecac8b69813cb47bdc057335..2eebf5579cf013267036fe13630061dd5b25f3cd 100644
--- a/slapos/recipe/mkdirectory.py
+++ b/slapos/recipe/mkdirectory.py
@@ -42,7 +42,7 @@ class Recipe(GenericBaseRecipe):
 
   def install(self):
 
-    for directory in self.directory.values():
+    for directory in sorted(self.directory.values()):
       path = directory
 
       if not os.path.exists(path):
diff --git a/slapos/recipe/mysql/template/my.cnf.in b/slapos/recipe/mysql/template/my.cnf.in
index 2ec7b71ad12fe6ef88665234fe94533989a30d6b..f72db92443fd30d88a15a561d290945ade511608 100644
--- a/slapos/recipe/mysql/template/my.cnf.in
+++ b/slapos/recipe/mysql/template/my.cnf.in
@@ -19,7 +19,7 @@ long_query_time = 5
 max_allowed_packet = 128M
 query_cache_size = 32M
 
-plugin-load = ha_innodb_plugin.so
+plugin-load = ha_groonga.so;ha_sphinx.so
 
 # The following are important to configure and depend a lot on to the size of
 # your database and the available resources.
diff --git a/slapos/recipe/publish.py b/slapos/recipe/publish.py
index e566edc814b7e2e10c43299502836385768d1590..d3813047a035c74cdf00dd7e4de1db2cf7403139 100644
--- a/slapos/recipe/publish.py
+++ b/slapos/recipe/publish.py
@@ -24,6 +24,8 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 ##############################################################################
+import zc.buildout
+
 from slapos.recipe.librecipe import GenericSlapRecipe
 
 class Recipe(GenericSlapRecipe):
@@ -33,7 +35,6 @@ class Recipe(GenericSlapRecipe):
     del options['recipe']
 
     for k, v in options.iteritems():
-      if not k.startswith('slapos-'):
-        publish_dict[k] = v
+      publish_dict[k] = v
     self.setConnectionDict(publish_dict)
     return []
diff --git a/slapos/recipe/request.py b/slapos/recipe/request.py
index 0153b13d29d68f073109e40d2ebda15b519690de..7d9d159b71811d5f132e75b48c41a1241cf5d1f1 100644
--- a/slapos/recipe/request.py
+++ b/slapos/recipe/request.py
@@ -75,13 +75,6 @@ class Recipe(object):
         partition_parameter_kw[config_parameter] = \
             options['config-%s' % config_parameter]
 
-    name = options['name']
-    if 'id' in options:
-      id_ = int(options['id'], 10)
-      if 'id-increment' in options:
-        id_ += int(options['id-increment'], 10)
-      name += '-%03d' % id_
-
     instance = self.request(options['software-url'], software_type,
       name, partition_parameter_kw=partition_parameter_kw,
       filter_kw=filter_kw, shared=self.isSlave)
diff --git a/slapos/recipe/softwaretype.py b/slapos/recipe/softwaretype.py
index 42db59e0b4ead1f6bcf8e6b5d338a347c752aa97..43ff451f1e8a30c1dfba1b107f22abdb8ed7d655 100644
--- a/slapos/recipe/softwaretype.py
+++ b/slapos/recipe/softwaretype.py
@@ -89,8 +89,8 @@ class Recipe:
     instance_file_path = self.options[software_type]
 
     if not os.path.exists(instance_file_path):
-      raise zc.buildout.UserError("The specified buildout config file does not "
-                                  "exist.")
+      raise zc.buildout.UserError("The specified buildout config file %r does "
+                                  "not exist." % instance_file_path)
 
     buildout = ConfigParser()
     with open(instance_file_path) as instance_path:
@@ -98,7 +98,8 @@ class Recipe:
 
     buildout.set('buildout', 'installed', '.installed-%s.cfg' % self.name)
 
-    buildout.add_section('slap-parameter')
+    if not buildout.has_section('slap-parameter'):
+      buildout.add_section('slap-parameter')
     for parameter, value in self.parameter_dict.items():
       if isinstance(value, str):
         buildout.set('slap-parameter', parameter, value)
@@ -120,7 +121,7 @@ class Recipe:
     work_directory = os.path.abspath(self.buildout['buildout'][
       'directory'])
     buildout_filename = os.path.join(work_directory,
-                                     'buildout-%s.cfg' % software_type)
+                                     'buildout-%s.cfg' % self.name)
     with open(buildout_filename, 'w') as buildout_file:
       buildout.write(buildout_file)
 
diff --git a/slapos/recipe/sphinx/__init__.py b/slapos/recipe/sphinx/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..2dd2eee1ff8a41f62c8c266e52c55f3c1b47af89
--- /dev/null
+++ b/slapos/recipe/sphinx/__init__.py
@@ -0,0 +1,58 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+from slapos.recipe.librecipe import GenericBaseRecipe
+
+class Recipe(GenericBaseRecipe):
+
+  def install(self):
+
+    # Configuration file
+    config = dict(
+      data_directory=self.options['data-directory'],
+      ip_address=self.options['ip'],
+      port=self.options['sphinx-port'],
+      sql_port=self.options['sql-port'],
+      searchd_log=self.options['searchd-log'],
+      query_log=self.options['query-log'],
+      pid=self.options['pid'],
+      )
+    sphinx_conf_path = self.createFile(
+        self.options['configuration-file'], 
+        self.substituteTemplate(self.getTemplateFilename('sphinx.conf.in'),
+          config)
+    )
+
+    # Create init script
+    wrapper = self.createPythonScript(
+        self.options['wrapper'], 
+        'slapos.recipe.librecipe.execute.execute', 
+        [self.options['sphinx-searchd-binary'].strip(), '-c',
+         sphinx_conf_path, '--nodetach'],
+        )
+
+    return [wrapper, sphinx_conf_path]
diff --git a/slapos/recipe/erp5/template/sphinx.conf.in b/slapos/recipe/sphinx/template/sphinx.conf.in
similarity index 99%
rename from slapos/recipe/erp5/template/sphinx.conf.in
rename to slapos/recipe/sphinx/template/sphinx.conf.in
index 984c4b0b605b35009678dc07dfea2ac2f052934e..3e83ec492f044382eaf684f4f824ca5a6a6d4869 100644
--- a/slapos/recipe/erp5/template/sphinx.conf.in
+++ b/slapos/recipe/sphinx/template/sphinx.conf.in
@@ -389,7 +389,7 @@ index erp5
 	#
 	# ondisk_dict		= 1
 
-	# whether to enable in-place inversion (2x less disk, 90-95% speed)
+	# whether to enable in-place inversion (2x less disk, 90-95%% speed)
 	# optional, default is 0 (use separate temporary files), indexer-only
 	#
 	# inplace_enable		= 1
@@ -460,11 +460,11 @@ searchd
 
 	# log file, searchd run info is logged here
 	# optional, default is 'searchd.log'
-	log			= %(log_directory)s/sphinx-searchd.log
+	log			= %(searchd_log)s
 
 	# query log file, all search queries are logged here
 	# optional, default is empty (do not log queries)
-	query_log		= %(log_directory)s/sphinx-query.log
+	query_log		= %(query_log)s
 
 	# client read timeout, seconds
 	# optional, default is 5
@@ -480,7 +480,7 @@ searchd
 
 	# PID file, searchd process ID file name
 	# mandatory
-	pid_file		= %(data_directory)s/sphinx-searchd.pid
+	pid_file		= %(pid)s
 
 	# max amount of matches the daemon ever keeps in RAM, per-index
 	# WARNING, THERE'S ALSO PER-QUERY LIMIT, SEE SetLimits() API CALL
@@ -524,7 +524,7 @@ searchd
 	# searchd will (try to) log crashed query to 'crash_log_path.PID' file
 	# optional, default is empty (do not create crash logs)
 	#
-	# crash_log_path		= %(log_directory)s
+	# crash_log_path		= (log_directory)
 
 	# max allowed per-query filter count
 	# optional, default is 256
diff --git a/slapos/recipe/download.py b/slapos/recipe/symbolic_link.py
similarity index 50%
rename from slapos/recipe/download.py
rename to slapos/recipe/symbolic_link.py
index e5a602a77fd7341d27d2136ab6f9482f4bf4935f..2bcc01d6fd6be7f54342ccc4f3360f7041684c5b 100644
--- a/slapos/recipe/download.py
+++ b/slapos/recipe/symbolic_link.py
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsibility of assessing all potential
@@ -26,47 +26,31 @@
 ##############################################################################
 import os
 import logging
-import shutil
-import zc.buildout
+
 class Recipe:
   def __init__(self, buildout, name, options):
     self.buildout = buildout
     self.name = name
     self.options = options
     self.logger = logging.getLogger(self.name)
-    if 'filename' in self.options and 'destination' in self.options:
-      raise zc.buildout.UserError('Parameters filename and destination are '
-          'exclusive.')
-    self.parts = None
-    self.destination = self.options.get('destination', None)
-    if self.destination is None:
-      self.parts = os.path.join(self.buildout['buildout']['parts-directory'],
-          self.name)
-      self.destination = os.path.join(self.parts, self.options.get('filename',
-        self.name))
-    options['target'] = self.destination
 
   def install(self):
-    if self.parts is not None:
-      if not os.path.isdir(self.parts):
-        os.mkdir(self.parts)
-    download = zc.buildout.download.Download(self.buildout['buildout'],
-        hash_name=True)
-    path, is_temp = download(self.options['url'],
-        md5sum=self.options.get('md5sum'))
-    if os.path.exists(self.destination):
-      os.unlink(self.destination)
-    shutil.copy(path, self.destination)
-    mode = self.options.get('mode')
-    if mode is not None:
-      mode = int(mode, 8)
-      os.chmod(self.destination, mode)
-      self.logger.debug('Mode of %r set to 0%o.' % (self.destination, mode))
-    self.logger.debug('Downloaded %r and saved to %r.' % (self.options['url'],
-      self.destination))
-    if self.parts is not None:
-      return [self.parts]
-    else:
-      return []
+    """
+    Links binaries to instance's bin directory for easier exposal
+    """
+    path_list = []
+    target_directory = self.options['target-directory']
+    for linkline in self.options['link-binary'].split():
+      path, linkname = os.path.split(linkline)
+
+      link = os.path.join(target_directory, linkname)
+      if os.path.lexists(link):
+        if not os.path.islink(link):
+          raise zc.buildout.UserError(
+              'Target link already %r exists but it is not link' % link)
+        os.unlink(link)
+      os.symlink(linkline, link)
+      self.logger.debug('Created link %r -> %r' % (link, linkline))
+      path_list.append(link)
 
-  update = install
+    return path_list
diff --git a/slapos/recipe/tidstorage/__init__.py b/slapos/recipe/tidstorage/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..a5e33741d332dcdc4aeb073a54b986bb537541b3
--- /dev/null
+++ b/slapos/recipe/tidstorage/__init__.py
@@ -0,0 +1,41 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+import os
+from slapos.recipe.librecipe import GenericBaseRecipe
+
+class Recipe(GenericBaseRecipe):
+  def install(self):
+    path_list = []
+    a = path_list.append
+    configuration_file = self.createFile(self.options['configuration-path'], self.substituteTemplate(self.getTemplateFilename('tidstorage.py.in'), self.options))
+    a(configuration_file)
+    tidstorage_wrapper = self.createPythonScript(self.options['tidstorage-wrapper'], 'slapos.recipe.librecipe.execute.execute', [self.options['tidstoraged-binary'], '--nofork', '--config', configuration_file])
+    a(tidstorage_wrapper)
+    repozo_wrapper = self.createPythonScript(self.options['repozo-wrapper'], 'slapos.recipe.librecipe.execute.execute', [self.options['tidstorage-repozo-binary'], '--config', configuration_file, '--repozo', self.options['repozo-binary'], '-z'])
+    a(repozo_wrapper)
+
+    return path_list
diff --git a/slapos/recipe/tidstorage/template/tidstorage.py.in b/slapos/recipe/tidstorage/template/tidstorage.py.in
new file mode 100644
index 0000000000000000000000000000000000000000..819e58d3b5c7f09a6cc12856507fc23e83069727
--- /dev/null
+++ b/slapos/recipe/tidstorage/template/tidstorage.py.in
@@ -0,0 +1,15 @@
+known_tid_storage_identifier_dict = %(known-tid-storage-identifier-dict)s
+base_url = '%(base-url)s'
+address = '%(ip)s'
+port = %(port)s
+
+#fork = False
+#setuid = None
+#setgid = None
+burst_period = 30
+full_dump_period = 300
+
+timestamp_file_path = '%(timestamp-file-path)s'
+logfile_name = '%(logfile-name)s'
+pidfile_name = '%(pidfile-name)s'
+status_file = '%(status-file)s'
diff --git a/slapos/recipe/vifib.py b/slapos/recipe/vifib.py
index 55ec2243b508aeb3e05114585825ca9e0e59f59d..7bd11b6bac0eec2e3318a84438f6d7989ef8c859 100644
--- a/slapos/recipe/vifib.py
+++ b/slapos/recipe/vifib.py
@@ -147,7 +147,10 @@ class Recipe(slapos.recipe.erp5.Recipe):
         conversion_server_conf,
       # as installERP5Site is not trusted (yet) and this recipe is production
       # ready expose more information
-      mysql_url='%(mysql_database)s@%(ip)s:%(tcp_port)s %(mysql_user)s %(mysql_password)s' % mysql_conf,
+      # XXX Use socket access to prevent unwanted connections to original MySQL
+      #     server when cloning an existing ERP5 instance.
+      #     TCP will be required if MySQL is in a different partition/server.
+      mysql_url='%(mysql_database)s %(mysql_user)s %(mysql_password)s %(socket)s' % mysql_conf,
     ))
     return self.path_list
 
@@ -200,7 +203,10 @@ class Recipe(slapos.recipe.erp5.Recipe):
         conversion_server_conf,
       # as installERP5Site is not trusted (yet) and this recipe is production
       # ready expose more information
-      mysql_url='%(mysql_database)s@%(ip)s:%(tcp_port)s %(mysql_user)s %(mysql_password)s' % mysql_conf,
+      # XXX Use socket access to prevent unwanted connections to original MySQL
+      #     server when cloning an existing ERP5 instance.
+      #     TCP will be required if MySQL is in a different partition/server.
+      mysql_url='%(mysql_database)s %(mysql_user)s %(mysql_password)s %(socket)s' % mysql_conf,
     ))
     return self.path_list
 
diff --git a/slapos/recipe/waitfor.py b/slapos/recipe/waitfor.py
new file mode 100644
index 0000000000000000000000000000000000000000..80706f672b06104b2ad5cd493f91ad89984c5848
--- /dev/null
+++ b/slapos/recipe/waitfor.py
@@ -0,0 +1,42 @@
+##############################################################################
+#
+# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+import shlex
+
+from slapos.recipe.librecipe import GenericBaseRecipe
+
+class Recipe(GenericBaseRecipe):
+
+  def install(self):
+    files = [f for f in self.options['files'].split('\n') if f]
+    command_line = shlex.split(self.options['command-line'])
+    wrapper = self.createPythonScript(
+      self.options['wrapper'],
+      'slapos.recipe.librecipe.execute.execute_wait',
+      [ command_line,
+        files ],
+    )
+    return [wrapper]
diff --git a/slapos/recipe/xwiki/template/my.cnf.in b/slapos/recipe/xwiki/template/my.cnf.in
index 09171fb6d9837199f4030f574791df31c251dc54..00eb280232a8e41206dccdca6be7fe15e58a1591 100644
--- a/slapos/recipe/xwiki/template/my.cnf.in
+++ b/slapos/recipe/xwiki/template/my.cnf.in
@@ -15,58 +15,39 @@ socket = %(socket)s
 datadir = %(data_directory)s
 pid-file = %(pid_file)s
 log-error = %(error_log)s
-log-slow-queries = %(slow_query_log)s
+slow_query_log
+slow_query_log_file = %(slow_query_log)s
 long_query_time = 5
-skip-locking
-key_buffer = 384M
 max_allowed_packet = 128M
-table_cache = 512
-sort_buffer_size = 2M
-read_buffer_size = 2M
-read_rnd_buffer_size = 8M
-myisam_sort_buffer_size = 64M
-thread_cache_size = 8
 query_cache_size = 32M
-# Try number of CPU's*2 for thread_concurrency
-thread_concurrency = 8
 
-# Replication Master Server (default)
-# binary logging is required for replication
-log-bin=mysql-bin
+plugin-load = ha_groonga.so;ha_sphinx.so
 
-# required unique id between 1 and 2^32 - 1
-# defaults to 1 if master-host is not set
-# but will not function as a master if omitted
-server-id	= 1
+# The following are important to configure and depend a lot on to the size of
+# your database and the available resources.
+#innodb_buffer_pool_size = 4G
+#innodb_log_file_size = 256M
+#innodb_log_buffer_size = 8M
+
+# Some dangerous settings you may want to uncomment if you only want
+# performance or less disk access. Useful for unit tests.
+#innodb_flush_log_at_trx_commit = 0
+#innodb_flush_method = nosync
+#innodb_doublewrite = 0
+#sync_frm = 0
+
+# Uncomment the following if you need binary logging, which is recommended
+# on production instances (either for replication or incremental backups).
+#log-bin=mysql-bin
 
 # Force utf8 usage
 collation_server = utf8_unicode_ci
 character_set_server = utf8
-default-character-set = utf8
 skip-character-set-client-handshake
 
-[mysqldump]
-quick
-max_allowed_packet = 16M
-
 [mysql]
 no-auto-rehash
-# Remove the next comment character if you are not familiar with SQL
-#safe-updates
 socket = %(socket)s
 
-[isamchk]
-key_buffer = 256M
-sort_buffer_size = 256M
-read_buffer = 2M
-write_buffer = 2M
-
-[myisamchk]
-key_buffer = 256M
-sort_buffer_size = 256M
-read_buffer = 2M
-write_buffer = 2M
-
 [mysqlhotcopy]
 interactive-timeout
-
diff --git a/slapos/recipe/zeo/__init__.py b/slapos/recipe/zeo/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..45b0ab090feb0684e3f70dd8386e502c093914a6
--- /dev/null
+++ b/slapos/recipe/zeo/__init__.py
@@ -0,0 +1,92 @@
+##############################################################################
+#
+# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+from slapos.recipe.librecipe import GenericBaseRecipe
+import os
+
+class Recipe(GenericBaseRecipe):
+  """
+  ZEO instance configuration.
+
+  wrapper-path -- location of the init script to generate
+
+  binary-path -- location of the runzeo command
+
+  ip -- ip of the zeo server
+
+  port -- port of the zeo server
+
+  log-path -- location of the log file
+
+  pid-path -- location of the pid file
+
+  conf-path -- location of the configuration file
+
+  zodb-path -- location of the zodb directory (which contains all storage)
+
+  storage -- string with list of all resquested storage
+    Example: event_module person_module
+  """
+
+  def install(self):
+    snippet_filename = self.getTemplateFilename(
+                                    'zeo-filestorage-snippet.conf.in')
+    # Prepare all filestorages
+    filestorage_snippet = ""
+    for storage_definition in self.options['storage'].splitlines():
+      storage_definition = storage_definition.strip()
+      if not storage_definition:
+        continue
+      for q in storage_definition.split():
+        if 'storage-name' in q:
+          storage_name = q.split('=')[1].strip()
+        if 'zodb-path' in q:
+          zodb_path = q.split('=')[1].strip()
+      filestorage_snippet += self.substituteTemplate(
+          snippet_filename, dict(storage_name=storage_name, path=zodb_path))
+
+    config = dict(
+      zeo_ip=self.options['ip'],
+      zeo_port=self.options['port'],
+      zeo_event_log=self.options['log-path'],
+      zeo_pid=self.options['pid-path'],
+      zeo_filestorage_snippet=filestorage_snippet,
+    )
+
+    # Create configuration file
+    template_filename = self.getTemplateFilename('zeo.conf.in')
+    configuration_path = self.createFile(
+        self.options['conf-path'],
+        self.substituteTemplate(template_filename, config))
+
+    # Create running wrapper
+    wrapper_path = self.createPythonScript(
+      self.options['wrapper-path'],
+      'slapos.recipe.librecipe.execute.execute',
+      arguments=[self.options['binary-path'].strip(), '-C',
+        self.options['conf-path']],)
+
+    return [configuration_path, wrapper_path]
diff --git a/slapos/recipe/zeo/template/zeo-filestorage-snippet.conf.in b/slapos/recipe/zeo/template/zeo-filestorage-snippet.conf.in
new file mode 100644
index 0000000000000000000000000000000000000000..39c5337f852a1c09c71fdf4fb15c001b076bafad
--- /dev/null
+++ b/slapos/recipe/zeo/template/zeo-filestorage-snippet.conf.in
@@ -0,0 +1,4 @@
+<filestorage %(storage_name)s>
+  path %(path)s
+</filestorage>
+
diff --git a/slapos/recipe/erp5/template/zeo.conf.in b/slapos/recipe/zeo/template/zeo.conf.in
similarity index 100%
rename from slapos/recipe/erp5/template/zeo.conf.in
rename to slapos/recipe/zeo/template/zeo.conf.in
diff --git a/software/MediaWiki/instance.cfg b/software/MediaWiki/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/MediaWiki/instance.cfg
+++ b/software/MediaWiki/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/MediaWiki/software.cfg b/software/MediaWiki/software.cfg
index 80fd48c2083d807d336b0fa8eebca38c110d41ce..ce4ea20292528b74b86ba8fc54d12a61430e90de 100644
--- a/software/MediaWiki/software.cfg
+++ b/software/MediaWiki/software.cfg
@@ -19,35 +19,20 @@ extends =
 [mediawiki-patch]
 recipe = slapos.recipe.download
 url = ${:_profile_base_location_}/patch/mediawiki-1.17.0.config.patch
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
+md5sum = fd606666ac9fc54cb84cda8cf08edef4
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
 filename = mediawiki-1.17.0.config.patch
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://download.wikimedia.org/mediawiki/1.17/mediawiki-1.17.0.tar.gz
 md5sum = 871a00a8eb6dcae1b7b654ae635af7cd
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
 
 [patch]
 recipe = iw.recipe.cmd
 on_install = true
 on_update = true
 cmds= patch -d ${application:location} -p1 < ${mediawiki-patch:location}/${mediawiki-patch:filename}
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/mediawiki.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -70,6 +55,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/MediaWiki/template/mediawiki.inc.php.in b/software/MediaWiki/template/mediawiki.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/MediaWiki/template/mediawiki.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/SilverStripe/instance.cfg b/software/SilverStripe/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/SilverStripe/instance.cfg
+++ b/software/SilverStripe/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/SilverStripe/software.cfg b/software/SilverStripe/software.cfg
index 415704635a9fb5b9ad82ca763f33dd2480db3bd1..7e5304716775acefe228e31dba6df392ba351b07 100644
--- a/software/SilverStripe/software.cfg
+++ b/software/SilverStripe/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://www.silverstripe.org/assets/downloads/SilverStripe-v2.4.5.tar.gz
 md5sum = de6ab0146c27bbc72287670e0697e2ba
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/silverstripe.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +39,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/SilverStripe/template/silverstripe.inc.php.in b/software/SilverStripe/template/silverstripe.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/SilverStripe/template/silverstripe.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/b2evolution/instance.cfg b/software/b2evolution/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/b2evolution/instance.cfg
+++ b/software/b2evolution/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/b2evolution/software.cfg b/software/b2evolution/software.cfg
index 6d1d82860ced6c8c731224758636a948cda377f1..b86740c1c4ea5658bfbe00d364a9276d944eca9f 100644
--- a/software/b2evolution/software.cfg
+++ b/software/b2evolution/software.cfg
@@ -14,26 +14,10 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = slapos.recipe.build
+recipe = slapos.recipe.build:download-unpacked
 url = http://freefr.dl.sourceforge.net/project/evocms/b2evolution/b2evo%204.1.1-stable/b2evolution-4.1.1-stable-2011-10-03.zip
 md5sum = 63c771f43f0c40ff822fe80234be42e1
-script =
-  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
-  extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
-  workdir = guessworkdir(extract_dir)
-  self.copyTree(workdir + "/blogs", "${buildout:parts-directory}/${:_buildout_section_name_}")
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/b2evolution.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
+extract-directory = blogs
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -56,6 +40,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.6
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/b2evolution/template/b2evolution.inc.php.in b/software/b2evolution/template/b2evolution.inc.php.in
deleted file mode 100644
index 0c39feef34495c81a59b87d10398294b24c402c0..0000000000000000000000000000000000000000
--- a/software/b2evolution/template/b2evolution.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = 'Put here mysql host template key';
-$cfg['Servers'][$i]['port'] = 'Put here mysql port template key';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/cmsmadesimple/instance.cfg b/software/cmsmadesimple/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/cmsmadesimple/instance.cfg
+++ b/software/cmsmadesimple/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/cmsmadesimple/software.cfg b/software/cmsmadesimple/software.cfg
index 3b7ca282f218478945ea5b90f9862d770faa427f..73257ebe0ebec3eb488df7056249b4369db01b63 100644
--- a/software/cmsmadesimple/software.cfg
+++ b/software/cmsmadesimple/software.cfg
@@ -11,26 +11,12 @@ parts =
   
 extends =
   ../../stack/lamp.cfg
-  ../../shacache-client.cfg
+  ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://s3.amazonaws.com/cmsms/downloads/7908/cmsmadesimple-1.9.4.3-english.tar.gz
-#md5sum = Student may put here md5sum of this file, this is good idea
-#If provided tarball does not contain top directory, option shall be changed to false
-strip-top-level-dir = false
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/cssmadesimple.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
+md5sum = b018842f195a20e50359b18c585f4d64
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +39,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/cmsmadesimple/template/cssmadesimple.inc.php.in b/software/cmsmadesimple/template/cssmadesimple.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/cmsmadesimple/template/cssmadesimple.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/coppermine/software.cfg b/software/coppermine/software.cfg
index d18744c8098d1dd9a9e14c9cf815b41447489fdf..9015271578faa8a2223c49ebea523da89e2aadbe 100644
--- a/software/coppermine/software.cfg
+++ b/software/coppermine/software.cfg
@@ -14,17 +14,14 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://freefr.dl.sourceforge.net/project/coppermine/Coppermine/1.5.x/cpg1.5.16.zip
 md5sum = 76402aea7821aaaf67c571869373186e
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
 
 [application-template]
 recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/coppermine.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
+url = ${:_profile_base_location_}/template/coppermine.inc.php.in
+md5sum = c97345b7f3c060b825e1925e2be3c2c1
 filename = template.in
 mode = 0644
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
@@ -53,6 +50,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
@@ -64,4 +139,3 @@ download-cache = ${buildout:directory}/downloads
 command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
 update-command = ${:command}
 stop-on-error = True
-
diff --git a/software/dotclear/software.cfg b/software/dotclear/software.cfg
index a7fd4704c153fb22349e7f9b559ae723f828d786..6073970352dc4fa4117421d638a334d9d4e3459f 100644
--- a/software/dotclear/software.cfg
+++ b/software/dotclear/software.cfg
@@ -14,17 +14,14 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://download.dotclear.net/latest-2.0.tar.gz
 md5sum = 98263b4734f93b7c54d3ab436bf344e3
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
 
 [application-template]
 recipe = slapos.recipe.download
 url = ${:_profile_base_location_}/template/dotclear.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
+md5sum = c97345b7f3c060b825e1925e2be3c2c1
 filename = template.in
 mode = 0644
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
@@ -53,6 +50,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/dotproject/software.cfg b/software/dotproject/software.cfg
index f3aab2a07897961dba3569023fb96bae8f5b384f..326015dc5f9d4205ab24be2e22f1c5290d0b39b7 100644
--- a/software/dotproject/software.cfg
+++ b/software/dotproject/software.cfg
@@ -14,23 +14,20 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://downloads.sourceforge.net/project/dotproject/dotproject/dotProject%20Version%202.1.5/dotproject-2.1.5.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fdotproject%2F&ts=1315317307&use_mirror=freefr
 md5sum = d283fad3fc541e7ffda07151efc64bf8
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
 
 [application-template]
 recipe = slapos.recipe.download
 url = ${:_profile_base_location_}/template/config.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
+md5sum = b78545a6928978c5990021ac68e26be0
 filename = template.in
 mode = 0644
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
 
 [application-configuration]
-location = config.inc.php
+location = config.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +50,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/drupal/instance.cfg b/software/drupal/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/drupal/instance.cfg
+++ b/software/drupal/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/drupal/software.cfg b/software/drupal/software.cfg
index f956809838832233580ec142b09b8f1024e84cd7..36d69b39597798785e9bbd647886d8a4fba4c942 100644
--- a/software/drupal/software.cfg
+++ b/software/drupal/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://ftp.drupal.org/files/projects/drupal-7.8.tar.gz
 md5sum = e0226b56e8d5c57c6b126e8ed5866b1f
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/config.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +39,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/drupal/template/config.inc.php.in b/software/drupal/template/config.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/drupal/template/config.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/eSKUeL/instance.cfg b/software/eSKUeL/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/eSKUeL/instance.cfg
+++ b/software/eSKUeL/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/eSKUeL/software.cfg b/software/eSKUeL/software.cfg
index c8e1f7eafbfa019980b18e82a0157cd4c2abbbb0..07f9b57f774b1a727b898bdc5a60a39d18100672 100644
--- a/software/eSKUeL/software.cfg
+++ b/software/eSKUeL/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://www.phptools4u.com/generated_content/download/eskuel.zip
 md5sum = c91f6f238be715f303911dd00f281b78
-#If provided tarball does not contain top directory, option shall be changed to false
-strip-top-level-dir = false
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/eskuel.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +39,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.6
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/eSKUeL/template/eskuel.inc.php.in b/software/eSKUeL/template/eskuel.inc.php.in
deleted file mode 100644
index 0c39feef34495c81a59b87d10398294b24c402c0..0000000000000000000000000000000000000000
--- a/software/eSKUeL/template/eskuel.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = 'Put here mysql host template key';
-$cfg['Servers'][$i]['port'] = 'Put here mysql port template key';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/erp5/instance-cloudooo.cfg b/software/erp5/instance-cloudooo.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..894530fedcc465a91daec84323bce93b42c57482
--- /dev/null
+++ b/software/erp5/instance-cloudooo.cfg
@@ -0,0 +1,61 @@
+[buildout]
+parts =
+  publish-cloudooo-connection-information
+  cloudooo-instance
+
+eggs-directory = ${buildout:eggs-directory}
+develop-eggs-directory = ${buildout:develop-eggs-directory}
+offline = true
+
+[publish-cloudooo-connection-information]
+recipe = slapos.cookbook:publishurl
+url = cloudooo://$${cloudooo-instance:ip}:$${cloudooo-instance:port}/
+
+[cloudooo-instance]
+recipe = slapos.cookbook:generic.cloudooo
+
+# Network options
+ip = $${slap-network-information:local-ipv4}
+port = 23000
+openoffice-port = 23060
+
+# Paths
+configuration-file = $${rootdirectory:etc}/cloudooo.cfg
+wrapper = $${basedirectory:services}/cloudooo
+
+# Paths: Data
+data-directory = $${directory:cloudooo-data}
+
+environment =
+  LD_LIBRARY_PATH = ${file:location}/lib:${fontconfig:location}/lib:${freetype:location}/lib:${libICE:location}/lib:${libSM:location}/lib:${libX11:location}/lib:${libXau:location}/lib:${libXdmcp:location}/lib:${libXext:location}/lib:${libXinerama:location}/lib:${libxcb:location}/lib:${zlib:location}/lib
+  FONTCONFIG_FILE = $${fontconfig-instance:conf-path}
+
+# Binary information
+# cloudooo specific configuration
+ooo-binary-path = ${libreoffice-bin:location}/program
+ooo-paster = ${buildout:bin-directory}/cloudooo_paster
+ooo-uno-path = ${libreoffice-bin:location}/basis-link/program
+
+[fontconfig-instance]
+recipe = slapos.cookbook:fontconfig
+conf-path = $${rootdirectory:etc}/font.conf
+font-system-folder = ${fonts:location}
+font-folder = $${directory:font}
+url-list = $${dynamic-fontconfig-instance:url-list}
+service-folder = $${basedirectory:services}
+onetimedownload_path = ${buildout:bin-directory}/onetimedownload
+
+# rest of parts are candidates for some generic stuff
+[basedirectory]
+recipe = slapos.cookbook:mkdirectory
+services = $${rootdirectory:etc}/run
+
+[directory]
+recipe = slapos.cookbook:mkdirectory
+cloudooo-data = $${rootdirectory:srv}/cloudooo
+font = $${rootdirectory:srv}/font
+
+[rootdirectory]
+recipe = slapos.cookbook:mkdirectory
+etc = $${buildout:directory}/etc
+srv = $${buildout:directory}/srv
diff --git a/software/erp5/instance-erp5-development.cfg b/software/erp5/instance-erp5-development.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..605342eb6a45dfb5b150b347c8fb7bdc7fcb1a6b
--- /dev/null
+++ b/software/erp5/instance-erp5-development.cfg
@@ -0,0 +1,129 @@
+#############################
+#
+# Request erp5 development environnment
+#
+#############################
+[buildout]
+
+extends = ${template-zope:output}
+parts +=
+  request-mariadb
+  request-cloudooo
+  request-memcached
+  request-kumofs
+  basedirectory
+  erp5-update
+  test-runner
+
+eggs-directory = ${buildout:eggs-directory}
+develop-eggs-directory = ${buildout:develop-eggs-directory}
+offline = true
+
+[slap-parameter]
+# default site id
+site-id = erp5
+cloudooo-json =
+
+[test-runner]
+recipe = slapos.cookbook:erp5.test
+certificate-authority-path = $${test-certificate-authority:ca-dir}
+mysql-url = $${request-mariadb:connection-url}
+kumofs-url = $${request-kumofs:connection-url}
+memcached-url = $${request-memcached:connection-url}
+cloudooo-url = $${request-cloudooo:connection-url}
+test-instance-path = $${directory:unit-test-path}
+
+prepend-path = $${buildout:bin-directory}
+run-unit-test = $${buildout:bin-directory}/runUnitTest
+run-test-suite = $${buildout:bin-directory}/runTestSuite
+
+openssl-binary = $${test-certificate-authority:openssl-binary}
+run-unit-test-binary = ${buildout:bin-directory}/runUnitTest
+run-test-suite-binary = ${buildout:bin-directory}/runTestSuite
+
+[test-certificate-authority]
+recipe = slapos.cookbook:certificate_authority
+openssl-binary = ${openssl:location}/bin/openssl
+ca-dir = $${directory:test-ca-dir}
+requests-directory = $${test-cadirectory:requests}
+wrapper = $${basedirectory:services}/test-ca
+ca-private = $${test-cadirectory:private}
+ca-certs = $${test-cadirectory:certs}
+ca-newcerts = $${test-cadirectory:newcerts}
+ca-crl = $${test-cadirectory:crl}
+
+[test-cadirectory]
+recipe = slapos.cookbook:mkdirectory
+requests = $${directory:test-ca-dir}/requests/
+private = $${directory:test-ca-dir}/private/
+certs = $${directory:test-ca-dir}/certs/
+newcerts = $${directory:test-ca-dir}/newcerts/
+crl = $${directory:test-ca-dir}/crl/
+
+[erp5-update]
+recipe = slapos.cookbook:erp5.update
+
+# Configuration
+url = http://$${zope-instance:user}:$${zope-instance:password}@$${zope-instance:ip}:$${zope-instance:port}/
+mysql-url = $${request-mariadb:connection-url}
+kumofs-url = $${request-kumofs:connection-url}
+memcached-url = $${request-memcached:connection-url}
+cloudooo-url = $${request-cloudooo:connection-url}
+site-id = $${slap-parameter:site-id}
+openssl-binary = ${openssl:location}/bin/openssl
+cadir-path = $${erp5-certificate-authority:ca-dir}
+
+# Paths
+update-wrapper = $${basedirectory:services}/erp5-update
+
+# Defaults
+configurator-bt5-list = erp5_full_text_myisam_catalog erp5_configurator_standard erp5_configurator_maxma_demo erp5_configurator_ung erp5_configurator_ung erp5_configurator_run_my_doc
+bt5-repository-list = $${zope-instance:bt5-repository-list}
+
+[request-common]
+recipe = slapos.cookbook:request
+software-url = $${slap-connection:software-release-url}
+sla = computer_guid
+sla-computer_guid = $${slap-connection:computer-id}
+return = url
+server-url = $${slap-connection:server-url}
+key-file = $${slap-connection:key-file}
+cert-file = $${slap-connection:cert-file}
+computer-id = $${slap-connection:computer-id}
+partition-id = $${slap-connection:partition-id}
+
+[request-mariadb]
+<=request-common
+name = MariaDB DataBase
+software-type = mariadb
+
+[request-cloudooo]
+<=request-common
+name = Cloudooo
+config = cloudooo-json
+config-cloudooo-json = $${slap-parameter:cloudooo-json}
+software-type = cloudooo
+
+[request-memcached]
+<=request-common
+name = Memcached
+software-type = memcached
+
+[request-kumofs]
+<=request-common
+name = KumoFS
+software-type = kumofs
+
+# rest of parts are candidates for some generic stuff
+[basedirectory]
+recipe = slapos.cookbook:mkdirectory
+services = $${rootdirectory:etc}/run/
+
+[rootdirectory]
+recipe = slapos.cookbook:mkdirectory
+etc = $${buildout:directory}/etc/
+
+[directory]
+test-ca-dir = $${rootdirectory:srv}/test-ca/
+test-instance-path = $${rootdirectory:srv}/test-instance/
+unit-test-path = $${:test-instance-path}/unit_test/
diff --git a/software/erp5/instance-erp5-production.cfg b/software/erp5/instance-erp5-production.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..eeffa9b4ed73e5f8560d665ba088b15a5be436c7
--- /dev/null
+++ b/software/erp5/instance-erp5-production.cfg
@@ -0,0 +1,79 @@
+#############################
+#
+# Request erp5 production environnment
+#
+#############################
+[buildout]
+
+parts =
+  request-mariadb
+  request-sphinx
+  request-cloudooo
+  request-memcached
+  request-kumofs
+  request-tidstorage
+  basedirectory
+
+eggs-directory = ${buildout:eggs-directory}
+develop-eggs-directory = ${buildout:develop-eggs-directory}
+offline = true
+
+[request-common]
+recipe = slapos.cookbook:request
+software-url = $${slap-connection:software-release-url}
+sla = computer_guid
+sla-computer_guid = $${slap-connection:computer-id}
+return = url
+server-url = $${slap-connection:server-url}
+key-file = $${slap-connection:key-file}
+cert-file = $${slap-connection:cert-file}
+computer-id = $${slap-connection:computer-id}
+partition-id = $${slap-connection:partition-id}
+
+[request-sphinx]
+<=request-common
+name = Sphinx Search Engine
+software-type = sphinx
+
+[request-mariadb]
+<=request-common
+name = MariaDB DataBase
+software-type = mariadb
+
+[request-cloudooo]
+<=request-common
+name = Cloudooo
+config = cloudooo-json
+config-cloudooo-json = $${slap-parameter:cloudooo-json}
+software-type = cloudooo
+
+[request-memcached]
+<=request-common
+name = Memcached
+software-type = memcached
+
+[request-kumofs]
+<=request-common
+name = KumoFS
+software-type = kumofs
+
+[request-tidstorage]
+<=request-common
+name = TidStorage
+return = url-login
+config = json mysql-url memcached-url cloudooo-url kumofs-url
+config-json = $${slap-parameter:json}
+config-mysql-url = $${request-mariadb:connection-url}
+config-memcached-url = $${request-memcached:connection-url}
+config-cloudooo-url = $${request-cloudooo:connection-url}
+config-kumofs-url = $${request-kumofs:connection-url}
+software-type = tidstorage
+
+# rest of parts are candidates for some generic stuff
+[basedirectory]
+recipe = slapos.cookbook:mkdirectory
+services = $${rootdirectory:etc}/run
+
+[rootdirectory]
+recipe = slapos.cookbook:mkdirectory
+etc = $${buildout:directory}/etc
diff --git a/software/erp5/instance-kumofs.cfg b/software/erp5/instance-kumofs.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..b8b49dd4a64af53ee50e4d1e8922c3c8a5c5831c
--- /dev/null
+++ b/software/erp5/instance-kumofs.cfg
@@ -0,0 +1,111 @@
+[buildout]
+parts =
+  publish-kumofs-connection-information
+  kumofs-instance
+  logrotate
+  logrotate-entry-kumofs
+  cron
+  cron-entry-logrotate
+
+eggs-directory = ${buildout:eggs-directory}
+develop-eggs-directory = ${buildout:develop-eggs-directory}
+offline = true
+
+[publish-kumofs-connection-information]
+recipe = slapos.cookbook:publishurl
+url = memcached://$${kumofs-instance:ip}:$${kumofs-instance:gateway-port}/
+
+[kumofs-instance]
+recipe = slapos.cookbook:generic.kumofs
+
+# Network options
+ip = $${slap-network-information:local-ipv4}
+manager-port = 13101
+server-port = 13201
+server-listen-port = 13202
+gateway-port = 13301
+
+# Paths: Running wrappers
+gateway-wrapper = $${basedirectory:services}/kumofs_gateway
+manager-wrapper = $${basedirectory:services}/kumofs_manager
+server-wrapper = $${basedirectory:services}/kumofs_server
+
+# Paths: Data
+data-directory = $${directory:kumofs-data}
+
+# Paths: Logs
+kumo-gateway-log = $${basedirectory:log}/kumo-gateway.log
+kumo-manager-log = $${basedirectory:log}/kumo-manager.log
+kumo-server-log = $${basedirectory:log}/kumo-server.log
+
+# Binary information
+kumo-gateway-binary = ${kumo:location}/bin/kumo-gateway
+kumo-manager-binary = ${kumo:location}/bin/kumo-manager
+kumo-server-binary = ${kumo:location}/bin/kumo-server
+
+[logrotate-entry-kumofs]
+<= logrotate
+recipe = slapos.cookbook:logrotate.d
+name = kumofs
+log = $${kumofs-instance:kumo-gateway-log} $${kumofs-instance:kumo-manager-log}
+  $${kumofs-instance:kumo-server-log}
+
+# rest of parts are candidates for some generic stuff
+
+[logrotate]
+recipe = slapos.cookbook:logrotate
+# Binaries
+logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
+gzip-binary = ${gzip:location}/bin/gzip
+gunzip-binary = ${gzip:location}/bin/gunzip
+# Directories
+wrapper = $${rootdirectory:bin}/logrotate
+conf = $${rootdirectory:etc}/logrotate.conf
+logrotate-entries = $${directory:logrotate-entries}
+backup = $${directory:logrotate-backup}
+state-file = $${rootdirectory:srv}/logrotate.status
+
+[basedirectory]
+recipe = slapos.cookbook:mkdirectory
+log = $${rootdirectory:var}/log
+services = $${rootdirectory:etc}/run
+run = $${rootdirectory:var}/run
+backup = $${rootdirectory:srv}/backup
+
+[directory]
+recipe = slapos.cookbook:mkdirectory
+cron-entries = $${rootdirectory:etc}/cron.d
+crontabs = $${rootdirectory:etc}/crontabs
+cronstamps = $${rootdirectory:etc}/cronstamps
+cronoutput = $${basedirectory:log}/cron
+logrotate-backup = $${basedirectory:backup}/logrotate
+logrotate-entries = $${rootdirectory:etc}/logrotate.d
+kumofs-data = $${rootdirectory:srv}/kumofs
+
+[rootdirectory]
+recipe = slapos.cookbook:mkdirectory
+etc = $${buildout:directory}/etc
+var = $${buildout:directory}/var
+srv = $${buildout:directory}/srv
+bin = $${buildout:directory}/bin
+
+[cron]
+recipe = slapos.cookbook:cron
+dcrond-binary = ${dcron:location}/sbin/crond
+cron-entries = $${directory:cron-entries}
+crontabs = $${directory:crontabs}
+cronstamps = $${directory:cronstamps}
+catcher = $${cron-simplelogger:binary}
+binary = $${basedirectory:services}/crond
+
+[cron-simplelogger]
+recipe = slapos.cookbook:simplelogger
+binary = $${rootdirectory:bin}/cron_simplelogger
+output = $${directory:cronoutput}
+
+[cron-entry-logrotate]
+<= cron
+recipe = slapos.cookbook:cron.d
+name = logrotate
+frequency = 0 0 * * *
+command = $${logrotate:wrapper}
diff --git a/software/erp5/instance-mariadb.cfg b/software/erp5/instance-mariadb.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..119f138851ec956e98d34f29cdc9b2b5ffd4ef10
--- /dev/null
+++ b/software/erp5/instance-mariadb.cfg
@@ -0,0 +1,174 @@
+[buildout]
+parts =
+  publish-mariadb-url
+  mariadb-instance
+  logrotate
+  logrotate-entry-mariadb
+  cron
+  cron-entry-logrotate
+  cron-entry-mariadb-backup
+  binary-link
+
+eggs-directory = ${buildout:eggs-directory}
+develop-eggs-directory = ${buildout:develop-eggs-directory}
+offline = true
+
+[publish-mariadb-url]
+recipe = slapos.cookbook:publishurl
+url = mysql://$${mariadb-instance:user}:$${mariadb-instance:password}@$${mariadb-instance:ip}:$${mariadb-instance:port}/$${mariadb-instance:database}
+
+[cron-entry-mariadb-backup]
+<= cron
+recipe = slapos.cookbook:cron.d
+name = mariadb-backup
+frequency = 0 0 * * *
+command = $${mariadb-instance:backup-script}
+
+[mariadb-instance]
+recipe = slapos.cookbook:generic.mysql
+
+# Options
+user = user
+parallel-test-database-amount = 100
+port = 45678
+ip = $${slap-network-information:local-ipv4}
+database = erp5
+test-user = erp5_test
+test-database = erp5_test
+mysql-test-database-base = testdb
+mysql-test-user-base = testuser
+
+# Paths
+wrapper = $${basedirectory:services}/mariadb
+update-wrapper = $${basedirectory:services}/mariadb_update
+backup-script = $${rootdirectory:bin}/innobackupex-controller
+full-backup-directory = $${directory:mariadb-backup-full}
+incremental-backup-directory = $${directory:mariadb-backup-incremental}
+data-directory = $${directory:mariadb-data}
+pid-file = $${basedirectory:run}/mariadb.pid
+socket = $${basedirectory:run}/mariadb.sock
+error-log = $${basedirectory:log}/mariadb_error.log
+slow-query-log = $${basedirectory:log}/mariadb_slowquery.log
+conf-file = $${rootdirectory:etc}/mariadb.cnf
+dumpname = dump.sql.gz
+bin-directory = $${rootdirectory:bin}
+innobackupex-incremental = $${rootdirectory:bin}/innobackupex-incremental
+innobackupex-full = $${rootdirectory:bin}/innobackupex-full
+
+# Binary information
+innobackupex-binary = ${xtrabackup:location}/bin/innobackupex
+mysql-binary = ${mariadb:location}/bin/mysql
+mysql-install-binary = ${mariadb:location}/bin/mysql_install_db
+mysql-upgrade-binary = ${mariadb:location}/bin/mysql_upgrade
+mysqld-binary = ${mariadb:location}/libexec/mysqld
+pt-archiver-binary = ${perl:siteprefix}/bin/pt-archiver
+pt-config-diff-binary = ${perl:siteprefix}/bin/pt-config-diff
+pt-deadlock-logger-binary = ${perl:siteprefix}/bin/pt-deadlock-logger
+pt-duplicate-key-checker-binary = ${perl:siteprefix}/bin/pt-duplicate-key-checker
+pt-fifo-split-binary = ${perl:siteprefix}/bin/pt-fifo-split
+pt-find-binary = ${perl:siteprefix}/bin/pt-find
+pt-fk-error-logger-binary = ${perl:siteprefix}/bin/pt-fk-error-logger
+pt-heartbeat-binary = ${perl:siteprefix}/bin/pt-heartbeat
+pt-index-usage-binary = ${perl:siteprefix}/bin/pt-index-usage
+pt-kill-binary = ${perl:siteprefix}/bin/pt-kill
+pt-log-player-binary = ${perl:siteprefix}/bin/pt-log-player
+pt-online-schema-change-binary = ${perl:siteprefix}/bin/pt-online-schema-change
+pt-query-advisor-binary = ${perl:siteprefix}/bin/pt-query-advisor
+pt-query-digest-binary = ${perl:siteprefix}/bin/pt-query-digest
+pt-show-grants-binary = ${perl:siteprefix}/bin/pt-show-grants
+pt-slave-delay-binary = ${perl:siteprefix}/bin/pt-slave-delay
+pt-slave-find-binary = ${perl:siteprefix}/bin/pt-slave-find
+pt-slave-restart-binary = ${perl:siteprefix}/bin/pt-slave-restart
+pt-table-checksum-binary = ${perl:siteprefix}/bin/pt-table-checksum
+pt-table-sync-binary = ${perl:siteprefix}/bin/pt-table-sync
+pt-tcp-model-binary = ${perl:siteprefix}/bin/pt-tcp-model
+pt-trend-binary = ${perl:siteprefix}/bin/pt-trend
+pt-upgrade-binary = ${perl:siteprefix}/bin/pt-upgrade
+pt-variable-advisor-binary = ${perl:siteprefix}/bin/pt-variable-advisor
+pt-visual-explain-binary = ${perl:siteprefix}/bin/pt-visual-explain
+xtrabackup-binary = ${xtrabackup:location}/bin/xtrabackup_51
+perl-binary = ${perl:location}/bin/perl
+
+[logrotate]
+recipe = slapos.cookbook:logrotate
+# Binaries
+logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
+gzip-binary = ${gzip:location}/bin/gzip
+gunzip-binary = ${gzip:location}/bin/gunzip
+# Directories
+wrapper = $${rootdirectory:bin}/logrotate
+conf = $${rootdirectory:etc}/logrotate.conf
+logrotate-entries = $${directory:logrotate-entries}
+backup = $${directory:logrotate-backup}
+state-file = $${rootdirectory:srv}/logrotate.status
+
+[logrotate-entry-mariadb]
+<= logrotate
+recipe = slapos.cookbook:logrotate.d
+name = mariadb
+log = $${mariadb-instance:error-log} $${mariadb-instance:slow-query-log}
+post = $${mariadb-instance:mysql-binary} --no-defaults -B --socket=$${mariadb-instance:socket} -e "FLUSH LOGS"
+
+[cron]
+recipe = slapos.cookbook:cron
+dcrond-binary = ${dcron:location}/sbin/crond
+cron-entries = $${directory:cron-entries}
+crontabs = $${directory:crontabs}
+cronstamps = $${directory:cronstamps}
+catcher = $${cron-simplelogger:binary}
+binary = $${basedirectory:services}/crond
+
+[cron-simplelogger]
+recipe = slapos.cookbook:simplelogger
+binary = $${rootdirectory:bin}/cron_simplelogger
+output = $${directory:cronoutput}
+
+[cron-entry-logrotate]
+<= cron
+recipe = slapos.cookbook:cron.d
+name = logrotate
+frequency = 0 0 * * *
+command = $${logrotate:wrapper}
+
+[binary-link]
+recipe = slapos.cookbook:symbolic.link
+target-directory = $${rootdirectory:bin}
+link-binary = 
+  ${coreutils:location}/bin/basename
+  ${coreutils:location}/bin/cat
+  ${coreutils:location}/bin/cp
+  ${coreutils:location}/bin/ls
+  ${coreutils:location}/bin/tr
+  ${coreutils:location}/bin/uname
+  ${gettext:location}/lib/gettext/hostname
+  ${grep:location}/bin/grep
+  ${sed:location}/bin/sed
+  ${mariadb:location}/bin/mysql
+
+[rootdirectory]
+recipe = slapos.cookbook:mkdirectory
+etc = $${buildout:directory}/etc
+var = $${buildout:directory}/var
+srv = $${buildout:directory}/srv
+bin = $${buildout:directory}/bin
+
+[basedirectory]
+recipe = slapos.cookbook:mkdirectory
+log = $${rootdirectory:var}/log
+services = $${rootdirectory:etc}/run
+run = $${rootdirectory:var}/run
+backup = $${rootdirectory:srv}/backup
+
+[directory]
+recipe = slapos.cookbook:mkdirectory
+cron-entries = $${rootdirectory:etc}/cron.d
+crontabs = $${rootdirectory:etc}/crontabs
+cronstamps = $${rootdirectory:etc}/cronstamps
+cronoutput = $${basedirectory:log}/cron
+ca-dir = $${rootdirectory:srv}/ssl
+mariadb-backup-full = $${basedirectory:backup}/mariadb-full
+mariadb-backup-incremental = $${basedirectory:backup}/mariadb-incremental
+mariadb-data = $${rootdirectory:srv}/mariadb
+logrotate-backup = $${basedirectory:backup}/logrotate
+logrotate-entries = $${rootdirectory:etc}/logrotate.d
+
diff --git a/software/erp5/instance-memcached.cfg b/software/erp5/instance-memcached.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..4ec3390f9a6f162475d5767b66c8baf24723e1e0
--- /dev/null
+++ b/software/erp5/instance-memcached.cfg
@@ -0,0 +1,35 @@
+#############################
+#
+# Instanciate memcached
+#
+# No slapos parameter needed
+#
+#############################
+[buildout]
+parts =
+  memcached-instance
+  publish-memcached-connection-information
+
+eggs-directory = ${buildout:eggs-directory}
+develop-eggs-directory = ${buildout:develop-eggs-directory}
+offline = true
+
+[rootdirectory]
+recipe = slapos.cookbook:mkdirectory
+etc = $${buildout:directory}/etc
+bin = $${buildout:directory}/bin
+
+[basedirectory]
+recipe = slapos.cookbook:mkdirectory
+services = $${rootdirectory:etc}/run
+
+[memcached-instance]
+recipe = slapos.cookbook:generic.memcached
+wrapper_path = $${basedirectory:services}/memcached
+binary_path = ${memcached:location}/bin/memcached
+ip = $${slap-network-information:local-ipv4}
+port = 11000
+
+[publish-memcached-connection-information]
+recipe = slapos.cookbook:publishurl
+url = memcached://$${memcached-instance:ip}:$${memcached-instance:port}/
diff --git a/software/erp5/instance-sphinx.cfg b/software/erp5/instance-sphinx.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..8fefcd65301360b1acbbccbfebab05af2e7da809
--- /dev/null
+++ b/software/erp5/instance-sphinx.cfg
@@ -0,0 +1,43 @@
+[buildout]
+parts =
+  publish-sphinx-url
+  sphinxd-instance
+
+eggs-directory = ${buildout:eggs-directory}
+develop-eggs-directory = ${buildout:develop-eggs-directory}
+offline = true
+
+[publish-sphinx-url]
+recipe = slapos.cookbook:publish
+url-sphinx = sphinx://$${sphinxd-instance:ip}:$${sphinxd-instance:sphinx-port}
+url-sphinx-sql = mysql://$${sphinxd-instance:ip}:$${sphinxd-instance:sql-port}
+
+[sphinxd-instance]
+recipe = slapos.cookbook:sphinx
+data-directory = $${directory:sphinx-data}
+configuration-file = $${rootdirectory:etc}/sphinx.conf
+searchd-log = $${basedirectory:log}/sphinx-searchd.log
+query-log = $${basedirectory:log}/sphinx-query.log
+pid = $${basedirectory:run}/sphinx-searchd.pid
+ip = $${slap-network-information:local-ipv4}
+sphinx-port = 9312
+sql-port = 9306
+wrapper = $${basedirectory:services}/sphinxd
+sphinx-searchd-binary = ${sphinx:location}/bin/searchd
+
+[rootdirectory]
+recipe = slapos.cookbook:mkdirectory
+etc = $${buildout:directory}/etc
+var = $${buildout:directory}/var
+srv = $${buildout:directory}/srv
+bin = $${buildout:directory}/bin
+
+[basedirectory]
+recipe = slapos.cookbook:mkdirectory
+log = $${rootdirectory:var}/log
+services = $${rootdirectory:etc}/run
+run = $${rootdirectory:var}/run
+
+[directory]
+recipe = slapos.cookbook:mkdirectory
+sphinx-data = $${rootdirectory:srv}/sphinx
diff --git a/software/erp5/instance-zope.cfg b/software/erp5/instance-zope.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..dc2fbd32e0742a658f112b2285d7b628f65f5907
--- /dev/null
+++ b/software/erp5/instance-zope.cfg
@@ -0,0 +1,249 @@
+[buildout]
+parts =
+  certificate-authority
+  publish-apache-zope-backend-connection-string
+  zope-instance
+  apache-zope-backend-instance
+  ca-apache-zope-backend
+  logrotate
+  erp5-certificate-authority
+  logrotate-entry-zope
+  cron
+  cron-entry-logrotate
+  binary-link
+
+eggs-directory = ${buildout:eggs-directory}
+develop-eggs-directory = ${buildout:develop-eggs-directory}
+offline = true
+
+[slap-parameter]
+# By default backend disallows the access
+access-control-string = none
+
+[publish-apache-zope-backend-connection-string]
+recipe = slapos.cookbook:publish
+url = https://$${zope-instance:user}:$${zope-instance:password}@[$${apache-zope-backend-instance:ip}]:$${apache-zope-backend-instance:port}
+url-deadlock = $${:url}/$${zope-instance:deadlock-path}?$${zope-instance:deadlock-password}
+
+[apache-zope-backend-instance]
+recipe = slapos.cookbook:apache.zope.backend
+backend = http://$${zope-instance:ip}:$${zope-instance:port}/
+ip = $${slap-network-information:global-ipv6}
+port = 16001
+wrapper = $${rootdirectory:bin}/apache
+key-file = $${directory:apache-conf}/apache.key
+cert-file = $${directory:apache-conf}/apache.crt
+configuration-file = $${directory:apache-conf}/apache.conf
+access-control-string = $${slap-parameter:access-control-string}
+pid-file = $${basedirectory:run}/apache.pid
+lock-file = $${basedirectory:run}/apache.lock
+error-log = $${basedirectory:log}/apache-error.log
+access-log = $${basedirectory:log}/apache-access.log
+apache-binary = ${apache:location}/bin/httpd
+
+[ca-apache-zope-backend]
+<= certificate-authority
+recipe = slapos.cookbook:certificate_authority.request
+key-file = $${apache-zope-backend-instance:key-file}
+cert-file = $${apache-zope-backend-instance:cert-file}
+executable = $${apache-zope-backend-instance:wrapper}
+wrapper = $${basedirectory:services}/apache
+
+[zope-instance]
+recipe = slapos.cookbook:generic.zope
+
+# XXX: products won't be needed as soon as all ERP5 (and products-deps)
+# products will be eggified so then it will be possible to use them thanks to
+# availability in software's eggs
+products = ${products:list}
+
+# Options
+user = zope
+port = 12001
+ip = $${slap-network-information:local-ipv4}
+zodb-cache-size = 5000
+thread-amount = 4
+zodb-path = $${directory:zodb}/main.cfg
+deadlock-path = /manage_debug_threads
+
+# Paths
+wrapper = $${basedirectory:services}/zope-development
+instance-path = $${directory:instance}
+instance-etc = $${directory:instance-etc}
+instance-products = $${directory:instance-products}
+bt5-repository = $${rootdirectory:var}/bt5_repository
+tmp-path = $${rootdirectory:tmp}
+bin-path = $${rootdirectory:bin}
+site-zcml = $${:instance-etc}/site.zcml
+logrotate-post = $${rootdirectory:bin}/zope-post-logrotate
+pid-file = $${basedirectory:run}/zope.pid
+lock-file = $${basedirectory:run}/zope.lock
+event-log = $${basedirectory:log}/zope-event.log
+z2-log = $${basedirectory:log}/zope-Z2.log
+configuration-file = $${rootdirectory:etc}/zope.conf
+inituser = $${:instance-path}/inituser
+# Binary information
+runzope-binary = ${buildout:bin-directory}/runzope
+
+# Defaults
+bt5-repository-list =
+
+[logrotate]
+recipe = slapos.cookbook:logrotate
+# Binaries
+logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
+gzip-binary = ${gzip:location}/bin/gzip
+gunzip-binary = ${gzip:location}/bin/gunzip
+# Directories
+wrapper = $${rootdirectory:bin}/logrotate
+conf = $${rootdirectory:etc}/logrotate.conf
+logrotate-entries = $${directory:logrotate-entries}
+backup = $${directory:logrotate-backup}
+state-file = $${rootdirectory:srv}/logrotate.status
+
+[logrotate-entry-zope]
+<= logrotate
+recipe = slapos.cookbook:logrotate.d
+name = zope
+log = $${zope-instance:event-log} $${zope-instance:z2-log}
+frequency = daily
+rotate-num = 30
+post = ${buildout:bin-directory}/killpidfromfile $${zope-instance:pid-file} SIGUSR2
+sharedscripts = true
+notifempty = true
+create = true
+
+[logrotate-entry-apache-zope-backend]
+<= logrotate
+recipe = slapos.cookbook:logrotate.d
+name = zope
+log = $${apache-zope-backend-instance:error-log} $${apache-zope-backend-instance:access-log}
+frequency = daily
+rotate-num = 30
+post = ${buildout:bin-directory}/killpidfromfile $${apache-zope-backend-instance:pid-file} SIGUSR1
+sharedscripts = true
+notifempty = true
+create = true
+
+[cron]
+recipe = slapos.cookbook:cron
+dcrond-binary = ${dcron:location}/sbin/crond
+cron-entries = $${directory:cron-entries}
+crontabs = $${directory:crontabs}
+cronstamps = $${directory:cronstamps}
+catcher = $${cron-simplelogger:binary}
+binary = $${basedirectory:services}/crond
+
+[cron-simplelogger]
+recipe = slapos.cookbook:simplelogger
+binary = $${rootdirectory:bin}/cron_simplelogger
+output = $${directory:cronoutput}
+
+[cron-entry-logrotate]
+<= cron
+recipe = slapos.cookbook:cron.d
+name = logrotate
+frequency = 0 0 * * *
+command = $${logrotate:wrapper}
+
+[binary-link]
+recipe = slapos.cookbook:symbolic.link
+target-directory = $${rootdirectory:bin}
+link-binary = 
+  ${coreutils:location}/bin/basename
+  ${coreutils:location}/bin/cat
+  ${coreutils:location}/bin/cp
+  ${coreutils:location}/bin/ls
+  ${coreutils:location}/bin/tr
+  ${coreutils:location}/bin/uname
+  ${git:location}/bin/git
+  ${graphviz:location}/bin/dot
+  ${grep:location}/bin/grep
+  ${imagemagick:location}/bin/convert
+  ${imagemagick:location}/bin/identify
+  ${mariadb:location}/bin/mysql
+  ${mariadb:location}/bin/mysqldump
+  ${pdftk:location}/bin/pdftk
+  ${sed:location}/bin/sed
+  ${tesseract:location}/bin/tesseract
+  ${w3m:location}/bin/w3m
+  ${poppler:location}/bin/pdfinfo
+  ${poppler:location}/bin/pdftotext
+  ${poppler:location}/bin/pdftohtml
+[certificate-authority]
+recipe = slapos.cookbook:certificate_authority
+openssl-binary = ${openssl:location}/bin/openssl
+ca-dir = $${directory:ca-dir}
+requests-directory = $${cadirectory:requests}
+wrapper = $${basedirectory:services}/ca
+ca-private = $${cadirectory:private}
+ca-certs = $${cadirectory:certs}
+ca-newcerts = $${cadirectory:newcerts}
+ca-crl = $${cadirectory:crl}
+
+[cadirectory]
+recipe = slapos.cookbook:mkdirectory
+requests = $${directory:ca-dir}/requests
+private = $${directory:ca-dir}/private
+certs = $${directory:ca-dir}/certs
+newcerts = $${directory:ca-dir}/newcerts
+crl = $${directory:ca-dir}/crl
+
+[rootdirectory]
+recipe = slapos.cookbook:mkdirectory
+etc = $${buildout:directory}/etc
+var = $${buildout:directory}/var
+srv = $${buildout:directory}/srv
+bin = $${buildout:directory}/bin
+tmp = $${buildout:directory}/tmp
+
+[basedirectory]
+recipe = slapos.cookbook:mkdirectory
+log = $${rootdirectory:var}/log
+services = $${rootdirectory:etc}/run
+run = $${rootdirectory:var}/run
+backup = $${rootdirectory:srv}/backup
+
+[erp5-certificate-authority]
+recipe = slapos.cookbook:certificate_authority
+openssl-binary = ${openssl:location}/bin/openssl
+ca-dir = $${directory:erp5-ca-dir}
+requests-directory = $${erp5-cadirectory:requests}
+wrapper = $${basedirectory:services}/erp5-ca
+ca-private = $${erp5-cadirectory:private}
+ca-certs = $${erp5-cadirectory:certs}
+ca-newcerts = $${erp5-cadirectory:newcerts}
+ca-crl = $${erp5-cadirectory:crl}
+
+[erp5-cadirectory]
+recipe = slapos.cookbook:mkdirectory
+requests = $${directory:erp5-ca-dir}/requests/
+private = $${directory:erp5-ca-dir}/private/
+certs = $${directory:erp5-ca-dir}/certs/
+newcerts = $${directory:erp5-ca-dir}/newcerts/
+crl = $${directory:erp5-ca-dir}/crl/
+
+[directory]
+recipe = slapos.cookbook:mkdirectory
+zodb = $${rootdirectory:srv}/zodb
+instance = $${rootdirectory:srv}/erp5shared
+instance-etc = $${:instance}/etc
+apache-conf = $${rootdirectory:etc}/apache
+instance-etc-package-include = $${:instance}/etc/package-include
+# because of bug in slapos.recipe.template keys are lowercased
+instance-document = $${:instance}/Document
+instance-propertysheet = $${:instance}/PropertySheet
+instance-products = $${:instance}/Products
+instance-extensions = $${:instance}/Extensions
+instance-constraint = $${:instance}/Constraint
+instance-import = $${:instance}/import
+instance-lib = $${:instance}/lib
+instance-tests = $${:instance}/tests
+erp5-ca-dir = $${rootdirectory:srv}/erp5-ca/
+ca-dir = $${rootdirectory:srv}/ssl
+cron-entries = $${rootdirectory:etc}/cron.d
+crontabs = $${rootdirectory:etc}/crontabs
+cronstamps = $${rootdirectory:etc}/cronstamps
+cronoutput = $${basedirectory:log}/cron
+logrotate-backup = $${basedirectory:backup}/logrotate
+logrotate-entries = $${rootdirectory:etc}/logrotate.d
diff --git a/software/erp5/instance.cfg b/software/erp5/instance.cfg
index 05e6988f5ef6f3efeefc51139834f45128b12032..8abb090d57cd0b98e3504b2160b6050dcb789185 100644
--- a/software/erp5/instance.cfg
+++ b/software/erp5/instance.cfg
@@ -1,82 +1,44 @@
+[instance]
+rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup
+
 [buildout]
+
 parts =
-  instance
+  switch-softwaretype
 
 eggs-directory = ${buildout:eggs-directory}
 develop-eggs-directory = ${buildout:develop-eggs-directory}
+offline = true
 
-[instance]
-recipe = ${instance-recipe:egg}:${instance-recipe:module}
-dcrond_binary = ${dcron:location}/sbin/crond
-haproxy_binary = ${haproxy:location}/sbin/haproxy
-gzip_binary = ${gzip:location}/bin/gzip
-httpd_binary = ${apache:location}/bin/httpd
-innobackupex_binary = ${xtrabackup:location}/bin/innobackupex
-kumo_gateway_binary = ${kumo:location}/bin/kumo-gateway
-kumo_manager_binary = ${kumo:location}/bin/kumo-manager
-kumo_server_binary = ${kumo:location}/bin/kumo-server
-logrotate_binary = ${logrotate:location}/usr/sbin/logrotate
-memcached_binary = ${memcached:location}/bin/memcached
-mysql_binary = ${mariadb:location}/bin/mysql
-mysql_install_binary = ${mariadb:location}/bin/mysql_install_db
-mysql_upgrade_binary = ${mariadb:location}/bin/mysql_upgrade
-mysqld_binary = ${mariadb:location}/libexec/mysqld
-openssl_binary = ${openssl:location}/bin/openssl
-perl_binary = ${perl:location}/bin/perl
-rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup
-repozo_binary = ${buildout:bin-directory}/repozo
-runTestSuite_binary = ${buildout:bin-directory}/runTestSuite
-runUnitTest_binary = ${buildout:bin-directory}/runUnitTest
-runzeo_binary = ${buildout:bin-directory}/runzeo
-runzope_binary = ${buildout:bin-directory}/runzope
-sphinx_searchd_binary = ${sphinx:location}/bin/searchd
-tidstorage_repozo_binary = ${buildout:bin-directory}/tidstorage_repozo
-tidstoraged_binary = ${buildout:bin-directory}/tidstoraged
-xtrabackup_binary = ${xtrabackup:location}/bin/xtrabackup_51
-zabbix_agentd_binary = ${zabbix-agent:location}/sbin/zabbix_agentd
-mk-variable-advisor_binary = ${perl:siteprefix}/bin/mk-variable-advisor
-mk-table-usage_binary = ${perl:siteprefix}/bin/mk-table-usage
-mk-visual-explain_binary = ${perl:siteprefix}/bin/mk-visual-explain
-mk-config-diff_binary = ${perl:siteprefix}/bin/mk-config-diff
-mk-deadlock-logger_binary = ${perl:siteprefix}/bin/mk-deadlock-logger
-mk-error-log_binary = ${perl:siteprefix}/bin/mk-error-log
-mk-index-usage_binary = ${perl:siteprefix}/bin/mk-index-usage
-mk-query-advisor_binary = ${perl:siteprefix}/bin/mk-query-advisor
-
-# cloudooo specific configuration
-ooo_binary_path = ${libreoffice-bin:location}/program
-ooo_paster = ${buildout:bin-directory}/cloudooo_paster
-ooo_uno_path = ${libreoffice-bin:location}/basis-link/program
-
-link_binary_list =
-  ${coreutils:location}/bin/basename
-  ${coreutils:location}/bin/cat
-  ${coreutils:location}/bin/cp
-  ${coreutils:location}/bin/ls
-  ${coreutils:location}/bin/tr
-  ${coreutils:location}/bin/uname
-  ${git:location}/bin/git
-  ${graphviz:location}/bin/dot
-  ${grep:location}/bin/grep
-  ${imagemagick:location}/bin/convert
-  ${imagemagick:location}/bin/identify
-  ${mariadb:location}/bin/mysql
-  ${mariadb:location}/bin/mysqldump
-  ${pdftk:location}/bin/pdftk
-  ${sed:location}/bin/sed
-  ${tesseract:location}/bin/tesseract
-  ${w3m:location}/bin/w3m
-  ${poppler:location}/bin/pdfinfo
-  ${poppler:location}/bin/pdftotext
-  ${poppler:location}/bin/pdftohtml
+[dynamic-template-tidstorage]
+recipe = slapos.cookbook:generate.erp5.tidstorage
+snippet-zeo = ${template-snippet-zeo:output}
+snippet-zope = ${template-snippet-zope:output}
+snippet-master = ${template-snippet-master:output}
+snippet-backend = ${template-snippet-backend:output}
 
-# XXX: products won't be needed as soon as all ERP5 (and products-deps)
-# products will be eggified so then it will be possible to use them thanks to
-# availability in software's eggs
-products = ${products:list}
-environment =
-  LD_LIBRARY_PATH = ${file:location}/lib:${fontconfig:location}/lib:${freetype:location}/lib:${libICE:location}/lib:${libSM:location}/lib:${libX11:location}/lib:${libXau:location}/lib:${libXdmcp:location}/lib:${libXext:location}/lib:${libXinerama:location}/lib:${libxcb:location}/lib:${zlib:location}/lib
+[dynamic-template-cloudooo]
+recipe = slapos.cookbook:generate.cloudooo
+template = ${template-cloudooo:output}
+snippet-fontconfig = ${template-snippet-fontconfig:output}
 
-bt5_repository_list = ${bt5-repository:list}
+[switch-softwaretype]
+recipe = slapos.cookbook:softwaretype
+default = ${template-erp5-development:output}
+production = ${template-erp5-production:output}
+kumofs = ${template-kumofs:output}
+memcached = ${template-memcached:output}
+cloudooo = $${dynamic-template-cloudooo:output}
+zope = ${template-zope:output}
+mariadb = ${template-mariadb:output}
+sphinx = ${template-sphinx:output}
+tidstorage = $${dynamic-template-tidstorage:output}
 
-configurator_bt5_list = ${instance-recipe:configurator_bt5_list}
+[slap-connection]
+# part to migrate to new - separated words
+computer-id = $${slap_connection:computer_id}
+partition-id = $${slap_connection:partition_id}
+server-url = $${slap_connection:server_url}
+software-release-url = $${slap_connection:software_release_url}
+key-file = $${slap_connection:key_file}
+cert-file = $${slap_connection:cert_file}
diff --git a/software/erp5/snippet-backend.cfg b/software/erp5/snippet-backend.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..b18a7f20881ce14477b30fecaac305e3300fe796
--- /dev/null
+++ b/software/erp5/snippet-backend.cfg
@@ -0,0 +1,42 @@
+[apache-%(backend_name)s]
+recipe = slapos.cookbook:apache.zope.backend
+backend = http://$${haproxy-%(backend_name)s:ip}:$${haproxy-%(backend_name)s:port}/
+ip = $${slap-network-information:global-ipv6}
+port = %(apache_port)s
+wrapper = $${rootdirectory:bin}/apache-%(backend_name)s
+key-file = $${directory:apache-conf}/apache-%(backend_name)s.key
+cert-file = $${directory:apache-conf}/apache-%(backend_name)s.crt
+configuration-file = $${directory:apache-conf}/apache-%(backend_name)s.conf
+access-control-string = %(access_control_string)s
+pid-file = $${basedirectory:run}/apache-%(backend_name)s.pid
+lock-file = $${basedirectory:run}/apache-%(backend_name)s.lock
+error-log = $${basedirectory:log}/apache-%(backend_name)s-error.log
+access-log = $${basedirectory:log}/apache-%(backend_name)s-access.log
+apache-binary = ${apache:location}/bin/httpd
+
+[ca-apache-%(backend_name)s]
+<= certificate-authority
+recipe = slapos.cookbook:certificate_authority.request
+key-file = $${apache-%(backend_name)s:key-file}
+cert-file = $${apache-%(backend_name)s:cert-file}
+executable = $${apache-%(backend_name)s:wrapper}
+wrapper = $${basedirectory:services}/apache-%(backend_name)s
+
+[logrotate-entry-apache-%(backend_name)s]
+<= logrotate
+recipe = slapos.cookbook:logrotate.d
+name = apache-%(backend_name)s
+log = $${apache-%(backend_name)s:error-log} $${apache-%(backend_name)s:access-log}
+post = ${buildout:bin-directory}/killpidfromfile $${apache-%(backend_name)s:pid-file} SIGUSR1
+
+[haproxy-%(backend_name)s]
+recipe = slapos.cookbook:haproxy
+name = %(backend_name)s
+conf-path = $${rootdirectory:etc}/haproxy-%(backend_name)s.cfg
+ip = $${slap-network-information:local-ipv4}
+port = %(haproxy_port)s
+maxconn = %(maxconn)s
+server-check-path = %(server_check_path)s
+wrapper-path = $${basedirectory:services}/haproxy-%(backend_name)s
+binary-path = ${haproxy:location}/sbin/haproxy
+backend-list = %(haproxy_backend_list)s
diff --git a/software/erp5/snippet-fontconfig.cfg b/software/erp5/snippet-fontconfig.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..7d99ce0c78835a234b7783d2541093f9b28caf58
--- /dev/null
+++ b/software/erp5/snippet-fontconfig.cfg
@@ -0,0 +1,2 @@
+[dynamic-fontconfig-instance]
+url-list = %(font_url_list)s
diff --git a/software/erp5/snippet-master.cfg b/software/erp5/snippet-master.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..8c44deb8e0524939becf088938fe65884654530d
--- /dev/null
+++ b/software/erp5/snippet-master.cfg
@@ -0,0 +1,235 @@
+#############################
+#
+# Instanciate zeo
+#
+# zeo-id -- local id of the requested zeo (1,2,3,...)
+#
+# zeo-port -- ip port to use to run the process
+#
+# storage_list -- string with list of all resquested storage
+#    Example: event_module person_module
+#
+#############################
+[buildout]
+parts =
+  logrotate
+  cron
+  cron-entry-logrotate
+  certificate-authority
+  erp5-certificate-authority
+  tidstorage
+  cron-entry-tidstorage-backup
+  logrotate-entry-tidstorage
+  binary-link
+  erp5-update
+  %(part_list)s
+
+eggs-directory = ${buildout:eggs-directory}
+develop-eggs-directory = ${buildout:develop-eggs-directory}
+offline = true
+
+[tidstorage]
+recipe = slapos.cookbook:tidstorage
+known-tid-storage-identifier-dict = %(known_tid_storage_identifier_dict)s
+base-url = http://$${%(haproxy_section)s:ip}:$${%(haproxy_section)s:port}/%%s/serialize
+configuration-path = $${rootdirectory:etc}/tidstorage.py
+ip = $${slap-network-information:local-ipv4}
+port = 6001
+timestamp-file-path = $${directory:tidstorage}/repozo_tidstorage_timestamp.log
+logfile-name = $${basedirectory:log}/tidstorage.log
+pidfile-name = $${basedirectory:run}/tidstorage.pid
+status-file = $${directory:tidstorage}/tidstorage.tid
+tidstorage-repozo-binary = ${buildout:bin-directory}/tidstorage_repozo
+tidstoraged-binary = ${buildout:bin-directory}/tidstoraged
+repozo-binary = ${buildout:bin-directory}/repozo
+tidstorage-wrapper = $${basedirectory:services}/tidstoraged
+repozo-wrapper = $${buildout:bin-directory}/tidstorage-repozo
+
+[cron-entry-tidstorage-backup]
+<= cron
+recipe = slapos.cookbook:cron.d
+name = tidstorage
+frequency = 0 0 * * *
+command = $${tidstorage:repozo-wrapper}
+
+[logrotate-entry-tidstorage]
+<= logrotate
+recipe = slapos.cookbook:logrotate.d
+name = tidstorage
+log = $${tidstorage:logfile-name}
+post = ${buildout:bin-directory}/killpidfromfile $${tidstorage:pidfile-name} SIGHUP
+
+[directory]
+recipe = slapos.cookbook:mkdirectory
+cron-entries = $${rootdirectory:etc}/cron.d/
+crontabs = $${rootdirectory:etc}/crontabs/
+cronstamps = $${rootdirectory:etc}/cronstamps/
+cronoutput = $${basedirectory:log}/cron/
+logrotate-backup = $${basedirectory:backup}/logrotate/
+logrotate-entries = $${rootdirectory:etc}/logrotate.d/
+
+[cron]
+recipe = slapos.cookbook:cron
+dcrond-binary = ${dcron:location}/sbin/crond
+cron-entries = $${directory:cron-entries}
+crontabs = $${directory:crontabs}
+cronstamps = $${directory:cronstamps}
+catcher = $${cron-simplelogger:binary}
+binary = $${basedirectory:services}/crond
+
+[cron-simplelogger]
+recipe = slapos.cookbook:simplelogger
+binary = $${rootdirectory:bin}/cron_simplelogger
+output = $${directory:cronoutput}
+
+[cron-entry-logrotate]
+<= cron
+recipe = slapos.cookbook:cron.d
+name = logrotate
+frequency = 0 0 * * *
+command = $${logrotate:wrapper}
+
+# rest of parts are candidates for some generic stuff
+
+[logrotate]
+recipe = slapos.cookbook:logrotate
+# Binaries
+logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
+gzip-binary = ${gzip:location}/bin/gzip
+gunzip-binary = ${gzip:location}/bin/gunzip
+# Directories
+wrapper = $${rootdirectory:bin}/logrotate
+conf = $${rootdirectory:etc}/logrotate.conf
+logrotate-entries = $${directory:logrotate-entries}
+backup = $${directory:logrotate-backup}
+state-file = $${rootdirectory:srv}/logrotate.status
+
+[zeo-instance-entry-common]
+recipe = slapos.cookbook:zeo
+ip = $${slap-network-information:local-ipv4}
+binary-path = ${buildout:bin-directory}/runzeo
+
+[erp5-certificate-authority]
+recipe = slapos.cookbook:certificate_authority
+openssl-binary = ${openssl:location}/bin/openssl
+ca-dir = $${directory:erp5-ca-dir}
+requests-directory = $${erp5-cadirectory:requests}
+wrapper = $${basedirectory:services}/erp5-ca
+ca-private = $${erp5-cadirectory:private}
+ca-certs = $${erp5-cadirectory:certs}
+ca-newcerts = $${erp5-cadirectory:newcerts}
+ca-crl = $${erp5-cadirectory:crl}
+
+[erp5-cadirectory]
+recipe = slapos.cookbook:mkdirectory
+requests = $${directory:erp5-ca-dir}/requests/
+private = $${directory:erp5-ca-dir}/private/
+certs = $${directory:erp5-ca-dir}/certs/
+newcerts = $${directory:erp5-ca-dir}/newcerts/
+crl = $${directory:erp5-ca-dir}/crl/
+
+[certificate-authority]
+recipe = slapos.cookbook:certificate_authority
+openssl-binary = ${openssl:location}/bin/openssl
+ca-dir = $${directory:ca-dir}
+requests-directory = $${cadirectory:requests}
+wrapper = $${basedirectory:services}/ca
+ca-private = $${cadirectory:private}
+ca-certs = $${cadirectory:certs}
+ca-newcerts = $${cadirectory:newcerts}
+ca-crl = $${cadirectory:crl}
+
+[cadirectory]
+recipe = slapos.cookbook:mkdirectory
+requests = $${directory:ca-dir}/requests/
+private = $${directory:ca-dir}/private/
+certs = $${directory:ca-dir}/certs/
+newcerts = $${directory:ca-dir}/newcerts/
+crl = $${directory:ca-dir}/crl/
+
+[rootdirectory]
+recipe = slapos.cookbook:mkdirectory
+etc = $${buildout:directory}/etc/
+var = $${buildout:directory}/var/
+srv = $${buildout:directory}/srv/
+bin = $${buildout:directory}/bin/
+tmp = $${buildout:directory}/tmp/
+
+[basedirectory]
+recipe = slapos.cookbook:mkdirectory
+log = $${rootdirectory:var}/log/
+services = $${rootdirectory:etc}/run/
+run = $${rootdirectory:var}/run/
+backup = $${rootdirectory:srv}/backup/
+
+[directory]
+recipe = slapos.cookbook:mkdirectory
+tidstorage = $${rootdirectory:srv}/tidstorage/
+zodb = $${rootdirectory:srv}/zodb/
+zodb-backup = $${basedirectory:backup}/zodb
+instance = $${rootdirectory:srv}/erp5shared/
+instance-etc = $${:instance}/etc
+apache-conf = $${rootdirectory:etc}/apache
+instance-etc-package-include = $${:instance}/etc/package-include
+# because of bug in slapos.recipe.template keys are lowercased
+instance-document = $${:instance}/Document
+instance-propertysheet = $${:instance}/PropertySheet
+instance-products = $${:instance}/Products
+instance-extensions = $${:instance}/Extensions
+instance-constraint = $${:instance}/Constraint
+instance-import = $${:instance}/import
+instance-lib = $${:instance}/lib
+instance-tests = $${:instance}/tests
+erp5-ca-dir = $${rootdirectory:srv}/erp5-ssl/
+ca-dir = $${rootdirectory:srv}/ssl/
+cron-entries = $${rootdirectory:etc}/cron.d/
+crontabs = $${rootdirectory:etc}/crontabs/
+cronstamps = $${rootdirectory:etc}/cronstamps/
+cronoutput = $${basedirectory:log}/cron/
+logrotate-backup = $${basedirectory:backup}/logrotate/
+logrotate-entries = $${rootdirectory:etc}/logrotate.d/
+
+[binary-link]
+recipe = slapos.cookbook:symbolic.link
+target-directory = $${rootdirectory:bin}
+link-binary = 
+  ${coreutils:location}/bin/basename
+  ${coreutils:location}/bin/cat
+  ${coreutils:location}/bin/cp
+  ${coreutils:location}/bin/ls
+  ${coreutils:location}/bin/tr
+  ${coreutils:location}/bin/uname
+  ${git:location}/bin/git
+  ${graphviz:location}/bin/dot
+  ${grep:location}/bin/grep
+  ${imagemagick:location}/bin/convert
+  ${imagemagick:location}/bin/identify
+  ${mariadb:location}/bin/mysql
+  ${mariadb:location}/bin/mysqldump
+  ${pdftk:location}/bin/pdftk
+  ${sed:location}/bin/sed
+  ${tesseract:location}/bin/tesseract
+  ${w3m:location}/bin/w3m
+  ${poppler:location}/bin/pdfinfo
+  ${poppler:location}/bin/pdftotext
+  ${poppler:location}/bin/pdftohtml
+
+[erp5-update]
+recipe = slapos.cookbook:erp5.update
+
+# Configuration
+url = http://$${%(zope_section)s:user}:$${%(zope_section)s:password}@$${%(zope_section)s:ip}:$${%(zope_section)s:port}/
+mysql-url = %(mysql-url)s
+kumofs-url = %(kumofs-url)s
+memcached-url = %(memcached-url)s
+cloudooo-url = %(cloudooo-url)s
+site-id = %(site_id)s
+openssl-binary = ${openssl:location}/bin/openssl
+cadir-path = $${erp5-certificate-authority:ca-dir}
+
+# Paths
+update-wrapper = $${basedirectory:services}/erp5-update
+
+# Defaults
+configurator-bt5-list = erp5_full_text_myisam_catalog erp5_configurator_standard erp5_configurator_maxma_demo erp5_configurator_ung erp5_configurator_ung erp5_configurator_run_my_doc
+bt5-repository-list = $${%(zope_section)s:bt5-repository-list}
diff --git a/software/erp5/snippet-zeo.cfg b/software/erp5/snippet-zeo.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..2af5fd083a3a02379484ee251ea77718e2388b5d
--- /dev/null
+++ b/software/erp5/snippet-zeo.cfg
@@ -0,0 +1,16 @@
+[zeo-instance-%(zeo_id)s]
+<= zeo-instance-entry-common
+log-path = $${basedirectory:log}/zeo-%(zeo_id)s.log
+pid-path = $${basedirectory:run}/zeo-%(zeo_id)s.pid
+conf-path = $${rootdirectory:etc}/zeo-%(zeo_id)s.conf
+port = %(zeo_port)s
+storage =
+  %(storage_list)s
+wrapper-path = $${basedirectory:services}/zeo-%(zeo_id)s
+
+[logrotate-entry-zeo-%(zeo_id)s]
+<= logrotate
+recipe = slapos.cookbook:logrotate.d
+name = zeo-%(zeo_id)s
+log = $${zeo-instance-%(zeo_id)s:log-path}
+post = ${buildout:bin-directory}/killpidfromfile $${zeo-instance-%(zeo_id)s:pid-path} SIGUSR2
diff --git a/software/erp5/snippet-zope.cfg b/software/erp5/snippet-zope.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..89227f239693e2ad6f50995dfc73ca6065ec0b29
--- /dev/null
+++ b/software/erp5/snippet-zope.cfg
@@ -0,0 +1,47 @@
+[%(zope_id)s]
+recipe = slapos.cookbook:generic.zope.zeo.client
+
+# XXX: products won't be needed as soon as all ERP5 (and products-deps)
+# products will be eggified so then it will be possible to use them thanks to
+# availability in software's eggs
+products = ${products:list}
+
+# Options
+user = zope
+port = %(zope_port)s
+ip = $${slap-network-information:local-ipv4}
+thread-amount = %(zope_thread_amount)s
+deadlock-path = /manage_debug_threads
+timezone = %(timezone)s
+zeo-connection-string =
+  %(zeo_connection_string)s
+
+timeserver = %(zope_timeserver)s
+
+# Paths
+wrapper = $${basedirectory:services}/%(zope_id)s
+instance-path = $${directory:instance}
+instance-etc = $${directory:instance-etc}
+instance-products = $${directory:instance-products}
+bt5-repository = $${rootdirectory:var}/bt5_repository
+tmp-path = $${rootdirectory:tmp}
+bin-path = $${rootdirectory:bin}
+site-zcml = $${:instance-etc}/site.zcml
+pid-file = $${basedirectory:run}/%(zope_id)s.pid
+lock-file = $${basedirectory:run}/%(zope_id)s.lock
+event-log = $${basedirectory:log}/%(zope_id)s-event.log
+z2-log = $${basedirectory:log}/%(zope_id)s-Z2.log
+configuration-file = $${rootdirectory:etc}/%(zope_id)s.conf
+inituser = $${:instance-path}/inituser
+# Binary information
+runzope-binary = ${buildout:bin-directory}/runzope
+
+# BT5 Configuration
+bt5-repository-list =
+
+[logrotate-entry-%(zope_id)s]
+<= logrotate
+recipe = slapos.cookbook:logrotate.d
+name = %(zope_id)s
+log = $${%(zope_id)s:event-log} $${%(zope_id)s:z2-log}
+post = ${buildout:bin-directory}/killpidfromfile $${%(zope_id)s:pid-file} SIGUSR2
diff --git a/software/erp5/software.cfg b/software/erp5/software.cfg
index 2bf19d74558ca1fcac42908f8a7feb36f4ba0ab3..2f7bae972c476dd4d0937d078a70aee59ea6f861 100644
--- a/software/erp5/software.cfg
+++ b/software/erp5/software.cfg
@@ -5,7 +5,14 @@ extends =
 
 versions = versions
 
+# Local development
+develop =
+  ${:parts-directory}/slapos.cookbook-repository
 parts +=
+# Local development
+  slapos.cookbook-repository
+  check-recipe
+  slapos.cookbook-python2.6
 # Create instance template
   template
   validator
@@ -15,23 +22,124 @@ parts +=
 # development / fast switching environment for whole software
 unzip = true
 
-[instance-recipe]
-# Note: In case if specific instantiation recipe is used this is the place to
-# put its name
-egg = slapos.cookbook
-module = erp5
+# Local development
+[slapos.cookbook-repository]
+recipe = plone.recipe.command
+stop-on-error = true
+location = ${buildout:parts-directory}/${:_buildout_section_name_}
+command = ${git:location}/bin/git clone --branch erp5-generic --quiet http://git.erp5.org/repos/slapos.git ${:location}
+update-command = cd ${:location} && ${git:location}/bin/git pull --quiet
+
+[check-recipe]
+recipe = plone.recipe.command
+stop-on-error = true
+update-command = ${:command}
+command = grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link
+
+[slapos.cookbook-python2.6]
+recipe = zc.recipe.egg
+eggs = slapos.cookbook
+scripts =
+python = python2.6
+
+[template-mariadb]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/instance-mariadb.cfg
+md5sum = 3225a2ba7337505bdeb95867f5028891
+output = ${buildout:directory}/template-mariadb.cfg
+mode = 0644
+
+[template-sphinx]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/instance-sphinx.cfg
+md5sum = b6d196fb9014222dacef13a0d12a445d
+output = ${buildout:directory}/template-sphinx.cfg
+mode = 0644
 
-# Additional Configuration
-configurator_bt5_list = erp5_core_proxy_field_legacy erp5_full_text_myisam_catalog erp5_base erp5_workflow erp5_configurator erp5_configurator_standard erp5_configurator_maxma_demo erp5_configurator_ung
+[template-zope]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/instance-zope.cfg
+md5sum = 6c3e0a56cd152eba4e2d1bdd8086e6d4
+output = ${buildout:directory}/template-zope.cfg
+mode = 0644
+
+[template-cloudooo]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/instance-cloudooo.cfg
+md5sum = 8ea2839e951f26af2bc74b9a8c0fa5c2
+output = ${buildout:directory}/template-cloudooo.cfg
+mode = 0644
+
+[template-snippet-fontconfig]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/snippet-fontconfig.cfg
+md5sum = 76c5d4cd1c8d48648684d9873f1ffed3
+output = ${buildout:directory}/template-snippet-fontconfig.cfg
+mode = 0644
+
+[template-kumofs]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/instance-kumofs.cfg
+md5sum = c12d8dc1925d16a75247971086734aa8
+output = ${buildout:directory}/template-kumofs.cfg
+mode = 0644
 
 [template]
-# Default template for erp5 instance.
 recipe = slapos.recipe.template
 url = ${:_profile_base_location_}/instance.cfg
-md5sum = 53f225e13bf7ebcd88bbc2b038c83b6f
+md5sum = 961d404f5726fce7c4d8b34d7e120077
 output = ${buildout:directory}/template.cfg
 mode = 0644
 
+[template-memcached]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/instance-memcached.cfg
+md5sum = 9a1462f3e34b99f384ae47b48a3a733c
+output = ${buildout:directory}/template-memcached.cfg
+mode = 0644
+
+[template-erp5-development]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/instance-erp5-development.cfg
+md5sum = 38f0e8f1d04fe1e12771c535bc0f2c47
+output = ${buildout:directory}/template-erp5-development.cfg
+mode = 0644
+
+[template-erp5-production]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/instance-erp5-production.cfg
+md5sum = 452bad01b27bf2a97739920a41aac7f3
+output = ${buildout:directory}/template-erp5-production.cfg
+mode = 0644
+
+[template-snippet-zeo]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/snippet-zeo.cfg
+md5sum = ca9ee3825ff90c5c894ff1da8c601552
+output = ${buildout:directory}/template-snippet-zeo.cfg
+mode = 0644
+
+[template-snippet-master]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/snippet-master.cfg
+md5sum = 2c895efb85f6f06ada97073d0c4ba0c8
+output = ${buildout:directory}/template-snippet-master.cfg
+mode = 0644
+
+[template-snippet-zope]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/snippet-zope.cfg
+md5sum = cca86232d644f0050f1f96c270867852
+output = ${buildout:directory}/template-snippet-zope.cfg
+mode = 0644
+
+[template-snippet-backend]
+recipe = slapos.recipe.template
+url = ${:_profile_base_location_}/snippet-backend.cfg
+md5sum = e2b26547ba1435ec1b8e8cd1de89e2c6
+output = ${buildout:directory}/template-snippet-backend.cfg
+mode = 0644
+
 [validator]
 # Default json schema for instance parameters.
 recipe = slapos.recipe.template
@@ -40,124 +148,48 @@ md5sum = cbe1d75339c6cb20e1aef818797face1
 output = ${buildout:directory}/schema.json
 mode = 0644
 
-[versions]
-MySQL-python = 1.2.3
-Paste = 1.7.5.1
-PasteScript = 1.7.4.2
-Products.CMFActionIcons = 2.1.3
-Products.CMFCalendar = 2.2.2
-Products.CMFCore = 2.2.4
-Products.CMFDefault = 2.2.2
-Products.CMFTopic = 2.2.1
-Products.CMFUid = 2.2.1
-Products.DCWorkflowGraph = 0.4nxd001
-Products.ExternalEditor = 1.1.0
-Products.GenericSetup = 1.6.3
-Products.MimetypesRegistry = 2.0.3
-Products.PluggableAuthService = 1.7.5
-Products.PluginRegistry = 1.3b1
-Products.TIDStorage = 5.4.7.dev-r45842
-Products.Zelenium = 1.0.3
-StructuredText = 2.11.1
-Werkzeug = 0.7.1
-buildout-versions = 1.6
-cElementTree = 1.0.5-20051216
-chardet = 1.0.1
-cloudooo = 1.2.3
-cloudooo.handler.ffmpeg = 0.1
-cloudooo.handler.imagemagick = 0.1
-cloudooo.handler.ooo = 0.2
-cloudooo.handler.pdf = 0.1
-csp-eventlet = 0.7.0
-elementtree = 1.2.7-20070827-preview
-erp5.recipe.cmmiforcei686 = 0.1.3
-erp5diff = 0.8.1.5
-eventlet = 0.9.16
-feedparser = 5.0.1
-five.localsitemanager = 2.0.5
-greenlet = 0.3.1
-hexagonit.recipe.cmmi = 1.5.0
-hexagonit.recipe.download = 1.5.0
-http-parser = 0.7.0
-ipdb = 0.6
-meld3 = 0.6.7
-ordereddict = 1.1
-paramiko = 1.7.7.1
-plone.recipe.command = 1.1
-ply = 3.4
-psutil = 0.3.0
-pycrypto = 2.3
-python-ldap = 2.4.3
-python-memcached = 1.47
-restkit = 3.3.1
-rtjp-eventlet = 0.3.2
-slapos.cookbook = 0.25
-slapos.recipe.build = 0.6
-slapos.recipe.template = 1.1
-threadframe = 0.2
-timerserver = 2.0.2
-urlnorm = 1.1.2
-uuid = 1.30
-validictory = 0.7.1
-xupdate-processor = 0.4
-
-# Required by:
-# slapos.core==0.14
-Flask = 0.7.2
-
-# Required by:
-# PasteScript==1.7.4.2
-# cloudooo==1.2.3
-PasteDeploy = 1.5.0
-
-# Required by:
-# cloudooo==1.2.3
-WSGIUtils = 0.7
-
-# Required by:
-# cloudooo==1.2.3
-# slapos.core==0.14
-argparse = 1.1
-
-# Required by:
-# slapos.recipe.template==1.1
-collective.recipe.template = 1.9
-
-# Required by:
-# SOAPpy==0.12.0nxd001
-fpconst = 0.7.2
-
-# Required by:
-# ipdb==0.6
-ipython = 0.11
-
-# Required by:
-# slapos.cookbook==0.25
-netaddr = 0.7.6
-
-# Required by:
-# slapos.core==0.14
-netifaces = 0.4
-
-# Required by:
-# cloudooo==1.2.3
-python-magic = 0.4.0.1
-
-# Required by:
-# slapos.cookbook==0.25
-# slapos.core==0.14
-# zc.buildout==1.5.3-dev-SlapOS-010
-# zc.recipe.egg==1.2.2
-setuptools = 0.6c12dev-r88846
-
-# Required by:
-# slapos.cookbook==0.25
-slapos.core = 0.14
-
-# Required by:
-# slapos.core==0.14
-supervisor = 3.0a10
-
-# Required by:
-# slapos.cookbook==0.25
-xml-marshaller = 0.9.7
+[networkcache]
+# signature certificates of the following uploaders.
+#   Romain Courteaud
+#   Sebastien Robin
+#   Kazuhiko Shiozaki
+signature-certificate-list =
+  -----BEGIN CERTIFICATE-----
+  MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
+  CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5
+  MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl
+  ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF
+  AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw
+  boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX
+  Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA
+  ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX
+  mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC
+  q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g
+  QUUGLQ==
+  -----END CERTIFICATE-----
+  -----BEGIN CERTIFICATE-----
+  MIIB8jCCAVugAwIBAgIJAPu2zchZ2BxoMA0GCSqGSIb3DQEBBQUAMBIxEDAOBgNV
+  BAMMB3RzeGRldjMwHhcNMTExMDE0MTIxNjIzWhcNMTIxMDEzMTIxNjIzWjASMRAw
+  DgYDVQQDDAd0c3hkZXYzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrPbh+
+  YGmo6mWmhVb1vTqX0BbeU0jCTB8TK3i6ep3tzSw2rkUGSx3niXn9LNTFNcIn3MZN
+  XHqbb4AS2Zxyk/2tr3939qqOrS4YRCtXBwTCuFY6r+a7pZsjiTNddPsEhuj4lEnR
+  L8Ax5mmzoi9nE+hiPSwqjRwWRU1+182rzXmN4QIDAQABo1AwTjAdBgNVHQ4EFgQU
+  /4XXREzqBbBNJvX5gU8tLWxZaeQwHwYDVR0jBBgwFoAU/4XXREzqBbBNJvX5gU8t
+  LWxZaeQwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQA07q/rKoE7fAda
+  FED57/SR00OvY9wLlFEF2QJ5OLu+O33YUXDDbGpfUSF9R8l0g9dix1JbWK9nQ6Yd
+  R/KCo6D0sw0ZgeQv1aUXbl/xJ9k4jlTxmWbPeiiPZEqU1W9wN5lkGuLxV4CEGTKU
+  hJA/yXa1wbwIPGvX3tVKdOEWPRXZLg==
+  -----END CERTIFICATE-----
+  -----BEGIN CERTIFICATE-----
+  MIIB7jCCAVegAwIBAgIJAJWA0jQ4o9DGMA0GCSqGSIb3DQEBBQUAMA8xDTALBgNV
+  BAMMBHg2MXMwIBcNMTExMTI0MTAyNDQzWhgPMjExMTEwMzExMDI0NDNaMA8xDTAL
+  BgNVBAMMBHg2MXMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANdJNiFsRlkH
+  vq2kHP2zdxEyzPAWZH3CQ3Myb3F8hERXTIFSUqntPXDKXDb7Y/laqjMXdj+vptKk
+  3Q36J+8VnJbSwjGwmEG6tym9qMSGIPPNw1JXY1R29eF3o4aj21o7DHAkhuNc5Tso
+  67fUSKgvyVnyH4G6ShQUAtghPaAwS0KvAgMBAAGjUDBOMB0GA1UdDgQWBBSjxFUE
+  RfnTvABRLAa34Ytkhz5vPzAfBgNVHSMEGDAWgBSjxFUERfnTvABRLAa34Ytkhz5v
+  PzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAFLDS7zNhlrQYSQO5KIj
+  z2RJe3fj4rLPklo3TmP5KLvendG+LErE2cbKPqnhQ2oVoj6u9tWVwo/g03PMrrnL
+  KrDm39slYD/1KoE5kB4l/p6KVOdeJ4I6xcgu9rnkqqHzDwI4v7e8/D3WZbpiFUsY
+  vaZhjNYKWQf79l6zXfOvphzJ
+  -----END CERTIFICATE-----
diff --git a/software/erp5testnode/instance.cfg b/software/erp5testnode/instance.cfg
index 2b0c318416e2e56226958a4c1174bfadc828c8db..5c75e01d537f21a362dc5e16e83070017998f5af 100644
--- a/software/erp5testnode/instance.cfg
+++ b/software/erp5testnode/instance.cfg
@@ -8,11 +8,11 @@ develop-eggs-directory = ${buildout:develop-eggs-directory}
 [testnode]
 recipe = slapos.cookbook:erp5testnode
 
-buildbot_binary = ${buildout:bin-directory}/buildbot
+git_binary = ${git:location}/bin/git
 slapgrid_partition_binary = ${buildout:bin-directory}/slapgrid-cp
 slapgrid_software_binary = ${buildout:bin-directory}/slapgrid-sr
 slapproxy_binary = ${buildout:bin-directory}/slapproxy
 svn_binary = ${subversion:location}/bin/svn
-git_binary = ${git:location}/bin/git
 svnversion_binary = ${subversion:location}/bin/svnversion
+testnode = ${buildout:bin-directory}/testnode
 zip_binary = ${zip:location}/bin/zip
diff --git a/software/erp5testnode/software.cfg b/software/erp5testnode/software.cfg
index 3fdec1ac67996817ffdbf8143f38dd0b00b8e6f1..d7f8666bc19b3247977c5eb48f52536452da8fdc 100644
--- a/software/erp5testnode/software.cfg
+++ b/software/erp5testnode/software.cfg
@@ -1,8 +1,4 @@
 [buildout]
-extensions =
-  slapos.rebootstrap
-  slapos.zcbworkarounds
-  mr.developer
 
 find-links = http://www.nexedi.org/static/packages/source/slapos.buildout/
     http://dist.repoze.org
@@ -14,10 +10,10 @@ include-site-packages = false
 exec-sitecustomize = false
 
 versions = versions
-rebootstrap-section = python2.6
 
 extends =
-  ../../component/python-2.6/buildout.cfg
+  ../../stack/shacache-client.cfg
+  ../../component/python-2.7/buildout.cfg
   ../../component/subversion/buildout.cfg
   ../../component/git/buildout.cfg
   ../../component/lxml-python/buildout.cfg
@@ -25,37 +21,181 @@ extends =
 
 parts =
   template
-  bootstrap
+  lxml-python
   eggs
   subversion
   zip
   git
+  checkrecipe
 
-[bootstrap]
-recipe = zc.recipe.egg
-eggs = zc.buildout
-suffix =
-scripts =
-    buildout=bootstrap2.6
-arguments = sys.argv[1:] + ["bootstrap"]
+# Separate from site eggs
+allowed-eggs-from-site-packages =
+include-site-packages = false
+exec-sitecustomize = false
+
+# Use only quite well working sites.
+allow-hosts =
+  *.nexedi.org
+  *.python.org
+  *.sourceforge.net
+  dist.repoze.org
+  effbot.org
+  github.com
+  peak.telecommunity.com
+  psutil.googlecode.com
+  www.dabeaz.com
 
-[rebootstrap]
-section = python2.6
-version = 1
+develop =
+  ${:parts-directory}/slapos.cookbook-repository
+  ${:parts-directory}/erp5.util-repository
+
+[checkrecipe]
+recipe = plone.recipe.command
+stop-on-error = true
+update-command = ${:command}
+command = grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link && grep parts ${buildout:develop-eggs-directory}/erp5.util.egg-link
+
+[slapos.cookbook-repository]
+recipe = plone.recipe.command
+location = ${buildout:parts-directory}/${:_buildout_section_name_}
+stop-on-error = true
+repository = http://git.erp5.org/repos/slapos.git
+branch = master
+revision = 33e2a6315965925b3585d3dcbe246055bb852cba
+command = ${git:location}/bin/git clone --quiet -b ${:branch} ${:repository} ${:location} && if [ -n ${:revision} ]; then cd ${:location} && ${git:location}/bin/git reset --quiet --hard ${:revision} ; fi
+update-command = cd ${:location} && ${git:location}/bin/git pull --quiet && if [ -n ${:revision} ]; then cd ${:location} && ${git:location}/bin/git reset --quiet --hard ${:revision} ; fi
+
+[erp5.util-repository]
+recipe = plone.recipe.command
+location = ${buildout:parts-directory}/${:_buildout_section_name_}
+stop-on-error = true
+repository = http://git.erp5.org/repos/erp5.git
+branch = master
+revision = 917d196176e6291d3046abb6177
+command = ${git:location}/bin/git clone --quiet -b ${:branch} ${:repository} ${:location} && if [ -n ${:revision} ]; then cd ${:location} && ${git:location}/bin/git reset --quiet --hard ${:revision} ; fi
+update-command = cd ${:location} && ${git:location}/bin/git pull --quiet && if [ -n ${:revision} ]; then cd ${:location} && ${git:location}/bin/git reset --quiet --hard ${:revision} ; fi
 
 [versions]
 # Use SlapOS patched zc.buildout
-zc.buildout = 1.5.3-dev-SlapOS-001
+zc.buildout = 1.5.3-dev-SlapOS-009
+
+Jinja2 = 2.6
+Werkzeug = 0.8.1
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+lxml = 2.3.2
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.core = 0.19
+slapos.libnetworkcache = 0.10
+slapos.recipe.template = 2.2
+
+# Required by:
+# slapos.core==0.19
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.35  
+PyXML = 0.8.5
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.35  
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.19
+netifaces = 0.6
+
+# Required by:
+# erp5.util==0.3-dev
+# slapos.cookbook==0.35  
+# slapos.core==0.19
+# slapos.libnetworkcache==0.10
+# zc.buildout==1.5.3-dev-SlapOS-009
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.core==0.19
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.35  
+xml-marshaller = 0.9.7   
+
+# Required by:
+# slapos.cookbook==0.35  
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.19
+zope.interface = 3.8.0   
+
 
 [eggs]
 recipe = zc.recipe.egg
+# Just so buildout executes [slapos.cookbook-repository] before [eggs], as
+# - [eggs] references [slapos.cookbook-repository]
+# - [instance-recipe] needs [slapos.cookbook-repository] to be finished
+# - we cannot rely on anything else being executed before [eggs]
+dummy =
+  ${slapos.cookbook-repository:location}
+  ${erp5.util-repository:location}
 eggs =
   ${lxml-python:egg}
+  zc.buildout
+  slapos.libnetworkcache
   slapos.core
   slapos.cookbook
+  erp5.util[testnode]
+
+scripts =
+  testnode = erp5.util.testnode:main
+  slapgrid-cp = slapos.grid.slapgrid:runComputerPartition
+  slapgrid-sr = slapos.grid.slapgrid:runSoftwareRelease
+  slapproxy = slapos.proxy:main
+
+python = python2.7
+
+[lxml-python]
+python = python2.7
 
 [template]
 recipe = slapos.recipe.template
 url = ${:_profile_base_location_}/instance.cfg
 output = ${buildout:directory}/template.cfg
 mode = 0644
+md5sum = 08e3f92bce41efc5bfe044bb9d354786
+
+[networkcache]
+# Romain Courteaud + Sebastien Robin signature certificate
+signature-certificate-list =
+  -----BEGIN CERTIFICATE-----
+  MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
+  CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5
+  MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl
+  ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF
+  AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw
+  boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX
+  Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA
+  ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX
+  mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC
+  q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g
+  QUUGLQ==
+  -----END CERTIFICATE-----
+  -----BEGIN CERTIFICATE-----
+  MIIB8jCCAVugAwIBAgIJAPu2zchZ2BxoMA0GCSqGSIb3DQEBBQUAMBIxEDAOBgNV
+  BAMMB3RzeGRldjMwHhcNMTExMDE0MTIxNjIzWhcNMTIxMDEzMTIxNjIzWjASMRAw
+  DgYDVQQDDAd0c3hkZXYzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrPbh+
+  YGmo6mWmhVb1vTqX0BbeU0jCTB8TK3i6ep3tzSw2rkUGSx3niXn9LNTFNcIn3MZN
+  XHqbb4AS2Zxyk/2tr3939qqOrS4YRCtXBwTCuFY6r+a7pZsjiTNddPsEhuj4lEnR
+  L8Ax5mmzoi9nE+hiPSwqjRwWRU1+182rzXmN4QIDAQABo1AwTjAdBgNVHQ4EFgQU
+  /4XXREzqBbBNJvX5gU8tLWxZaeQwHwYDVR0jBBgwFoAU/4XXREzqBbBNJvX5gU8t
+  LWxZaeQwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQA07q/rKoE7fAda
+  FED57/SR00OvY9wLlFEF2QJ5OLu+O33YUXDDbGpfUSF9R8l0g9dix1JbWK9nQ6Yd
+  R/KCo6D0sw0ZgeQv1aUXbl/xJ9k4jlTxmWbPeiiPZEqU1W9wN5lkGuLxV4CEGTKU
+  hJA/yXa1wbwIPGvX3tVKdOEWPRXZLg==
+  -----END CERTIFICATE-----
diff --git a/software/ezpublish/instance.cfg b/software/ezpublish/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/ezpublish/instance.cfg
+++ b/software/ezpublish/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/ezpublish/software.cfg b/software/ezpublish/software.cfg
index f50f9471861a7d64b5d77c0a2e0a96877acc8471..2cc04866c728eecc6ccbb99b803feff42b97be2e 100644
--- a/software/ezpublish/software.cfg
+++ b/software/ezpublish/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://share.ez.no/content/download/118008/553423/version/3/file/ezpublish_community_project-2011.8-with_ezc.tar.bz2
 md5sum = 76ea4e1de7a3f91c8d24ef3a221e0777
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/ezpublish.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +39,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.6
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/ezpublish/template/ezpublish.inc.php.in b/software/ezpublish/template/ezpublish.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/ezpublish/template/ezpublish.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/joomla/instance.cfg b/software/joomla/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/joomla/instance.cfg
+++ b/software/joomla/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/joomla/software.cfg b/software/joomla/software.cfg
index cdab5864e9118ce5b887a356008511a7d92cab5d..dc4b7e8c11409f25ea8f79c693f6350ef8caf2fa 100644
--- a/software/joomla/software.cfg
+++ b/software/joomla/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://joomlacode.org/gf/download/frsrelease/15278/66554/Joomla_1.7.0-Stable-Full_Package.tar.gz
 md5sum = 19451c0352e4c72d871cc8817126286a
-#If provided tarball does not contain top directory, option shall be changed to false
-strip-top-level-dir = false
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/phpmyadmin.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -54,6 +40,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.6
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/joomla/template/phpmyadmin.inc.php.in b/software/joomla/template/phpmyadmin.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/joomla/template/phpmyadmin.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/kvm/instance.cfg b/software/kvm/instance.cfg
index 92692ed826463fee89291823830c4c861c656fd2..65041a3f9aff4c2f506ad283d6b5520aec5233ce 100644
--- a/software/kvm/instance.cfg
+++ b/software/kvm/instance.cfg
@@ -11,7 +11,7 @@ qemu_path = ${kvm:location}/bin/qemu-system-x86_64
 qemu_img_path = ${kvm:location}/bin/qemu-img
 #slapmonitor_path = ${buildout:bin-directory}/slapmonitor
 #slapreport_path = ${buildout:bin-directory}/slapreport
-websockify_path = ${noVNC:location}/utils/wsproxy.py
+websockify = ${buildout:directory}/bin/websockify
 noVNC_location = ${noVNC:location}
 openssl_binary = ${openssl:location}/bin/openssl
 rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup
diff --git a/software/kvm/software.cfg b/software/kvm/software.cfg
index fb79bf26505f9210754f1410e64b12722a89c62e..541d80f78fdac489e51223edd05641e564ccdf69 100644
--- a/software/kvm/software.cfg
+++ b/software/kvm/software.cfg
@@ -1,77 +1,183 @@
 [buildout]
+extensions =
+  buildout-versions
+  
 extends =
-  ../../stack/kvm.cfg
+  ../../component/dcron/buildout.cfg
+  ../../component/git/buildout.cfg
+  ../../component/gnutls/buildout.cfg
+  ../../component/libpng/buildout.cfg
+  ../../component/libuuid/buildout.cfg
+  ../../component/lxml-python/buildout.cfg
+  ../../component/noVNC/buildout.cfg
+  ../../component/openssl/buildout.cfg
+  ../../component/python-2.7/buildout.cfg
+  ../../component/rdiff-backup/buildout.cfg
+  ../../stack/shacache-client.cfg
 
+develop =
+  ${:parts-directory}/websockify
+
+parts =
+  template
+  kvm
+  eggs
+  check-local-eggs
+
+find-links +=
+  http://www.nexedi.org/static/packages/source/slapos.buildout/
+
+versions = versions
+
+# Use only quite well working sites.
+allow-hosts =
+  *.nexedi.org
+  *.python.org
+  *.sourceforge.net
+  alastairs-place.net
+  dist.repoze.org
+  effbot.org
+  github.com
+  peak.telecommunity.com
+  psutil.googlecode.com
+  www.dabeaz.com
+  www.owlfish.com
+
+#XXX-Cedric : Currently, one can only access to KVM using noVNC.
+#             Ideally one should be able to access KVM by using either NoVNC or VNC.
+#             Problem is : no native crypto support in web browsers. So we have to disable ssl
+#             In qemu builtin vnc server, and make it available only for localhost 
+#             so that only novnc can listen to it.
+
+#XXX-Cedric: Check status of https://github.com/kanaka/noVNC/issues/13 to see
+#            When qemu has builtin support for websockets in vnc server to get rid of 
+#            Websockify (socket <-> websocket proxy server) when it is ready.
+#            May solve previous XXX depending on the implementation.
+
+#XXX-Cedric: Check status of 
+#            https://www.tiolive.com/nexedi/bug_module/20110819-11F4F70 for
+#            Chrome >= 14 and Firefox >=7 can access to noVNC. (should be solved)
+
+#XXX-Cedric : add list of keyboard layouts (azerty/us querty/...) parameter to qemu
+
+[kvm]
+recipe = hexagonit.recipe.cmmi
+url = http://downloads.sourceforge.net/project/kvm/qemu-kvm/0.15.1/qemu-kvm-0.15.1.tar.gz
+md5sum = 8800a7d6b3aa4a168ea7f78dc66c0320
+configure-options =
+  --disable-sdl
+  --disable-xen
+  --enable-vnc-tls
+  --disable-vnc-sasl
+  --disable-curses
+  --disable-curl
+  --enable-kvm
+  --disable-docs
+  --enable-vnc-png
+  --disable-vnc-jpeg
+  --extra-cflags="-I${gnutls:location}/include -I${libuuid:location}/include -I${zlib:location}/include -I${libpng:location}/include"
+  --extra-ldflags="-Wl,-rpath -Wl,${glib:location}/lib -L${glib:location}/lib -Wl,-rpath -Wl,${gnutls:location}/lib -L${gnutls:location}/lib -L${gettext:location}/lib -Wl,-rpath -Wl,${gettext:location}/lib -Wl,-rpath -Wl,${libpng:location}/lib -L${libpng:location}/lib -L${libuuid:location}/lib -Wl,-rpath -Wl,${libuuid:location}/lib -L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -lpng -lz -lgnutls"
+  --disable-werror
+environment =
+  PATH=${pkgconfig:location}/bin:%(PATH)s
+  PKG_CONFIG_PATH=${gnutls:location}/lib/pkgconfig:${glib:location}/lib/pkgconfig
+
+[websockify]
+# XXX-Cedric : use official egg from pypi when it is released
+recipe = plone.recipe.command
+stop-on-error = true
+commit = e7363f43443deb9982bdb5c3db50eec475584b06
+repository = https://github.com/desaintmartin/websockify.git
+location = ${buildout:parts-directory}/${:_buildout_section_name_}
+git-binary = ${git:location}/bin/git
+command = export GIT_SSL_NO_VERIFY=true; (${:git-binary} clone --quiet ${:repository} ${:location} && cd ${:location} && ${:git-binary} reset --hard ${:commit}) || (rm -fr ${:location}; exit 1)
+update-command =
+
+[check-local-eggs]
+recipe = plone.recipe.command
+stop-on-error = true
+update-command = ${:command}
+command = grep parts ${buildout:develop-eggs-directory}/websockify.egg-link
+depends = ${eggs:dummy}
+
+[eggs]
+python = python2.7
+recipe = z3c.recipe.scripts
+dummy =
+  ${websockify:location}
+eggs =
+  ${lxml-python:egg}
+  slapos.cookbook
+  websockify
+  
 [template]
 recipe = slapos.recipe.template
 url = ${:_profile_base_location_}/instance.cfg
-md5sum = d899f2111aab18ad25776f35ed49a91b
+md5sum = 298b146e4efce41bfd58b3f85d064ff1
 output = ${buildout:directory}/template.cfg
 mode = 0644
 
-[kvmsource]
-command =
-  (${git:location}/bin/git clone --quiet http://git.erp5.org/repos/slapos.kvm.git ${:location} && cd ${:location} && ${git:location}/bin/git reset --hard 94ee45cc02e69798cac8209d2296fd1751125018) || (rm -fr ${:location} ; exit 1)
-update-command =
-
 [versions]
+zc.buildout = 1.5.3-dev-SlapOS-010
+
+slapos.cookbook = 0.37
 Jinja2 = 2.6
-Werkzeug = 0.7.1
-buildout-versions = 1.6
+Werkzeug = 0.8.1
+buildout-versions = 1.7
 hexagonit.recipe.cmmi = 1.5.0
-lxml = 2.3
+lxml = 2.3.2
 meld3 = 0.6.7
-numpy = 1.6.1
 plone.recipe.command = 1.1
-slapos.recipe.template = 1.1
+slapos.recipe.template = 2.2
+z3c.recipe.scripts = 1.0.1
 
 # Required by:
-# slapos.core==0.14
-Flask = 0.7.2
+# slapos.core==0.20
+Flask = 0.8
 
 # Required by:
-# slapos.cookbook==0.20
+# slapos.cookbook==0.37
 PyXML = 0.8.4
 
-# Required by:
-# slapos.recipe.template==1.1
-collective.recipe.template = 1.9
-
 # Required by:
 # hexagonit.recipe.cmmi==1.5.0
 hexagonit.recipe.download = 1.5.0
 
 # Required by:
-# slapos.cookbook==0.20
-netaddr = 0.7.5
+# slapos.cookbook==0.37
+netaddr = 0.7.6
 
 # Required by:
-# slapos.core==0.14
-netifaces = 0.5
+# slapos.core==0.20
+netifaces = 0.6
+
+# Required by:
+# websockify==0.1-dev
+numpy = 1.6.1
 
 # Required by:
-# slapos.cookbook==0.20
-# slapos.core==0.14
-# zc.buildout==1.5.3-dev-SlapOS-005
+# slapos.cookbook==0.37
+# slapos.core==0.20
+# zc.buildout==1.5.3-dev-SlapOS-010
 # zc.recipe.egg==1.3.2
 setuptools = 0.6c12dev-r88846
 
 # Required by:
-# slapos.cookbook==0.20
-slapos.core = 0.14
+# slapos.cookbook==0.37
+slapos.core = 0.20
 
 # Required by:
-# slapos.core==0.14
+# slapos.core==0.20
 supervisor = 3.0a10
 
 # Required by:
-# slapos.cookbook==0.20
+# slapos.cookbook==0.37
 xml-marshaller = 0.9.7
 
 # Required by:
-# slapos.cookbook==0.20
+# slapos.cookbook==0.37
 zc.recipe.egg = 1.3.2
 
 # Required by:
-# slapos.core==0.14
-zope.interface = 3.7.0
+# slapos.core==0.20
+zope.interface = 3.8.0
\ No newline at end of file
diff --git a/software/lamp-template/instance.cfg b/software/lamp-template/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..bf66021a36e61438ebb6ba88cf1698b88886097d 100644
--- a/software/lamp-template/instance.cfg
+++ b/software/lamp-template/instance.cfg
@@ -7,8 +7,8 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
+#template = ${application-template:location}/${application-template:filename}
+#configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/lamp-template/software.cfg b/software/lamp-template/software.cfg
index 1b4c9065a2ccdfdc6e04cf8256d10eae4b534de5..41ff1212c7f7ac62cfdceccaa86b79834a3ac0a5 100644
--- a/software/lamp-template/software.cfg
+++ b/software/lamp-template/software.cfg
@@ -10,21 +10,21 @@ parts =
   downloadcache-workaround
   
 extends =
-  http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.50:/stack/lamp.cfg
-  http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.50:/stack/shacache-client.cfg
+  http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.60:/stack/lamp.cfg
+  http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.60:/stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = Student shall put here url of zipped or tarballed web page or application
-#md5sum = Student may put here md5sum of this file, this is good idea
+md5sum = Student may put here md5sum of this file, this is good idea
 #If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
+strip-top-level-dir = true
+#extract-directory = 
 
 [application-template]
 recipe = slapos.recipe.download
 url = Student shall put here url to template file for application
 #md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
 filename = template.in
 mode = 0644
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
@@ -44,10 +44,14 @@ url = ${:_profile_base_location_}/instance.cfg
 output = ${buildout:directory}/template.cfg
 mode = 0644
 
+[mariadb]
+keep-compile-dir = false
+
 [instance-recipe-egg]
 recipe = zc.recipe.egg
 python = python2.7
-eggs = ${instance-recipe:egg}
+eggs = 
+  ${instance-recipe:egg}
 
 [versions]
 # Use SlapOS patched zc.buildout
diff --git a/software/lamp-template/template/php.ini.in b/software/lamp-template/template/php.ini.in
new file mode 100644
index 0000000000000000000000000000000000000000..76dfd3a88e64902fd08f2bcc5f2318a3c7ed6a8b
--- /dev/null
+++ b/software/lamp-template/template/php.ini.in
@@ -0,0 +1,18 @@
+[PHP]
+engine = On
+safe_mode = Off
+expose_php = Off
+error_reporting = E_ALL & ~(E_DEPRECATED|E_NOTICE|E_WARNING)
+display_errors = On
+display_startup_errors = Off
+log_errors = On
+log_errors_max_len = 1024
+ignore_repeated_errors = Off
+ignore_repeated_source = Off
+session.save_path = "%(tmp_directory)s"
+session.auto_start = 0
+date.timezone = Europe/Paris
+file_uploads = On
+upload_max_filesize = 16M
+post_max_size = 16M
+magic_quotes_gpc=Off
diff --git a/software/xoops/template/wp-config.php.in b/software/lamp-template/template/wp-config.php.in
similarity index 97%
rename from software/xoops/template/wp-config.php.in
rename to software/lamp-template/template/wp-config.php.in
index 385c4aa990ee2962f535bf1fa81d8010296bce5a..217ef3acdee00329e2f760e8746f1b2e48440bab 100644
--- a/software/xoops/template/wp-config.php.in
+++ b/software/lamp-template/template/wp-config.php.in
@@ -1,90 +1,90 @@
-<?php
-/**
- * The base configurations of the WordPress.
- *
- * This file has the following configurations: MySQL settings, Table Prefix,
- * Secret Keys, WordPress Language, and ABSPATH. You can find more information
- * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
- * wp-config.php} Codex page. You can get the MySQL settings from your web host.
- *
- * This file is used by the wp-config.php creation script during the
- * installation. You don't have to use the web site, you can just copy this file
- * to "wp-config.php" and fill in the values.
- *
- * @package WordPress
- */
-
-// ** MySQL settings - You can get this info from your web host ** //
-/** The name of the database for WordPress */
-define('DB_NAME', 'Put here mysql database name template key');
-
-/** MySQL database username */
-define('DB_USER', 'Put here mysql user template key');
-
-/** MySQL database password */
-define('DB_PASSWORD', 'Put here mysql password template key');
-
-/** MySQL hostname */
-define('DB_HOST', 'Put here mysql host template key');
-
-/** Database Charset to use in creating database tables. */
-define('DB_CHARSET', 'utf8');
-
-/** The Database Collate type. Don't change this if in doubt. */
-define('DB_COLLATE', '');
-
-/**#@+
- * Authentication Unique Keys and Salts.
- *
- * Change these to different unique phrases!
- * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
- * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
- *
- * @since 2.6.0
- */
-define('AUTH_KEY',         'put your unique phrase here');
-define('SECURE_AUTH_KEY',  'put your unique phrase here');
-define('LOGGED_IN_KEY',    'put your unique phrase here');
-define('NONCE_KEY',        'put your unique phrase here');
-define('AUTH_SALT',        'put your unique phrase here');
-define('SECURE_AUTH_SALT', 'put your unique phrase here');
-define('LOGGED_IN_SALT',   'put your unique phrase here');
-define('NONCE_SALT',       'put your unique phrase here');
-
-/**#@-*/
-
-/**
- * WordPress Database Table prefix.
- *
- * You can have multiple installations in one database if you give each a unique
- * prefix. Only numbers, letters, and underscores please!
- */
-$table_prefix  = 'wp_';
-
-/**
- * WordPress Localized Language, defaults to English.
- *
- * Change this to localize WordPress. A corresponding MO file for the chosen
- * language must be installed to wp-content/languages. For example, install
- * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
- * language support.
- */
-define('WPLANG', '');
-
-/**
- * For developers: WordPress debugging mode.
- *
- * Change this to true to enable the display of notices during development.
- * It is strongly recommended that plugin and theme developers use WP_DEBUG
- * in their development environments.
- */
-define('WP_DEBUG', false);
-
-/* That's all, stop editing! Happy blogging. */
-
-/** Absolute path to the WordPress directory. */
-if ( !defined('ABSPATH') )
-	define('ABSPATH', dirname(__FILE__) . '/');
-
-/** Sets up WordPress vars and included files. */
-require_once(ABSPATH . 'wp-settings.php');
+<?php
+/**
+ * The base configurations of the WordPress.
+ *
+ * This file has the following configurations: MySQL settings, Table Prefix,
+ * Secret Keys, WordPress Language, and ABSPATH. You can find more information
+ * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
+ * wp-config.php} Codex page. You can get the MySQL settings from your web host.
+ *
+ * This file is used by the wp-config.php creation script during the
+ * installation. You don't have to use the web site, you can just copy this file
+ * to "wp-config.php" and fill in the values.
+ *
+ * @package WordPress
+ */
+
+// ** MySQL settings - You can get this info from your web host ** //
+/** The name of the database for WordPress */
+define('DB_NAME', 'Put here mysql database name template key');
+
+/** MySQL database username */
+define('DB_USER', 'Put here mysql user template key');
+
+/** MySQL database password */
+define('DB_PASSWORD', 'Put here mysql password template key');
+
+/** MySQL hostname */
+define('DB_HOST', 'Put here mysql host template key');
+
+/** Database Charset to use in creating database tables. */
+define('DB_CHARSET', 'utf8');
+
+/** The Database Collate type. Don't change this if in doubt. */
+define('DB_COLLATE', '');
+
+/**#@+
+ * Authentication Unique Keys and Salts.
+ *
+ * Change these to different unique phrases!
+ * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
+ * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
+ *
+ * @since 2.6.0
+ */
+define('AUTH_KEY',         'put your unique phrase here');
+define('SECURE_AUTH_KEY',  'put your unique phrase here');
+define('LOGGED_IN_KEY',    'put your unique phrase here');
+define('NONCE_KEY',        'put your unique phrase here');
+define('AUTH_SALT',        'put your unique phrase here');
+define('SECURE_AUTH_SALT', 'put your unique phrase here');
+define('LOGGED_IN_SALT',   'put your unique phrase here');
+define('NONCE_SALT',       'put your unique phrase here');
+
+/**#@-*/
+
+/**
+ * WordPress Database Table prefix.
+ *
+ * You can have multiple installations in one database if you give each a unique
+ * prefix. Only numbers, letters, and underscores please!
+ */
+$table_prefix  = 'wp_';
+
+/**
+ * WordPress Localized Language, defaults to English.
+ *
+ * Change this to localize WordPress. A corresponding MO file for the chosen
+ * language must be installed to wp-content/languages. For example, install
+ * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
+ * language support.
+ */
+define('WPLANG', '');
+
+/**
+ * For developers: WordPress debugging mode.
+ *
+ * Change this to true to enable the display of notices during development.
+ * It is strongly recommended that plugin and theme developers use WP_DEBUG
+ * in their development environments.
+ */
+define('WP_DEBUG', false);
+
+/* That's all, stop editing! Happy blogging. */
+
+/** Absolute path to the WordPress directory. */
+if ( !defined('ABSPATH') )
+	define('ABSPATH', dirname(__FILE__) . '/');
+
+/** Sets up WordPress vars and included files. */
+require_once(ABSPATH . 'wp-settings.php');
diff --git a/software/magento/instance.cfg b/software/magento/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/magento/instance.cfg
+++ b/software/magento/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/magento/software.cfg b/software/magento/software.cfg
index 727232f3f2c5b5f36be4379bc08fa1fa85e8ae75..2f188d08b5086915dde38c6fda78415c72e24869 100644
--- a/software/magento/software.cfg
+++ b/software/magento/software.cfg
@@ -13,23 +13,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://www.magentocommerce.com/downloads/assets/1.6.0.0/magento-1.6.0.0.tar.gz
 md5sum = 7415eb1c70b7694ab632326d9fcc850a
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/magento.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
 
 [instance-recipe]
 egg = slapos.cookbook
@@ -52,6 +38,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.6
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/magento/template/magento.inc.php.in b/software/magento/template/magento.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/magento/template/magento.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/net2ftp/configure.py b/software/net2ftp/configure.py
index 041a0e0fece6bd8fc9963aa25c90ece4ef48676f..2c16f4e3c75dde1365314ab6b9f05c7006d7de29 100644
--- a/software/net2ftp/configure.py
+++ b/software/net2ftp/configure.py
@@ -3,7 +3,7 @@ import os
 import MySQLdb
 
 def setup(args):
-    base_url, htdocs, renamed, mysql_user, mysql_password, mysql_database, mysql_host = args
+    mysql_port, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args
     
     sql_file = os.path.join(htdocs, "create_tables.sql")
     try:
diff --git a/software/net2ftp/instance.cfg b/software/net2ftp/instance.cfg
index 172e8c42f9758b98bf443df3769a7a8a2a7e9d8c..6939e38b9f9827fc20c253da9e6ea4237f9eb39b 100644
--- a/software/net2ftp/instance.cfg
+++ b/software/net2ftp/instance.cfg
@@ -9,6 +9,7 @@ recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
 template = ${application-template:location}/${application-template:filename}
 configuration = ${application-configuration:location}
+lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/net2ftp/software.cfg b/software/net2ftp/software.cfg
index 53ff8571931398319d2208624d8cfebbb1a93f54..f9be7886f0ae00e08383476b6cc215ca3189e4e8 100644
--- a/software/net2ftp/software.cfg
+++ b/software/net2ftp/software.cfg
@@ -15,27 +15,23 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = slapos.recipe.build
+recipe = slapos.recipe.build:download-unpacked
 url = http://www.net2ftp.com/download/net2ftp_v0.98.zip
 md5sum = 5a2741b5881f3f229a788958dc6cdf10
-script =
-  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
-  extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
-  workdir = guessworkdir(extract_dir)
-  self.copyTree(workdir + "/files_to_upload", "${buildout:parts-directory}/${:_buildout_section_name_}")
+extract-directory = files_to_upload
 
 [configure-script]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.download
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
 url = ${:_profile_base_location_}/configure.py
+md5sum = f7e1766468f7a8d51d311541164c3ff4
 filename = configure.py
-download-only = True
+mode = 0744
 
 [application-template]
 recipe = slapos.recipe.download
 url = ${:_profile_base_location_}/template/net2ftp.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
+md5sum = 5ad3b2b42affd83229f0666c480b90cb
 filename = template.in
 mode = 0644
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
@@ -58,12 +54,93 @@ mode = 0644
 [instance-recipe-egg]
 recipe = zc.recipe.egg
 python = python2.7
-eggs = ${instance-recipe:egg}
+eggs =
+    ${mysql-python:egg}
+    ${instance-recipe:egg}
+    slapos.toolbox[lampconfigure]
 
 [versions]
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.6
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/openX/instance.cfg b/software/openX/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/openX/instance.cfg
+++ b/software/openX/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/openX/software.cfg b/software/openX/software.cfg
index aac40c190a689eeba3d402d91126e1b6a1bfd279..88fa8ec808480e9aa1169a8f68805eb0fd34880a 100644
--- a/software/openX/software.cfg
+++ b/software/openX/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://download.openx.org/openx-2.8.7.tar.gz
 md5sum = 23fa5052af6d4411e8b84284894ff619
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/openx.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +39,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.6
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/openX/template/openx.inc.php.in b/software/openX/template/openx.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/openX/template/openx.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/os-commerce/instance.cfg b/software/os-commerce/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/os-commerce/instance.cfg
+++ b/software/os-commerce/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/os-commerce/software.cfg b/software/os-commerce/software.cfg
index 19fb9d08269924cc1af760b6ede3d15e7b1a375b..cd811f8c8c474250d5594975c02d4b1b3060c9ba 100644
--- a/software/os-commerce/software.cfg
+++ b/software/os-commerce/software.cfg
@@ -14,26 +14,10 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = slapos.recipe.build
+recipe = slapos.recipe.build:download-unpacked
 url = http://www.oscommerce.com/files/oscommerce-3.0.2.zip
 md5sum = 680caf7dde7cf7772a576ef3930970ff
-script =
-  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
-  extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
-  workdir = guessworkdir(extract_dir)
-  self.copyTree(workdir + "/oscommerce", "${buildout:parts-directory}/${:_buildout_section_name_}")
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/os-commerce.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
+extract-directory = oscommerce
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -56,6 +40,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.6
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/os-commerce/template/os-commerce.inc.php.in b/software/os-commerce/template/os-commerce.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/os-commerce/template/os-commerce.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/phpbb/instance.cfg b/software/phpbb/instance.cfg
index 5a93bab7aed2cfdc3864b80cb68a4aaa1ffb0b6d..a099e8a108a173ef184c8988c5440f079445c326 100644
--- a/software/phpbb/instance.cfg
+++ b/software/phpbb/instance.cfg
@@ -7,8 +7,7 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
+lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/phpbb/software.cfg b/software/phpbb/software.cfg
index 3b0699c92603ba5a195980fce5986939aa1fbc0d..13b92d52ae8721d21e65c780260c3ce3838eddf2 100644
--- a/software/phpbb/software.cfg
+++ b/software/phpbb/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://www.phpbb.com/files/release/phpBB-3.0.9.zip
 md5sum = fb8025a51a3c756fe6151a6b0beeefd4
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/phpbb.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
 
 [instance-recipe]
 egg = slapos.cookbook
@@ -47,12 +33,93 @@ mode = 0644
 [instance-recipe-egg]
 recipe = zc.recipe.egg
 python = python2.7
-eggs = ${instance-recipe:egg}
+eggs =
+    ${mysql-python:egg}
+    ${instance-recipe:egg}
+    slapos.toolbox[lampconfigure]
 
 [versions]
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/phpbb/template/phpbb.inc.php.in b/software/phpbb/template/phpbb.inc.php.in
deleted file mode 100644
index 0c39feef34495c81a59b87d10398294b24c402c0..0000000000000000000000000000000000000000
--- a/software/phpbb/template/phpbb.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = 'Put here mysql host template key';
-$cfg['Servers'][$i]['port'] = 'Put here mysql port template key';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/phpmyadmin/software.cfg b/software/phpmyadmin/software.cfg
index 22a17ba00fe21baff72c52eb300f8f6d072c733d..98f4c2fc650e7250c8c97d6e5c2a280301895fa7 100644
--- a/software/phpmyadmin/software.cfg
+++ b/software/phpmyadmin/software.cfg
@@ -21,15 +21,14 @@ output = ${buildout:directory}/template.cfg
 mode = 0644
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.10/phpMyAdmin-3.3.10-all-languages.tar.bz2?r=http%3A%2F%2Fwww.phpmyadmin.net%2Fhome_page%2Fdownloads.php&ts=1300959842&use_mirror=sunet
-#md5sum = Student may put here md5sum of this file, this is good idea
+md5sum = cb7a632fb4f10a180ead15f7f90087f1
 
 [application-template]
 recipe = slapos.recipe.download
 url = ${:_profile_base_location_}/phpmyadmin.inc.php.in
 md5sum = caab45c34c75661c214f4628ff545bb4
-download-only = True
 filename = template.in
 mode = 0644
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
@@ -41,24 +40,102 @@ location = config.inc.php
 egg = slapos.cookbook
 module = lamp.simple
 
+
 [instance-recipe-egg]
 recipe = zc.recipe.egg
 python = python2.7
 eggs = ${instance-recipe:egg}
 
 [versions]
-slapos.cookbook = 0.12
-
-# Required by slapos.cookbook==0.12
-slapos.core = 0.8
-collective.recipe.template = 1.8
-netaddr = 0.7.5
-xml-marshaller = 0.9.7
-setuptools = 0.6c12dev-r88795
+# Use SlapOS patched zc.buildout
+zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
 hexagonit.recipe.cmmi = 1.5.0
-hexagonit.recipe.download = 1.5.0
+meld3 = 0.6.7
 plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
 
-# Use SlapOS patched zc.buildout
-zc.buildout = 1.5.3-dev-SlapOS-005
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
+[downloadcache-workaround]
+# workaround irritating problem of hexagonit.recipe.cmmi which automatically
+# creates download cache, which in turn switches builout to "semi-offline" mode
+recipe = plone.recipe.command
+# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
+# to ${buildout:directory}/downloads but this variable is available late, that's
+# why it is hardcoded only for required case
+download-cache = ${buildout:directory}/downloads
+command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
+update-command = ${:command}
+stop-on-error = True
diff --git a/software/phpnuke/software.cfg b/software/phpnuke/software.cfg
index 2ea6c153322a491f9bdf55f0d0924bd3494dfb40..6cd02bcabb07e4b705093fde1384ddc586430e64 100644
--- a/software/phpnuke/software.cfg
+++ b/software/phpnuke/software.cfg
@@ -14,20 +14,15 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = slapos.recipe.build
+recipe = slapos.recipe.build:download-unpacked
 url = http://phpnuke.org/modules/Release/files/phpnuke-release-8.2.4.tar.gz
 md5sum = 0f31895b141f50a5f2e6f083b0222fe2
-script =
-  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
-  extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
-  workdir = guessworkdir(extract_dir)
-  self.copyTree(workdir + "/html", "${buildout:parts-directory}/${:_buildout_section_name_}")
+extract-directory = html
 
 [application-template]
 recipe = slapos.recipe.download
 url = ${:_profile_base_location_}/template/phpnuke.inc.php.in
 #md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
 filename = template.in
 mode = 0644
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
@@ -56,6 +51,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/pimcore/instance.cfg b/software/pimcore/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/pimcore/instance.cfg
+++ b/software/pimcore/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/pimcore/software.cfg b/software/pimcore/software.cfg
index 1376b3398024a6cdd33edcd0c8ddfd5223d5be44..6b6b275efd6eeac21bf1571048c332b283eb5b11 100644
--- a/software/pimcore/software.cfg
+++ b/software/pimcore/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://www.pimcore.org/download/pimcore-latest.zip
-md5sum = 58cfa935ed308476b95cf364af7719c3
-#If provided tarball does not contain top directory, option shall be changed to false
-strip-top-level-dir = false
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/pimcore.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
+md5sum = 5cc0351fb01bca93f384071bff69be2e
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +39,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/pimcore/template/pimcore.inc.php.in b/software/pimcore/template/pimcore.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/pimcore/template/pimcore.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/piwigo/software.cfg b/software/piwigo/software.cfg
index 262c91e8ef600861d9918a83c005e29666e30c82..2747aca0bc12389fc60e65485dbf03f8c56a5ceb 100644
--- a/software/piwigo/software.cfg
+++ b/software/piwigo/software.cfg
@@ -14,23 +14,21 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://piwigo.org/download/dlcounter.php?code=latest
 md5sum = 13870130dcdda90bf2d2e3c20a49b04f
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
 
 [application-template]
 recipe = slapos.recipe.download
 url = ${:_profile_base_location_}/template/piwigo.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
+md5sum = 8ca6d1408b468c6836cd0edaf02688e5
 download-only = True
 filename = template.in
 mode = 0644
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
 
 [application-configuration]
-location = config.inc.php
+location = database.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +51,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/piwigo/template/piwigo.inc.php.in b/software/piwigo/template/piwigo.inc.php.in
index 0c39feef34495c81a59b87d10398294b24c402c0..086ca0a54fd3effd99eb6e25b6a101293706d121 100644
--- a/software/piwigo/template/piwigo.inc.php.in
+++ b/software/piwigo/template/piwigo.inc.php.in
@@ -1,25 +1,15 @@
 <?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = 'Put here mysql host template key';
-$cfg['Servers'][$i]['port'] = 'Put here mysql port template key';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
+$conf['dblayer'] = 'mysql';
+$conf['db_base'] = '%(mysql_database)s';
+$conf['db_user'] = '%(mysql_user)s';
+$conf['db_password'] = '%(mysql_password)s';
+$conf['db_host'] = '%(mysql_host)s';
 
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
+$prefixeTable = 'piwigo_';
+
+define('PHPWG_INSTALLED', true);
+define('PWG_CHARSET', 'utf-8');
+define('DB_CHARSET', 'utf8');
+define('DB_COLLATE', '');
 
 ?>
diff --git a/software/piwik/instance.cfg b/software/piwik/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/piwik/instance.cfg
+++ b/software/piwik/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/piwik/software.cfg b/software/piwik/software.cfg
index ede2f90a39b3fc616851dfd7bc38d5ab4ca0cc38..2c6ba74a89b7042225ffc57c889075674e8e9e81 100644
--- a/software/piwik/software.cfg
+++ b/software/piwik/software.cfg
@@ -15,26 +15,10 @@ extends =
 
 
 [application]
-recipe = slapos.recipe.build
+recipe = slapos.recipe.build:download-unpacked
 url = http://piwik.org/latest.zip
-md5sum = fd16c7a15573c93feefd1dcba3ca40ba
-script =
-  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
-  extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
-  workdir = guessworkdir(extract_dir)
-  self.copyTree(workdir + "/piwik", "${buildout:parts-directory}/${:_buildout_section_name_}")
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/piwik.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
+md5sum = 04c5dc7f595adce4d68be9f94bbb140c
+extract-directory = piwik
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -57,6 +41,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/piwik/template/piwik.inc.php.in b/software/piwik/template/piwik.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/piwik/template/piwik.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/prestashop/instance.cfg b/software/prestashop/instance.cfg
index aada7ce6e2f4dd71f9c15d8d8ec537768ad6907a..6f59ff8879a332b7c863ebb10ebc73f6a06b5235 100644
--- a/software/prestashop/instance.cfg
+++ b/software/prestashop/instance.cfg
@@ -7,8 +7,7 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
+lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
@@ -16,7 +15,7 @@ mysql_install_binary = ${mariadb:location}/bin/mysql_install_db
 mysql_upgrade_binary = ${mariadb:location}/bin/mysql_upgrade
 mysqld_binary = ${mariadb:location}/libexec/mysqld
 
-delete = install, CHANGELOG.txt, readme_de.txt, readme_en.txt, readme_fr.txt, readme_it.txt, readme_es.txt
+delete = install
 rename = admin
 #file_token = name of file who will be created at the end of installation
 table_name = configuration
diff --git a/software/prestashop/software.cfg b/software/prestashop/software.cfg
index 79cb4f1c74bfa02f430f4dc72bd3a03542010a61..3279c34a9963565445cae0f3893b98a02208682a 100644
--- a/software/prestashop/software.cfg
+++ b/software/prestashop/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
-url = http://www.prestashop.com/download/prestashop_1.4.4.1.zip
-md5sum = 08206798517ea22c0122640b05c7df73
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/prestashop.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
+recipe = slapos.recipe.build:download-unpacked
+url = http://www.prestashop.com/download/prestashop_1.4.5.1.zip
+md5sum = 3d19305d728f7e8a19f81f9f326b9383
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -40,7 +26,6 @@ module = lamp.simple
 # Default template for the instance.
 recipe = slapos.recipe.template
 url = ${:_profile_base_location_}/instance.cfg
-#${:_profile_base_location_}/instance.cfg
 #md5sum = Student shall put md5 of instance.cfg here
 output = ${buildout:directory}/template.cfg
 mode = 0644
@@ -48,12 +33,93 @@ mode = 0644
 [instance-recipe-egg]
 recipe = zc.recipe.egg
 python = python2.7
-eggs = ${instance-recipe:egg}
+eggs =
+    ${mysql-python:egg}
+    ${instance-recipe:egg}
+    slapos.toolbox[lampconfigure]
 
 [versions]
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/prestashop/template/prestashop.inc.php.in b/software/prestashop/template/prestashop.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/prestashop/template/prestashop.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/punbb/software.cfg b/software/punbb/software.cfg
index 144979b58a8efdf3c7b5ca08fc8b1a401a1c8527..3a7e9fb62e6a994050a7f829df7bf380d61ec152 100644
--- a/software/punbb/software.cfg
+++ b/software/punbb/software.cfg
@@ -14,17 +14,14 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://punbb.informer.com/download/punbb-1.3.6.tar.gz
 md5sum = 9454ef78101028fd5acf2731f77545c2
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
 
 [application-template]
 recipe = slapos.recipe.download
 url = ${:_profile_base_location_}/template/punbb.inc.php.in
 #md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
 filename = template.in
 mode = 0644
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
@@ -53,6 +50,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/punbb/template/punbb.inc.php.in b/software/punbb/template/punbb.inc.php.in
index 0c39feef34495c81a59b87d10398294b24c402c0..c05779b29363d8ad764c2669dd8298e6261f920a 100644
--- a/software/punbb/template/punbb.inc.php.in
+++ b/software/punbb/template/punbb.inc.php.in
@@ -1,25 +1,18 @@
 <?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = 'Put here mysql host template key';
-$cfg['Servers'][$i]['port'] = 'Put here mysql port template key';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
 
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
+$db_type = 'mysqli';
+$db_host = '%(mysql_host)s';
+$db_name = '%(mysql_database)s';
+$db_username = '%(mysql_user)s';
+$db_password = '%(mysql_password)s';
+$db_prefix = 'pbb_';
+$p_connect = false;
 
-?>
+$base_url = 'http://webrunner:9080';
+
+$cookie_name = 'forum_cookie_173f50';
+$cookie_domain = '';
+$cookie_path = '/';
+$cookie_secure = 0;
+
+define('FORUM', 1);
diff --git a/software/simple Machine Forum/template/simplemachine.inc.php.in b/software/simple Machine Forum/template/simplemachine.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/simple Machine Forum/template/simplemachine.inc.php.in	
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/simple Machine Forum/instance.cfg b/software/simpleMachineForum/instance.cfg
similarity index 79%
rename from software/simple Machine Forum/instance.cfg
rename to software/simpleMachineForum/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/simple Machine Forum/instance.cfg	
+++ b/software/simpleMachineForum/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/simple Machine Forum/software.cfg b/software/simpleMachineForum/software.cfg
similarity index 51%
rename from software/simple Machine Forum/software.cfg
rename to software/simpleMachineForum/software.cfg
index b2204e1dfd3e817629bb05dbfa71eba70575daa8..5bbc3ea48ed53f1ed28a92eab6cb3e956ce1aacd 100644
--- a/software/simple Machine Forum/software.cfg	
+++ b/software/simpleMachineForum/software.cfg
@@ -15,23 +15,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://mirror.ord.simplemachines.org/downloads/smf_2-0-1_install.tar.gz
 md5sum = 76817fc9f4620765bba4232bbf8b6b2b
-#If provided tarball does not contain top directory, option shall be changed to false
-strip-top-level-dir = false
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/simplemachine.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -54,6 +40,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/spip/instance.cfg b/software/spip/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/spip/instance.cfg
+++ b/software/spip/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/spip/software.cfg b/software/spip/software.cfg
index 816d5480c7177735db6e76e254dbdffaf8941f6e..f4986301e71011fb9e3bb3a7314bb7cefe34a2b5 100644
--- a/software/spip/software.cfg
+++ b/software/spip/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://files.spip.org/spip/stable/spip.zip?1316156624
 md5sum = 4500c283b464161da6fced7dce12ae0a
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/spip.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +39,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/spip/template/spip.inc.php.in b/software/spip/template/spip.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/spip/template/spip.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/statusnet/instance.cfg b/software/statusnet/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/statusnet/instance.cfg
+++ b/software/statusnet/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/statusnet/software.cfg b/software/statusnet/software.cfg
index 7d5e5dddd1c650f05d44df5171722bc63f1db9a6..b76c8a7cf46cfc71a826ce865adfe638a8328a46 100644
--- a/software/statusnet/software.cfg
+++ b/software/statusnet/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://status.net/statusnet-1.0.1.tar.gz
 md5sum = 727a7cfe7e9531b732739dabd295bcb9
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/statusnet.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -52,7 +38,84 @@ eggs = ${instance-recipe:egg}
 [versions]
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
-slapos.cookbook = 0.30
+
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
 
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
diff --git a/software/statusnet/template/statusnet.inc.php.in b/software/statusnet/template/statusnet.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/statusnet/template/statusnet.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/sugar-crm/instance.cfg b/software/sugar-crm/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/sugar-crm/instance.cfg
+++ b/software/sugar-crm/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/sugar-crm/software.cfg b/software/sugar-crm/software.cfg
index c31e9154e3efe7d067279fb694aeddfd8f84a2e7..a53dd0b54cecd1e0eca726d9a04a4ef132a0cefa 100644
--- a/software/sugar-crm/software.cfg
+++ b/software/sugar-crm/software.cfg
@@ -14,24 +14,10 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
-url = http://www.sugarforge.org/frs/download.php/8516/SugarCE-6.3.0RC1.zip
-md5sum = ee9719b1ae2a11105eedc94c6676d7a4
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/sugar-crm.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
+recipe = slapos.recipe.build:download-unpacked
+url = http://www.sugarforge.org/frs/download.php/8558/SugarCE-6.3.0RC3.zip
+md5sum = ff4cf7c6f673f9f3f6e082c62736f628
 
-[application-configuration]
-location = config.inc.php
-  
 [instance-recipe]
 egg = slapos.cookbook
 module = lamp.simple
@@ -53,6 +39,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/sugar-crm/template/sugar-crm.inc.php.in b/software/sugar-crm/template/sugar-crm.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/sugar-crm/template/sugar-crm.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/tiki/instance.cfg b/software/tiki/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/tiki/instance.cfg
+++ b/software/tiki/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/tiki/software.cfg b/software/tiki/software.cfg
index 0356b7b9d0309d45b69ccbc15d66f8e917272417..8b98c2ff0091865528b1828dde9d97b4604f330f 100644
--- a/software/tiki/software.cfg
+++ b/software/tiki/software.cfg
@@ -14,23 +14,9 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://freefr.dl.sourceforge.net/project/tikiwiki/Tiki_7.x_Electra/7.1/tiki-7.1.tar.gz
 md5sum = 02c832eaaa107cd7c76f9d94f400eaf5
-#If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/tiki.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -53,6 +39,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/tiki/template/tiki.inc.php.in b/software/tiki/template/tiki.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/tiki/template/tiki.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/software/vifib/software.cfg b/software/vifib/software.cfg
index 7a503c5c1f6b297ce0f4049d1c87f7cbbca9edc8..8a9e6c3f5286d45d9c0c9ebeb4b0f8acc1f17d7d 100644
--- a/software/vifib/software.cfg
+++ b/software/vifib/software.cfg
@@ -4,9 +4,23 @@ extends =
 
 parts +=
   vifib
+  check-slapos.core
+
+develop =
+  ${:parts-directory}/vifib
+
+[check-slapos.core]
+recipe = plone.recipe.command
+stop-on-error = true
+update-command = ${:command}
+command = grep parts ${buildout:develop-eggs-directory}/slapos.core.egg-link
 
 [eggs]
-eggs += slapos.core
+dummy =
+  ${vifib:location}
+eggs +=
+  suds
+  slapos.core
 
 [instance-recipe]
 module = vifib
@@ -20,8 +34,7 @@ repository_id_list += vifib/master
 [vifib]
 <= erp5
 repository = http://git.erp5.org/repos/slapos.core.git
-# tag: vifib-0.2
-revision = f42ad28f0aa47d8cdb028ce6a1796eb7ef6f066e
+revision =
 
 [local-bt5-repository]
 # XXX: workaround for zc.buildout bug, as list += ends up with adding new entry
diff --git a/software/wordpress/software.cfg b/software/wordpress/software.cfg
index ca0b4789c54b2472d0d1a5d1fe41f912ceedb779..2fdbe16e7188a31ca322fb228a30bcaac3c9ad0a 100644
--- a/software/wordpress/software.cfg
+++ b/software/wordpress/software.cfg
@@ -24,18 +24,5 @@ location = wp-config.php
 md5sum = b38ed547eaf2b0e63e335a7eaaf891bb
   
 [versions]
-#slapos.cookbook = 0.12
-
-# Required by slapos.cookbook==0.12
-slapos.core = 0.8
-collective.recipe.template = 1.8
-netaddr = 0.7.5
-xml-marshaller = 0.9.7
-setuptools = 0.6c12dev-r88795
-
-hexagonit.recipe.cmmi = 1.5.0
-hexagonit.recipe.download = 1.5.0
-plone.recipe.command = 1.1
-
 # Use SlapOS patched zc.buildout
-zc.buildout = 1.6.0-dev-SlapOS-002
+zc.buildout = 1.6.0-dev-SlapOS-003
diff --git a/software/xoops/instance.cfg b/software/xoops/instance.cfg
index fffebea8fe2c6c76697fe4be87552f265614a35d..9495bde7e7cadfe7dcb518156bf58a4f6a9c2a1c 100644
--- a/software/xoops/instance.cfg
+++ b/software/xoops/instance.cfg
@@ -7,8 +7,6 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/xoops/software.cfg b/software/xoops/software.cfg
index e9390f06be50ac4f272a2d15cd791e3fcb6823d4..2b814844c0f5d9144d759df826a0d4cb583d4b06 100644
--- a/software/xoops/software.cfg
+++ b/software/xoops/software.cfg
@@ -14,26 +14,10 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = slapos.recipe.build
+recipe = slapos.recipe.build:download-unpacked
 url = http://freefr.dl.sourceforge.net/project/xoops/XOOPS%20Core%20(stable%20releases)/XOOPS%202.5.1/xoops-2.5.1a.zip
 md5sum = 616f06443ae1a2dcea7191069492ccd2
-script =
-  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
-  extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
-  workdir = guessworkdir(extract_dir)
-  self.copyTree(workdir + "/htdocs", "${buildout:parts-directory}/${:_buildout_section_name_}")
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/xoops.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
+extract-directory = htdocs
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -56,6 +40,84 @@ eggs = ${instance-recipe:egg}
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.5
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/zencart/configure.py b/software/zencart/configure.py
index 1214854c423696457b56c341e4ad41d6c0822d67..1f6eb6a92deb40f3b4633353e9f1361d322d6df4 100644
--- a/software/zencart/configure.py
+++ b/software/zencart/configure.py
@@ -3,10 +3,9 @@ import os
 import fileinput
 
 def setup(args):
-    base_url, htdocs, renamed, mysql_user, mysql_password, mysql_database, mysql_host = args
+    mysql_port, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args
     
-    rename = renamed.split(", ")
-    admin_dir = rename[0].split("=>")[1].strip()
+    admin_dir = "admin-" + mysql_user
     admin_include_file = os.path.join(htdocs, admin_dir + "/includes/configure.php")
     searchPattern = "/admin"
     replacePattern =  "/" + admin_dir
diff --git a/software/zencart/instance.cfg b/software/zencart/instance.cfg
index 074eb49fd13fe56143c6ca391c74dbbaaa4c9ea5..a29b488b11f44d12325efd8df7183ca1fa358a0e 100644
--- a/software/zencart/instance.cfg
+++ b/software/zencart/instance.cfg
@@ -7,8 +7,7 @@ parts = instance
 [instance]
 recipe = ${instance-recipe:egg}:${instance-recipe:module}
 source = ${application:location}
-template = ${application-template:location}/${application-template:filename}
-configuration = ${application-configuration:location}
+lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
 
 httpd_binary = ${apache:location}/bin/httpd
 mysql_binary = ${mariadb:location}/bin/mysql
diff --git a/software/zencart/software.cfg b/software/zencart/software.cfg
index 2f397f7e8c46cac17238fcab2cac73e9c0a786d9..08ca6288ee0fe383f00e7d481314328521ea6c9f 100644
--- a/software/zencart/software.cfg
+++ b/software/zencart/software.cfg
@@ -15,31 +15,18 @@ extends =
   ../../stack/shacache-client.cfg
 
 [application]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.build:download-unpacked
 url = http://heanet.dl.sourceforge.net/project/zencart/CURRENT_%20Zen%20Cart%201.3.x%20Series/Zen%20Cart%20v1.3.9%20-%20Full%20Release/zen-cart-v1.3.9h-full-fileset-10262010.zip
 md5sum = e0a5fb39078321ced7f5a9c193f30927
 #If provided tarball does not contain top directory, option shall be changed to false
-#strip-top-level-dir = true
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
+strip-top-level-dir = true
 
 [configure-script]
-recipe = hexagonit.recipe.download
+recipe = slapos.recipe.download
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
 url = ${:_profile_base_location_}/configure.py
 filename = configure.py
-download-only = True
-
-[application-template]
-recipe = slapos.recipe.download
-url = ${:_profile_base_location_}/template/zencart.inc.php.in
-#md5sum = Student may put here md5sum of this file, this is good idea
-download-only = True
-filename = template.in
-mode = 0644
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-
-[application-configuration]
-location = config.inc.php
+mode = 0744
   
 [instance-recipe]
 egg = slapos.cookbook
@@ -56,12 +43,93 @@ mode = 0644
 [instance-recipe-egg]
 recipe = zc.recipe.egg
 python = python2.7
-eggs = ${instance-recipe:egg}
+eggs =
+    ${mysql-python:egg}
+    ${instance-recipe:egg}
+    slapos.toolbox[lampconfigure]
 
 [versions]
 # Use SlapOS patched zc.buildout
 zc.buildout = 1.5.3-dev-SlapOS-010
 
+Jinja2 = 2.6
+MySQL-python = 1.2.3
+Werkzeug = 0.8.1
+apache-libcloud = 0.5.2
+buildout-versions = 1.7
+hexagonit.recipe.cmmi = 1.5.0
+meld3 = 0.6.7
+plone.recipe.command = 1.1
+slapos.cookbook = 0.34
+slapos.recipe.build = 0.7
+slapos.recipe.download = 1.0.dev-r4053
+slapos.recipe.template = 2.2
+slapos.toolbox = 0.10
+
+# Required by:
+# slapos.core==0.18
+# slapos.toolbox==0.10
+Flask = 0.8
+
+# Required by:
+# slapos.cookbook==0.34
+PyXML = 0.8.4
+
+# Required by:
+# hexagonit.recipe.cmmi==1.5.0
+hexagonit.recipe.download = 1.5.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+# xml-marshaller==0.9.7
+lxml = 2.3.1
+
+# Required by:
+# slapos.cookbook==0.34
+netaddr = 0.7.6
+
+# Required by:
+# slapos.core==0.18
+netifaces = 0.6
+
+# Required by:
+# slapos.toolbox==0.10
+paramiko = 1.7.7.1
+
+# Required by:
+# slapos.toolbox==0.10
+psutil = 0.3.0
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.core==0.18
+# slapos.toolbox==0.10
+setuptools = 0.6c12dev-r88846
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+slapos.core = 0.18
+
+# Required by:
+# slapos.core==0.18
+supervisor = 3.0a10
+
+# Required by:
+# slapos.cookbook==0.34
+# slapos.toolbox==0.10
+xml-marshaller = 0.9.7
+
+# Required by:
+# slapos.cookbook==0.34
+zc.recipe.egg = 1.3.2
+
+# Required by:
+# slapos.core==0.18
+zope.interface = 3.8.0
+
 [downloadcache-workaround]
 # workaround irritating problem of hexagonit.recipe.cmmi which automatically
 # creates download cache, which in turn switches builout to "semi-offline" mode
diff --git a/software/zencart/template/zencart.inc.php.in b/software/zencart/template/zencart.inc.php.in
deleted file mode 100644
index eac1c4b9eea2b2f36491b572757eebcb27643856..0000000000000000000000000000000000000000
--- a/software/zencart/template/zencart.inc.php.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
-$i = 0;
-$i++;
-/* Server parameters */
-$cfg['Servers'][$i]['host'] = '%(mysql_host)s';
-$cfg['Servers'][$i]['port'] = '%(mysql_port)s';
-/* Authentication type */
-$cfg['Servers'][$i]['auth_type'] = 'cookie';
-$cfg['Servers'][$i]['user'] = '';
-$cfg['Servers'][$i]['connect_type'] = 'tcp';
-$cfg['Servers'][$i]['compress'] = false;
-/* Select mysqli if your server has it */
-$cfg['Servers'][$i]['extension'] = 'mysql';
-$cfg['Servers'][$i]['AllowNoPassword'] = false;
-
-/* rajk - for blobstreaming */
-$cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
-$cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
-$cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
-$cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
-$cfg['UploadDir'] = '';
-$cfg['SaveDir'] = '';
-
-?>
diff --git a/stack/erp5.cfg b/stack/erp5.cfg
index ff41558752c69e6e4f1fa11a72c42a163d23fb8d..7fc434591027e2a2a67bc4ef3d342ea37e6cdbea 100644
--- a/stack/erp5.cfg
+++ b/stack/erp5.cfg
@@ -31,7 +31,7 @@ allow-hosts =
 
 extends =
 # Exact version of Zope
-  http://svn.zope.org/repos/main/Zope/tags/2.12.19/versions.cfg
+  http://svn.zope.org/repos/main/Zope/tags/2.12.21/versions.cfg
   ../component/logrotate/buildout.cfg
   ../component/dcron/buildout.cfg
   ../component/file/buildout.cfg
@@ -47,11 +47,12 @@ extends =
   ../component/kumo/buildout.cfg
   ../component/libreoffice-bin/buildout.cfg
   ../component/lxml-python/buildout.cfg
-  ../component/maatkit/buildout.cfg
+  ../component/percona-toolkit/buildout.cfg
   ../component/mariadb/buildout.cfg
   ../component/memcached/buildout.cfg
   ../component/mysql-python/buildout.cfg
   ../component/pdftk/buildout.cfg
+  ../component/pycrypto-python/buildout.cfg
   ../component/pysvn-python/buildout.cfg
   ../component/python-2.6/buildout.cfg
   ../component/python-2.7/buildout.cfg
@@ -90,6 +91,7 @@ parts =
   libpng
   ghostscript
   mariadb
+  mroonga-mariadb
   sphinx
   imagemagick
   kumo
@@ -99,13 +101,15 @@ parts =
   tesseract
   hookbox
   bootstrap2.6
+  perl-DBD-mariadb
+  perl-DBI
+  percona-toolkit
   zabbix-agent
   pdftk
   dcron
 
 # Buildoutish
   eggs
-  instance-recipe-egg
   testrunner
   test_suite_runner
 
@@ -133,6 +137,8 @@ parts =
 # fix products path (Zeo needs ERP5 Products to be available for
 # conflict resolution)
   fix-products-paths
+# some additional utils
+  slapos-toolbox
 
 [bt5-repository]
 # Format:
@@ -219,7 +225,7 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_}
 stop-on-error = true
 repository = http://git.erp5.org/repos/erp5.git
 branch = master
-revision = f1bc8fdc0e4ce17530b32468c2affda8a6e9e896
+revision =
 command = ${git:location}/bin/git clone --quiet -b ${:branch} ${:repository} ${:location} && if [ -n ${:revision} ]; then cd ${:location} && ${git:location}/bin/git reset --quiet --hard ${:revision} ; fi
 update-command = cd ${:location} && ${git:location}/bin/git pull --quiet && if [ -n ${:revision} ]; then cd ${:location} && ${git:location}/bin/git reset --quiet --hard ${:revision} ; fi
 
@@ -290,13 +296,6 @@ initialization =
   repository_id_list = list(reversed('''${erp5_repository_list:repository_id_list}'''.split()))
   sys.path[0:0] = ['/'.join(['''${buildout:parts-directory}''', x]) for x in repository_id_list]
 
-[instance-recipe-egg]
-recipe = zc.recipe.egg
-python = python2.6
-eggs =
-# instantiation egg
-  ${instance-recipe:egg}
-
 [eggs]
 recipe = zc.recipe.egg
 python = python2.6
@@ -305,11 +304,12 @@ eggs =
   ${lxml-python:egg}
   ${python-ldap-python:egg}
   ${pysvn-python:egg}
-  pycrypto
+  ${pycrypto-python:egg}
   PyXML
   SOAPpy
   cElementTree
   chardet
+  coverage
   elementtree
   erp5diff
   ipdb
@@ -391,6 +391,17 @@ python = python2.6
 [pysvn-python]
 python = python2.6
 
+[slapos-toolbox]
+recipe = zc.recipe.egg
+python = ${eggs:python}
+eggs =
+  ${lxml-python:egg}
+  slapos.toolbox
+
+scripts =
+  killpidfromfile = slapos.systool:killpidfromfile
+  onetimedownload = slapos.toolbox:onetimedownload
+
 [cloudooo]
 recipe = zc.recipe.egg
 python = python2.6
@@ -407,7 +418,7 @@ scripts =
 
 [versions]
 # Use SlapOS patched zc.buildout
-zc.buildout = 1.5.3-dev-SlapOS-010
+zc.buildout = 1.6.0-dev-SlapOS-003
 
 # pin Acquisition and Products.DCWorkflow to Nexedi flavour of eggs
 Acquisition = 2.13.7nxd001
diff --git a/stack/kvm.cfg b/stack/kvm.cfg
deleted file mode 100644
index 6c6af9c6f842bdc6d30c079b722fa5888578eec5..0000000000000000000000000000000000000000
--- a/stack/kvm.cfg
+++ /dev/null
@@ -1,104 +0,0 @@
-[buildout]
-extends =
-  shacache-client.cfg
-  ../component/python-2.7/buildout.cfg
-  ../component/lxml-python/buildout.cfg
-  ../component/git/buildout.cfg
-  ../component/zlib/buildout.cfg
-  ../component/readline/buildout.cfg
-  ../component/ncurses/buildout.cfg
-  ../component/libuuid/buildout.cfg
-  ../component/noVNC/buildout.cfg
-  ../component/openssl/buildout.cfg
-  ../component/rdiff-backup/buildout.cfg
-  ../component/dcron/buildout.cfg
-  ../component/libpng/buildout.cfg
-
-#XXX-Cedric : Currently, one can only access to KVM using noVNC.
-#             Ideally one should be able to access KVM by using either NoVNC or VNC.
-#             Problem is : no native crypto support in web browsers. So we have to disable ssl
-#             In qemu builtin vnc server, and make it available only for localhost 
-#             so that only novnc can listen to it.
-
-#XXX-Cedric: Check status of https://github.com/kanaka/noVNC/issues/13 to see
-#            When qemu has builtin support for websockets in vnc server to get rid of 
-#            Websockify (socket <-> websocket proxy server) when it is ready.
-#            May solve previous XXX depending on the implementation.
-
-parts =
-  template
-  gnutls
-  kvm
-  eggs
-
-find-links +=
-  http://www.nexedi.org/static/packages/source/slapos.buildout/
-
-versions = versions
-
-[gpg-error]
-recipe = hexagonit.recipe.cmmi
-url = ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.10.tar.gz
-md5sum = 7c2710ef439f82ac429b88fec88e9a4c
-
-[gcrypt]
-recipe = hexagonit.recipe.cmmi
-url = ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.4.6.tar.gz
-md5sum = bfd45922eefb8a24d598af77366220d4
-configure-options =
-  --with-gpg-error-prefix=${gpg-error:location}
-environment =
-  CPPFLAGS=-I${gpg-error:location}/include
-  LDFLAGS=-Wl,-rpath -Wl,${gpg-error:location}/lib -Wl,${gpg-error:location}/lib/libgpg-error.so.0
-
-[gnutls]
-recipe = hexagonit.recipe.cmmi
-url = ftp://ftp.gnupg.org/gcrypt/gnutls/gnutls-2.8.6.tar.bz2
-md5sum = eb0a6d7d3cb9ac684d971c14f9f6d3ba
-configure-options =
-  --with-libgcrypt-prefix=${gcrypt:location}
-environment =
-  CPPFLAGS=-I${zlib:location}/include -I${readline:location}/include -I${ncurses:location}/include -I${ncurses:location}/include/ncursesw -I${gcrypt:location}/include -I${gpg-error:location}/include
-  LDFLAGS=-L${readline:location}/lib -L${ncurses:location}/lib -L${gcrypt:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -Wl,-rpath -Wl,${readline:location}/lib -Wl,-rpath -Wl,${ncurses:location}/lib -Wl,-rpath -Wl,${gcrypt:location}/lib -Wl,-rpath -Wl,${gpg-error:location}/lib -Wl,${gcrypt:location}/lib/libgcrypt.so.11
-  PKG_CONFIG=${zlib:location}/lib/pkgconfig
-
-[kvm]
-recipe = hexagonit.recipe.cmmi
-path = ${kvmsource:location}/
-configure-options =
-  --disable-sdl
-  --disable-xen
-  --enable-vnc-tls
-  --disable-vnc-sasl
-  --disable-curses
-  --disable-curl
-  --enable-kvm
-  --disable-docs
-  --enable-vnc-png
-  --disable-vnc-jpeg
-  --extra-cflags="-I${gnutls:location}/include -I${libuuid:location}/include -I${zlib:location}/include -I${libpng:location}/include"
-  --extra-ldflags="-Wl,-rpath -Wl,${gnutls:location}/lib -L${gnutls:location}/lib -Wl,-rpath -Wl,${libpng:location}/lib -L${libpng:location}/lib -L${libuuid:location}/lib -Wl,-rpath -Wl,${libuuid:location}/lib -L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -lpng -lz -lgnutls"
-  --disable-werror
-environment =
-  PKG_CONFIG_PATH=${gnutls:location}/lib/pkgconfig
-
-[kvmsource]
-recipe=plone.recipe.command
-location = ${buildout:parts-directory}/${:_buildout_section_name_}
-stop-on-error = true
-#tag = slapos-v0.1
-command =
-  (${git:location}/bin/git clone --quiet http://git.erp5.org/repos/slapos.kvm.git ${:location} ) || (rm -fr ${:location} ; exit 1)
-update-command =
- cd ${:location} && ${git:location}/bin/git pull --quiet origin master
-
-[eggs]
-python = python2.7
-recipe = z3c.recipe.scripts
-eggs =
-  ${lxml-python:egg}
-  slapos.cookbook
-  numpy
-
-[versions]
-zc.buildout = 1.5.3-dev-SlapOS-009
diff --git a/stack/lamp.cfg b/stack/lamp.cfg
index 78e9c072a134d1c643610af76ed0afec1a8ea311..6ba9324db330fbe29eb313070085409a1cdd2640 100644
--- a/stack/lamp.cfg
+++ b/stack/lamp.cfg
@@ -33,16 +33,66 @@ extends =
   ../component/python-2.7/buildout.cfg
   ../component/lxml-python/buildout.cfg
   ../component/zlib/buildout.cfg
-  ../component/stunnel/buildout.cfg
+  ../component/stunnel/buildout.cfg  
+  ../component/pycrypto-python/buildout.cfg
   ../component/mysql-python/buildout.cfg
 
-[application]
-recipe = hexagonit.recipe.download
-#If provided tarball does not containt top directory this option shall be changed to false
-strip-top-level-dir = true
-
 [eggs]
 recipe = zc.recipe.egg
 eggs =
   ${lxml-python:egg}
-  ${mysql-python:egg}
+  ${pycrypto-python:egg}
+
+[mariadb]
+keep-compile-dir = false
+
+[application]
+#XXX-Cedric : ugly hack to work around h.r.cmmi unrespectful behavior, so that
+#             a cmmi Executes before application but after template downloading.
+#             Useful when [application] uses slapos.recipe.build or
+#             slapos.recipe.download rather than h.r.download.
+depends = ${apache-php:location}
+
+
+[networkcache]
+# Romain Courteaud + Sebastien Robin + Alain Takoudjou signature certificate
+signature-certificate-list =
+  -----BEGIN CERTIFICATE-----
+  MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
+  CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5
+  MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl
+  ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF
+  AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw
+  boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX
+  Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA
+  ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX
+  mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC
+  q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g
+  QUUGLQ==
+  -----END CERTIFICATE-----
+  -----BEGIN CERTIFICATE-----
+  MIIB8jCCAVugAwIBAgIJAPu2zchZ2BxoMA0GCSqGSIb3DQEBBQUAMBIxEDAOBgNV
+  BAMMB3RzeGRldjMwHhcNMTExMDE0MTIxNjIzWhcNMTIxMDEzMTIxNjIzWjASMRAw
+  DgYDVQQDDAd0c3hkZXYzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrPbh+
+  YGmo6mWmhVb1vTqX0BbeU0jCTB8TK3i6ep3tzSw2rkUGSx3niXn9LNTFNcIn3MZN
+  XHqbb4AS2Zxyk/2tr3939qqOrS4YRCtXBwTCuFY6r+a7pZsjiTNddPsEhuj4lEnR
+  L8Ax5mmzoi9nE+hiPSwqjRwWRU1+182rzXmN4QIDAQABo1AwTjAdBgNVHQ4EFgQU
+  /4XXREzqBbBNJvX5gU8tLWxZaeQwHwYDVR0jBBgwFoAU/4XXREzqBbBNJvX5gU8t
+  LWxZaeQwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQA07q/rKoE7fAda
+  FED57/SR00OvY9wLlFEF2QJ5OLu+O33YUXDDbGpfUSF9R8l0g9dix1JbWK9nQ6Yd
+  R/KCo6D0sw0ZgeQv1aUXbl/xJ9k4jlTxmWbPeiiPZEqU1W9wN5lkGuLxV4CEGTKU
+  hJA/yXa1wbwIPGvX3tVKdOEWPRXZLg==
+  -----END CERTIFICATE-----
+  -----BEGIN CERTIFICATE-----
+  MIIB9DCCAV2gAwIBAgIJAL392bEdqpFQMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
+  BAMMCENPTVAtMjM0MB4XDTExMTEwOTE1MzA0M1oXDTEyMTEwODE1MzA0M1owEzER
+  MA8GA1UEAwwIQ09NUC0yMzQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMRR
+  T0cacZKztie/DaRRjq3mgcqfPKoGXu6zXmeRQI+6Y4bnzjf8h/jAuPzR552P0xK5
+  psxhavXA8hOGRLFDtvDMQLepVHWfwqtFtcp5vNf2+KWqOYy0OxHfVIlnatvCqTZN
+  NG1vRsSOAQ+v7QNFHh6NBbiSrjBBfg4vkfzqnsUvAgMBAAGjUDBOMB0GA1UdDgQW
+  BBTGGw+ASoDi9kqPElDkC0Q5RtAfRjAfBgNVHSMEGDAWgBTGGw+ASoDi9kqPElDk
+  C0Q5RtAfRjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAIOuR1OqXLke
+  LLzH0kRnlIOe60dYJvRya53wDx5x2g4/qkXZPLx2RcbaUrX/SCbL70vfr+apUPss
+  dOSJ86sf/PQHW3/1fhTTE+Vck1MiiAq0aIx6WnKnz4+ZcQctB7b0DCsTcQnmbpi2
+  n9MuhWaT21VOYhIGzJFPw5XW47/RrwhR
+  -----END CERTIFICATE-----
diff --git a/stack/lamp/buildout.cfg b/stack/lamp/buildout.cfg
index d57dd2d38aad4cf151e3098a052076b367707e73..02bce8cafb36560bd9619b3cdd6609801bbbcaeb 100644
--- a/stack/lamp/buildout.cfg
+++ b/stack/lamp/buildout.cfg
@@ -140,17 +140,3 @@ recipe = zc.recipe.egg
 eggs =
   ${lxml-python:egg}
   slapos.toolbox
-
-[versions]
-setuptools = 0.6c12dev-r88795
-zc.buildout = 1.6.0-dev-SlapOS-002
-slapos.core =
-slapos.cookbook =
-
-collective.recipe.template = 1.8
-hexagonit.recipe.cmmi = 1.5.0
-hexagonit.recipe.download = 1.5.0
-plone.recipe.command = 1.1
-
-netaddr = 0.7.5
-xml-marshaller = 0.9.7
diff --git a/stack/nbd.cfg b/stack/nbd.cfg
index 9d5d8787b6ea53b8cc958c97553f038a6f36596a..5dde4b493faffda46c2ac9c9f9c7cae430922496 100644
--- a/stack/nbd.cfg
+++ b/stack/nbd.cfg
@@ -37,6 +37,8 @@ version = 3
 eggs = slapos.libnetworkcache
 
 [nbdserver]
+# XXX-Cedric : use official tarball from kvm website
+#              (new kvm code does not seem to need special patch)
 recipe = hexagonit.recipe.cmmi
 path = ${nbdserversource:location}/
 configure-options =