From 39fc2c7f34593bd277a7ccdf452e4c95d8202ad7 Mon Sep 17 00:00:00 2001
From: Jondy Zhao <jondy.zhao@gmail.com>
Date: Wed, 31 Jul 2013 23:42:28 +0800
Subject: [PATCH] slapos-windows-installer: fix cygwin/windows path problem

---
 software/slapos-windows-installer/instance.cfg.in | 10 ++++++----
 software/slapos-windows-installer/software.cfg    |  3 +--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/software/slapos-windows-installer/instance.cfg.in b/software/slapos-windows-installer/instance.cfg.in
index 69db7bf55..5b5c1f844 100644
--- a/software/slapos-windows-installer/instance.cfg.in
+++ b/software/slapos-windows-installer/instance.cfg.in
@@ -19,11 +19,13 @@ pre-configure =
   chmod +x $${:configure-command}
 configure-command = $${buildout:directory}/bootloader.sh
 pre-install =
+  declare -r cyghome="$$(cygpath -m -a /)/.."
+  cp $$cyghome/setup.exe $${buildout:directory}
+  cp $$cyghome/certificate $${buildout:directory}/cygwin/certificate
+  cp $$cyghome/key $${buildout:directory}/cygwin/key
+  cp $$cyghome/test-computer.crt $${buildout:directory}/cygwin/computer.crt
+  cp $$cyghome/test-computer.key $${buildout:directory}/cygwin/computer.key
   cp ${installer:cygroot}/slapos-windows-wrapper.bat $${buildout:directory}/slapos-windows-wrapper.bat
-  cp ${installer:cygroot}/test-computer.key $${buildout:directory}/cygwin/computer.key
-  cp ${installer:cygroot}/test-/computer.crt $${buildout:directory}/cygwin/computer.crt
-  cp ${installer:cygroot}/.slapos/key $${buildout:directory}/cygwin/key
-  cp ${installer:cygroot}/.slapos/certificate $${buildout:directory}/cygwin/certificate
 make-binary = true
 # The parameter "slaptester" is the password of slapos administrator
 # passed to configure script
diff --git a/software/slapos-windows-installer/software.cfg b/software/slapos-windows-installer/software.cfg
index 0b37d686f..5f48310f9 100644
--- a/software/slapos-windows-installer/software.cfg
+++ b/software/slapos-windows-installer/software.cfg
@@ -45,7 +45,6 @@ pre-configure=
   mkdir -p ${:cygroot}/cygwin
   (cd ${:cygroot} ; tar xjf ${inno-setup:location}/inno-setup.tar.bz2)
   (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-windows-wrapper:location}/slapos-windows-wrapper.bat ${:cygroot}
   cp ${setup-cygwin:location}/setup-cygwin.bat ${:cygroot}
@@ -60,7 +59,7 @@ post-install= ${:cygroot}/slapos-windows-wrapper.bat slapos-build-installer
 [instance-template]
 recipe = slapos.recipe.template
 url = ${:_profile_base_location_}/instance.cfg.in
-md5sum = b5bd277293c52ee66ec76cdc696d51a3
+md5sum = b78830f4591aa7ac93675348c51a1e90
 output = ${buildout:directory}/instance.cfg
 mode = 0644
 
-- 
2.30.9