← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3059: New functionality for the generic installer: Determines which components are already installed. A...

 

------------------------------------------------------------
revno: 3059
committer: Bjørnar Valbø <heia@xxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-03-17 14:01:21 +0100
message:
  New functionality for the generic installer: Determines which components are already installed. Aborts the installer if required components are not present in the resources folder. More flexible db restore script - e.g. the Postgres installation location is extracted from the registry. Added generic_hibernate.properties.
modified:
  installers/build.bat
  installers/resources/postgres/restore_db_psql.bat
  installers/src/bitrock/DHIS2_pginstaller_generic.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'installers/build.bat'
--- installers/build.bat	2010-03-02 06:52:28 +0000
+++ installers/build.bat	2011-03-17 13:01:21 +0000
@@ -1,19 +1,26 @@
 
 
-REM Adjust these enviornment variables to suit your system.
+REM Adjust these environment variables to suit your system.
 REM They are needed by this build script as well as maven during the build.
+
 REM Path to the Java SDK
 JAVA_HOME="C:\Program Files\Java\jdk1.6.0_10\"
+
 REM Be sure maven is in your path
 PATH=%PATH%;"C:\apache-maven-2.2.1\bin\"
+
 REM Be sure that the Bitrock installer is in your path
 BITROCK_HOME="C:\Program Files\BitRock InstallBuilder Professional 6.2.7"
+
 REM If you are including Birt in the build, be sure it is available here
 BIRT_WAR="C:\apache-tomcat-6.0.18\webapps\birt\"
+
 REM Path to the root of the documentation branch source tree
 DHIS2_DOCS="C:\src\dhis2-docbook-docs"
+
 REM Path to the root of the DHIS2 branch source tree
 DHIS2_SRC="C:\src\dhis2"
+
 REM Path to the root of the DHIS2 Live installer source tree
 DHIS2_INSTALL="C:\src\dhis2-live-installer"
 

=== modified file 'installers/resources/postgres/restore_db_psql.bat'
--- installers/resources/postgres/restore_db_psql.bat	2011-03-14 14:10:54 +0000
+++ installers/resources/postgres/restore_db_psql.bat	2011-03-17 13:01:21 +0000
@@ -1,4 +1,4 @@
 SET PGPASSWORD=PG_PASSWORD
-"c:\Program Files\PostgreSQL\9.0\bin\psql.exe" -c "CREATE USER dhis CREATEDB LOGIN PASSWORD 'dhis';" -U postgres -w postgres
-"c:\Program Files\Postgresql\9.0\bin\createdb.exe" -U postgres -w -O dhis dhis2db
-"c:\Program Files\Postgresql\9.0\bin\psql.exe" -U postgres -w -d dhis2db -f "DATABASE_FILE"
\ No newline at end of file
+"POSTGRES_INSTALL_LOCATION\bin\psql.exe" -c "CREATE USER dhis CREATEDB LOGIN PASSWORD 'dhis';" -U postgres -w postgres
+"POSTGRES_INSTALL_LOCATION\bin\createdb.exe" -U postgres -w -O dhis dhis2db
+"POSTGRES_INSTALL_LOCATION\bin\psql.exe" -U postgres -w -d dhis2db -f "DATABASE_FILE"
\ No newline at end of file

=== modified file 'installers/src/bitrock/DHIS2_pginstaller_generic.xml'
--- installers/src/bitrock/DHIS2_pginstaller_generic.xml	2011-03-14 14:10:54 +0000
+++ installers/src/bitrock/DHIS2_pginstaller_generic.xml	2011-03-17 13:01:21 +0000
@@ -9,6 +9,116 @@
     <logoImage>../../resources/images/dhis2-logo-blue.png</logoImage>
     <splashImage>../../resources/images/dhis2-splash-blue.png</splashImage>
     <allowLanguageSelection>1</allowLanguageSelection>
