o added shell scripts to generate 32 and 64 bit installers
o updated readme
o moved the AdvUninstLog.sh file to parent folder (this is where it is expected by the .nsi scrip)
o removed an additional argument passed to DeleteRegKey


git-svn-id: https://svn.apache.org/repos/asf/directory/studio/tags/2.0.0.v20160717-M11@1753811 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tools/Windows Installer/utils/AdvUninstLog.nsh b/tools/Windows Installer/AdvUninstLog.nsh
similarity index 100%
rename from tools/Windows Installer/utils/AdvUninstLog.nsh
rename to tools/Windows Installer/AdvUninstLog.nsh
diff --git a/tools/Windows Installer/README b/tools/Windows Installer/README
index c3f2045..2d8b717 100755
--- a/tools/Windows Installer/README
+++ b/tools/Windows Installer/README
@@ -1,11 +1,9 @@
 The windows_install.nsi script creates the Windows installer for a release of Apache Directory Studio on Windows.

 

-To create a Windows installer, you have to put in a "release" folder the following files:

-  * Apache Directory Studio.exe (the application)

-  * LICENSE.txt

-  * NOTICE.txt

-  * Release Notes.txt

+To create a Windows installer, 

 

-Then, you can compile the script with NSIS.

+1. set the environment variable STUDIO_VERSION with the desired version number

 

-An "Apache_Directory_Studio_VERSION_Windows.exe" installer will be generated.
\ No newline at end of file
+2. Run the generate-32bit.sh and generate-64bit.sh files to generate installers for 32bit and 64bit OS versions respectively.

+

+"Apache_Directory_Studio_VERSION_Windows.exe" installer(s) will be generated.

diff --git a/tools/Windows Installer/generate-32bit.sh b/tools/Windows Installer/generate-32bit.sh
new file mode 100755
index 0000000..a7b404a
--- /dev/null
+++ b/tools/Windows Installer/generate-32bit.sh
@@ -0,0 +1,20 @@
+#Generates an installer that is compatible with Windows 32bit version 
+if [ -z "$STUDIO_VERSION" ]; then
+   echo "Please set the STUDIO_VERSION environment variable to generate the installer"
+   exit 1
+fi
+
+PROD_NAME=ApacheDirectoryStudio
+FILE_NAME=$PROD_NAME*-win32.win32.x86.zip
+rm -rf release
+unzip ../../product/target/products/$FILE_NAME
+mv $PROD_NAME release
+mv release/LICENSE release/LICENSE.txt
+
+#set LANG to C to avoid "sed: RE error: illegal byte sequence" error
+export LANG=C
+
+sed -e "s/STUDIO_VERSION/x86-$STUDIO_VERSION/" windows_installer.nsi > temp_win_installer.nsi
+sed -i.bak "s/BRANDING_VERSION/$STUDIO_VERSION/" temp_win_installer.nsi
+
+makensis temp_win_installer.nsi
diff --git a/tools/Windows Installer/generate-64bit.sh b/tools/Windows Installer/generate-64bit.sh
new file mode 100755
index 0000000..f6e4619
--- /dev/null
+++ b/tools/Windows Installer/generate-64bit.sh
@@ -0,0 +1,20 @@
+#Generates an installer that is compatible with Windows 64bit version 
+if [ -z "$STUDIO_VERSION" ]; then
+   echo "Please set the STUDIO_VERSION environment variable to generate the installer"
+   exit 1
+fi
+
+PROD_NAME=ApacheDirectoryStudio
+FILE_NAME=$PROD_NAME*-win32.win32.x86_64.zip
+rm -rf release
+unzip ../../product/target/products/$FILE_NAME
+mv $PROD_NAME release
+mv release/LICENSE release/LICENSE.txt
+
+#set LANG to C to avoid "sed: RE error: illegal byte sequence" error
+export LANG=C
+
+sed -e "s/STUDIO_VERSION/x86_64-$STUDIO_VERSION/" windows_installer.nsi > temp_win_installer.nsi
+sed -i.bak "s/BRANDING_VERSION/$STUDIO_VERSION/" temp_win_installer.nsi
+
+makensis temp_win_installer.nsi
diff --git a/tools/Windows Installer/windows_installer.nsi b/tools/Windows Installer/windows_installer.nsi
index d421ad1..c295781 100755
--- a/tools/Windows Installer/windows_installer.nsi
+++ b/tools/Windows Installer/windows_installer.nsi
@@ -21,7 +21,8 @@
 # Constants and variables

 #

     !define Application "Apache Directory Studio"

-    !define Version "1.4.0.v20090407"

+    !define Version "STUDIO_VERSION"

+    !define BrandingVersion "BRANDING_VERSION"

     !define Icon "utils\studio-installer.ico"

     !define WelcomeImage "utils\welcome_studio.bmp"

     !define HeaderImage "utils\header_studio.bmp"

@@ -52,7 +53,7 @@
     InstallDir "$PROGRAMFILES\${Application}"

     

     # Branding text

-    BrandingText "${Application} - ${Version}"

+    BrandingText "${Application} - ${BrandingVersion}"

 

     # Activating XPStyle

     XPStyle on

@@ -229,5 +230,5 @@
         

         # Removing registry keys

         DeleteRegKey "${INSTDIR_REG_ROOT}" "${INSTDIR_REG_KEY}"

-        DeleteRegKey "${INSTDIR_REG_ROOT}" "SOFTWARE\${Application}" "InstallDir"

+        DeleteRegKey "${INSTDIR_REG_ROOT}" "SOFTWARE\${Application}"

     SectionEnd