From 3fd68412b3114ab0da7307766f3a57627d2a3ef0 Mon Sep 17 00:00:00 2001
From: Jondy Zhao <jondy.zhao@gmail.com>
Date: Mon, 29 Jul 2013 18:55:21 +0800
Subject: [PATCH] slapos-windows-installer: fix running problem

---
 .../slapos-windows-installer/instance.cfg.in  |  2 +-
 .../slapos-windows-installer/software.cfg     | 44 ++++++++++++-------
 2 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/software/slapos-windows-installer/instance.cfg.in b/software/slapos-windows-installer/instance.cfg.in
index 4f8f007ca..0e3fa7769 100644
--- a/software/slapos-windows-installer/instance.cfg.in
+++ b/software/slapos-windows-installer/instance.cfg.in
@@ -9,7 +9,7 @@ offline = true
 [slapos-instance]
 recipe = slapos.recipe.cmmi
 # This url is useless
-url = /usr/bin/true.exe
+path = $${buildout:directory}
 configure-command = msiexec.exe
 configure-options =
   /i ${installer:location}/slapos-windows-all-in-one.exe
diff --git a/software/slapos-windows-installer/software.cfg b/software/slapos-windows-installer/software.cfg
index e714f6d4f..f37287aca 100644
--- a/software/slapos-windows-installer/software.cfg
+++ b/software/slapos-windows-installer/software.cfg
@@ -4,9 +4,6 @@ extends =
    ../../stack/slapos.cfg
 
 parts =
-  setup-cygwin
-  slapos-build-installer
-  inno-setup
   installer
   instance-template
 
@@ -19,28 +16,43 @@ download-only = true
 [slapos-build-installer]
 recipe = hexagonit.recipe.download
 url = http://git.erp5.org/gitweb/slapos.package.git/blob_plain/heads/cygwin:/windows/scripts/slapos-build-installer
-md5sum = 217066b8a5bda72e52d97b04461bd9f1
+md5sum = 6fc482120dc41d230dc360ea56344fea
 download-only = true
 
-[setup-cgywin]
+[slapos-build-installer.bat]
+recipe = hexagonit.recipe.download
+url = http://git.erp5.org/gitweb/slapos.package.git/blob_plain/heads/cygwin:/windows/scripts/slapos-build-installer.bat
+md5sum = 5f9a3880efdec2c1e53e0f4d1f960146
+download-only = true
+
+[setup-cygwin]
 recipe = hexagonit.recipe.download
 url = http://git.erp5.org/gitweb/slapos.package.git/blob_plain/heads/cygwin:/windows/scripts/setup-cygwin.bat
-md5sum = 5ec4f11eee39230a38ef3d2ba59fde44
+md5sum = eb868bed0d0fd9d950f4f972b09a2479
+download-only = true
+
+[cygwin-packages]
+recipe = hexagonit.recipe.download
+url = http://dashingsoft.com/products/slapos/cygwin-packages.tar.bz2
+md5sum = b0e3f3cf51573c3c94c787201fbb8cdf
 download-only = true
 
 [installer]
 recipe = slapos.recipe.cmmi
-url = http://dashingsoft.com/products/slapos/cygwin-packages.tar.gz
+path = ${buildout:parts-directory}/${:_buildout_section_name_}
+cygroot = ${buildout:parts-directory}/${:_buildout_section_name_}
 pre-configure=
-  mkdir -p ${:location}/cygwin
-  (cd ${:location}/cygwin ; tar xzf ${inno-setup:location}/inno-setup.tar.gz)
-  cp /usr/bin/setup.exe ${:location}
-  cp ${setup-cygwin}/setup-cygwin.bat ${:location}/cygwin
-  cp ${slapos-build-installer}/slapos-build-installer ${:location}/cygwin
-configure-command = ${buildout:directory}/setup-cygwin.bat
-make-binary = ${:location}/cygwin/bin/bash --login /slapos-build-installer
-make-options =
-  --inno-setup=/inno-setup/ISCC.exe
+  mkdir -p ${:cygroot}/cygwin
+  (cd ${:cygroot}/cygwin ; tar xzf ${inno-setup:location}/inno-setup.tar.gz)
+  (cd ${:cygroot} ; tar xjf ${cygwin-packages:location}/cygwin-packages.tar.bz2)
+  cp /usr/bin/setup.exe ${:cygroot}
+  cp ${slapos-build-installer:location}/slapos-build-installer ${:cygroot}/cygwin
+  cp ${slapos-build-installer.bat:location}/slapos-build-installer.bat ${:cygroot}
+  cp ${setup-cygwin:location}/setup-cygwin.bat ${:cygroot}
+  chmod +x ${:cygroot}/*.bat
+configure-command = ${:cygroot}/setup-cygwin.bat
+make-binary = true
+post-install= ${:cygroot}/slapos-build-installer.bat
 
 #----------------
 #-- Instance-level buildout profiles.
-- 
2.30.9