+    <initializationActionList>
+        <registryFind>
+            <dataPattern>Java(TM)*6*</dataPattern>
+            <keyPattern>*</keyPattern>
+            <namePattern>*</namePattern>
+            <rootKey>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall</rootKey>
+            <searchDepth>1</searchDepth>
+            <variable>jreInstalled</variable>
+            <wowMode>64</wowMode>
+        </registryFind>
+        <registryFind>
+            <dataPattern>Java(TM)*6*</dataPattern>
+            <keyPattern>*</keyPattern>
+            <namePattern>*</namePattern>
+            <rootKey>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall</rootKey>
+            <searchDepth>1</searchDepth>
+            <variable>jreInstalled</variable>
+            <wowMode>32</wowMode>
+            <ruleList>
+                <compareTextLength>
+                    <length>1</length>
+                    <logic>less</logic>
+                    <text>${jreInstalled}</text>
+                </compareTextLength>
+            </ruleList>
+        </registryFind>
+        <registryFind>
+            <dataPattern>PostgreSQL 9*</dataPattern>
+            <keyPattern>*</keyPattern>
+            <namePattern>*</namePattern>
+            <rootKey>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall</rootKey>
+            <searchDepth>1</searchDepth>
+            <variable>postgresInstalled</variable>
+            <wowMode>64</wowMode>
+        </registryFind>
+        <registryFind>
+            <dataPattern>PostgreSQL 9*</dataPattern>
+            <keyPattern>*</keyPattern>
+            <namePattern>*</namePattern>
+            <rootKey>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall</rootKey>
+            <searchDepth>1</searchDepth>
+            <variable>postgresInstalled</variable>
+            <wowMode>32</wowMode>
+            <ruleList>
+                <compareTextLength>
+                    <length>1</length>
+                    <logic>less</logic>
+                    <text>${postgresInstalled}</text>
+                </compareTextLength>
+            </ruleList>
+        </registryFind>
+        <registryFind>
+            <dataPattern>Google Chrome</dataPattern>
+            <keyPattern>*</keyPattern>
+            <namePattern>DisplayName</namePattern>
+            <rootKey>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall</rootKey>
+            <searchDepth>1</searchDepth>
+            <variable>chromeInstalled</variable>
+            <wowMode>64</wowMode>
+        </registryFind>
+        <registryFind>
+            <dataPattern>Google Chrome</dataPattern>
+            <keyPattern>*</keyPattern>
+            <namePattern>DisplayName</namePattern>
+            <rootKey>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall</rootKey>
+            <searchDepth>1</searchDepth>
+            <variable>chromeInstalled</variable>
+            <wowMode>32</wowMode>
+            <ruleList>
+                <compareTextLength>
+                    <length>1</length>
+                    <logic>less</logic>
+                    <text>${chromeInstalled}</text>
+                </compareTextLength>
+            </ruleList>
+        </registryFind>
+        <componentSelection>
+            <deselect></deselect>
+            <select>Java</select>
+            <ruleList>
+                <compareTextLength>
+                    <length>1</length>
+                    <logic>less</logic>
+                    <text>${jreInstalled}</text>
+                </compareTextLength>
+            </ruleList>
+        </componentSelection>
+        <componentSelection>
+            <deselect></deselect>
+            <select>postgres</select>
+            <ruleList>
+                <compareTextLength>
+                    <length>1</length>
+                    <logic>less</logic>
+                    <text>${postgresInstalled}</text>
+                </compareTextLength>
+            </ruleList>
+        </componentSelection>
+        <componentSelection>
+            <deselect></deselect>
+            <select>Chrome</select>
+            <ruleList>
+                <compareTextLength>
+                    <length>1</length>
+                    <logic>less</logic>
+                    <text>${chromeInstalled}</text>
+                </compareTextLength>
+            </ruleList>
+        </componentSelection>
+    </initializationActionList>
     <readyToInstallActionList>
         <createDirectory>
             <path>${installdir}/database</path>
@@ -22,9 +132,14 @@
         </createDirectory>
         <createDirectory>
             <explanation>Creating temporary directory</explanation>
-            <path>${installdir}\tmp\</path>
+            <path>${installdir}/tmp</path>
         </createDirectory>
     </readyToInstallActionList>
+    <postInstallationActionList>
+        <deleteFile>
+            <path>${installdir}\tmp</path>
+        </deleteFile>
+    </postInstallationActionList>
     <postUninstallationActionList>
         <deleteFile>
             <path>${installdir}</path>
@@ -121,6 +236,13 @@
                     <destination>${installdir}/dhis2-live.jar</destination>
                     <origin>${installdir}/dhis2-live-jar-with-dependencies.jar</origin>
                 </renameFile>
+                <deleteFile>
+                    <path>${installdir}/conf/hibernate.properties</path>
+                </deleteFile>
+                <renameFile>
+                    <destination>${installdir}/conf/hibernate.properties</destination>
+                    <origin>${installdir}/conf/generic_hibernate.properties</origin>
+                </renameFile>
             </postInstallationActionList>
             <startMenuShortcutList>
                 <startMenuShortcut>
@@ -219,7 +341,7 @@
             <name>Java</name>
             <description>Java</description>
             <canBeEdited>1</canBeEdited>
-            <selected>1</selected>
+            <selected>0</selected>
             <show>1</show>
             <postInstallationActionList>
                 <runProgram>
@@ -279,7 +401,7 @@
             <name>postgres</name>
             <description>Postgres</description>
             <canBeEdited>1</canBeEdited>
-            <selected>1</selected>
+            <selected>0</selected>
             <show>1</show>
             <parameterList>
                 <passwordParameter>
@@ -379,6 +501,25 @@
                 </folder>
             </folderList>
             <postInstallationActionList>
+                <registryGetMatch>
+                    <key>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\PostgreSQL*</key>
+                    <name>InstallLocation</name>
+                    <variable>postgresInstallLocation</variable>
+                    <wowMode>64</wowMode>
+                </registryGetMatch>
+                <registryGetMatch>
+                    <key>HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\PostgreSQL*</key>
+                    <name>InstallLocation</name>
+                    <variable>postgresInstallLocation</variable>
+                    <wowMode>32</wowMode>
+                    <ruleList>
+                        <compareTextLength>
+                            <length>1</length>
+                            <logic>less</logic>
+                            <text>${postgresInstallLocation}</text>
+                        </compareTextLength>
+                    </ruleList>
+                </registryGetMatch>
                 <createDirectory>
                     <path>${installdir}\tmp\dhis2db</path>
                 </createDirectory>
@@ -393,7 +534,7 @@
                 </findFile>
                 <substitute>
                     <files>${installdir}\tmp\restore_db_psql.bat</files>
-                    <type>regexp</type>
+                    <type>exact</type>
                     <substitutionList>
                         <substitution>
                             <pattern>PG_PASSWORD</pattern>
@@ -403,6 +544,10 @@
                             <pattern>DATABASE_FILE</pattern>
                             <value>${databaseFile}</value>
                         </substitution>
+                        <substitution>
+                            <pattern>POSTGRES_INSTALL_LOCATION</pattern>
+                            <value>${postgresInstallLocation}</value>
+                        </substitution>
                     </substitutionList>
                 </substitute>
                 <runProgram>
@@ -529,7 +674,7 @@
             <name>Chrome</name>
             <description>Google Chrome</description>
             <canBeEdited>1</canBeEdited>
-            <selected>1</selected>
+            <selected>0</selected>
             <show>1</show>
             <postInstallationActionList>
                 <runProgram>
@@ -540,6 +685,12 @@
                     <workingDirectory>${installer_directory}\resources</workingDirectory>
                 </runProgram>
             </postInstallationActionList>
+            <preInstallationActionList>
+                <componentSelection>
+                    <deselect></deselect>
+                    <select>Google Chrome</select>
+                </componentSelection>
+            </preInstallationActionList>
             <readyToInstallActionList>
                 <setInstallerVariable>
                     <name>chromeWarningIsShown</name>