← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3005: Improved Postgres installers to deal with situations when Java and Postgres already exist

 

------------------------------------------------------------
revno: 3005
committer: Jason P. Pickering <jason.p.pickering@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-03-11 11:44:54 +0100
message:
  Improved Postgres installers to deal with situations when Java and Postgres already exist
modified:
  installers/resources/postgres/restore_db.bat
  installers/src/bitrock/DHIS2_pginstaller.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/resources/postgres/restore_db.bat'
--- installers/resources/postgres/restore_db.bat	2011-03-10 14:37:48 +0000
+++ installers/resources/postgres/restore_db.bat	2011-03-11 10:44:54 +0000
@@ -1,4 +1,5 @@
 SET PGPASSWORD=PG_PASSWORD
 "c:\Program Files\PostgreSQL\9.0\bin\psql.exe" -c "CREATE USER dhis2 CREATEDB LOGIN PASSWORD 'dhis2';" -U postgres -w postgres
-"c:\Program Files\Postgresql\9.0\bin\createdb.exe" -U postgres -w -O dhis2 DHIS2DBNAME
-"c:\Program Files\Postgresql\9.0\bin\pg_restore" -U postgres -w -d DHIS2DBNAME dhis2db.backup
+SET PGPASSWORD=dhis2
+"c:\Program Files\Postgresql\9.0\bin\createdb.exe" -U dhis2 -w -O dhis2 DHIS2DBNAME
+"c:\Program Files\Postgresql\9.0\bin\pg_restore" -U dhis2 -w -O dhis2 -d DHIS2DBNAME dhis2db.backup

=== modified file 'installers/src/bitrock/DHIS2_pginstaller.xml'
--- installers/src/bitrock/DHIS2_pginstaller.xml	2011-03-10 18:46:30 +0000
+++ installers/src/bitrock/DHIS2_pginstaller.xml	2011-03-11 10:44:54 +0000
@@ -9,19 +9,19 @@
     <logoImage>../../resources/images/dhis2-logo.png</logoImage>
     <splashImage>../../resources/images/dhis2-logo.png</splashImage>
     <allowLanguageSelection>1</allowLanguageSelection>
-    <preInstallationActionList>
+    <initializationActionList>
         <autodetectJava>
-            <explanation>Detecting Java</explanation>
             <promptUser>0</promptUser>
-            <ruleList>
-                <compareValues>
-                    <logic>equals</logic>
-                    <value1>${java_autodetected}</value1>
-                    <value2>1</value2>
-                </compareValues>
-            </ruleList>
+            <validVersionList>
+                <validVersion>
+                    <maxVersion></maxVersion>
+                    <minVersion>1.6.0_18</minVersion>
+                    <requireJDK>0</requireJDK>
+                    <vendor></vendor>
+                </validVersion>
+            </validVersionList>
         </autodetectJava>
-    </preInstallationActionList>
+    </initializationActionList>
     <readyToInstallActionList>
         <createDirectory>
             <path>${installdir}/database</path>
@@ -224,6 +224,99 @@
                 </folder>
             </folderList>
             <parameterList>
+                <booleanParameter>
+                    <name>postgres_overwrite</name>
+                    <title>Overwrite Postgresql</title>
+                    <description>An existing Postgresql installation has been detected. Are you sure you want to overwrite this instance?</description>
+                    <explanation></explanation>
+                    <value></value>
+                    <default>1</default>
+                    <displayStyle>radiobuttons</displayStyle>
+                    <ruleList>
+                        <registryTest>
+                            <key>HKEY_LOCAL_MACHINE\SOFTWARE\PostgreSQL\Installations\postgresql*</key>
+                            <logic>exists</logic>
+                            <name></name>
+                        </registryTest>
+                    </ruleList>
+                </booleanParameter>
+            </parameterList>
+            <postInstallationActionList>
+                <runProgram>
+                    <explanation>Installing Postgresql</explanation>
+                    <program>postgresql*.exe</program>
+                    <programArguments>--superaccount postgres --servicepassword ${pg_password} --superpassword ${pg_password}</programArguments>
+                    <progressText>Installing Postgresql</progressText>
+                    <workingDirectory>${installdir}\tmp\</workingDirectory>
+                    <ruleList>
+                        <compareValues>
+                            <logic>equals</logic>
+                            <value1>${postgres_overwrite}</value1>
+                            <value2>1</value2>
+                        </compareValues>
+                    </ruleList>
+                </runProgram>
+            </postInstallationActionList>
+        </component>
+        <component>
+            <name>jre</name>
+            <description>JRE</description>
+            <canBeEdited>0</canBeEdited>
+            <selected>1</selected>
+            <show>1</show>
+            <folderList>
+                <folder>
+                    <description>JRE</description>
+                    <destination>${installdir}\tmp\</destination>
+                    <name>JRE</name>
+                    <platforms>windows</platforms>
+                    <distributionFileList>
+                        <distributionFile>
+                            <origin>../../resources/jre/jre-6u24-windows-i586-s.exe</origin>
+                        </distributionFile>
+                    </distributionFileList>
+                </folder>
+            </folderList>
+            <postInstallationActionList>
+                <runProgram>
+                    <explanation>Installing Java Runtime Enviornment</explanation>
+                    <program>jre-6u24-windows-i586-s.exe</program>
+                    <programArguments>/s /v</programArguments>
+                    <progressText>Installing Java Runtime Enviornment</progressText>
+                    <workingDirectory>${installdir}\tmp\</workingDirectory>
+                    <ruleList>
+                        <compareValues>
+                            <logic>equals</logic>
+                            <value1>${java_autodetected}</value1>
+                            <value2>0</value2>
+                        </compareValues>
+                    </ruleList>
+                </runProgram>
+            </postInstallationActionList>
+        </component>
+        <component>
+            <name>dhis2db</name>
+            <description>DHIS2 database</description>
+            <canBeEdited>1</canBeEdited>
+            <detailedDescription>DHIS2 Database</detailedDescription>
+            <selected>1</selected>
+            <show>1</show>
+            <folderList>
+                <folder>
+                    <destination>${installdir}\tmp\</destination>
+                    <name>newfolder</name>
+                    <platforms>windows</platforms>
+                    <distributionFileList>
+                        <distributionFile>
+                            <origin>../../resources/postgres/dhis2db.backup</origin>
+                        </distributionFile>
+                        <distributionFile>
+                            <origin>../../resources/postgres/restore_db.bat</origin>
+                        </distributionFile>
+                    </distributionFileList>
+                </folder>
+            </folderList>
+            <parameterList>
                 <passwordParameter>
                     <name>pg_password</name>
                     <title>Postgresql Password</title>
@@ -248,13 +341,6 @@
                 </stringParameter>
             </parameterList>
             <postInstallationActionList>
-                <runProgram>
-                    <explanation>Installing Postgresql</explanation>
-                    <program>postgresql-9.0.1-1-windows.exe</program>
-                    <programArguments>--unattendedmodeui none --mode unattended --superaccount postgres --servicepassword ${pg_password} --superpassword ${pg_password}</programArguments>
-                    <progressText>Installing Postgresql</progressText>
-                    <workingDirectory>${installdir}\tmp\</workingDirectory>
-                </runProgram>
                 <substitute>
                     <files>${installdir}\tmp\restore_db.bat</files>
                     <type>regexp</type>
@@ -279,70 +365,10 @@
                         </substitution>
                     </substitutionList>
                 </substitute>
-            </postInstallationActionList>
-        </component>
-        <component>
-            <name>jre</name>
-            <description>JRE</description>
-            <canBeEdited>1</canBeEdited>
-            <selected>1</selected>
-            <show>1</show>
-            <folderList>
-                <folder>
-                    <description>JRE</description>
-                    <destination>${installdir}\tmp\</destination>
-                    <name>JRE</name>
-                    <platforms>windows</platforms>
-                    <distributionFileList>
-                        <distributionFile>
-                            <origin>../../resources/jre/jre-6u24-windows-i586-s.exe</origin>
-                        </distributionFile>
-                    </distributionFileList>
-                </folder>
-            </folderList>
-            <postInstallationActionList>
-                <runProgram>
-                    <explanation>Installing Java Runtime Enviornment</explanation>
-                    <program>jre-6u24-windows-i586-s.exe</program>
-                    <programArguments>/s /v</programArguments>
-                    <progressText>Installing Java Runtime Enviornment</progressText>
-                    <workingDirectory>${installdir}\tmp\</workingDirectory>
-                    <ruleList>
-                        <compareValues>
-                            <logic>equals</logic>
-                            <negate>1</negate>
-                            <value1>${java_autodetected}</value1>
-                            <value2>1</value2>
-                        </compareValues>
-                    </ruleList>
-                </runProgram>
-            </postInstallationActionList>
-        </component>
-        <component>
-            <name>dhis2db</name>
-            <description>DHIS2 database</description>
-            <canBeEdited>1</canBeEdited>
-            <detailedDescription>DHIS2 Database</detailedDescription>
-            <selected>1</selected>
-            <show>1</show>
-            <folderList>
-                <folder>
-                    <destination>${installdir}\tmp\</destination>
-                    <name>newfolder</name>
-                    <platforms>windows</platforms>
-                    <distributionFileList>
-                        <distributionFile>
-                            <origin>../../resources/postgres/dhis2db.backup</origin>
-                        </distributionFile>
-                        <distributionFile>
-                            <origin>../../resources/postgres/restore_db.bat</origin>
-                        </distributionFile>
-                    </distributionFileList>
-                </folder>
-            </folderList>
-            <postInstallationActionList>
-                <runProgram>
-                    <explanation>Restoring Zambia Database</explanation>
+                <runProgram>
+                    <abortOnError>0</abortOnError>
+                    <customErrorMessage>An error occured. Your database may not have been restored.</customErrorMessage>
+                    <explanation>Restoring DHIS2 Database</explanation>
                     <program>restore_db.bat</program>
                     <programArguments></programArguments>
                     <progressText>Please be patient. Restoring DB.</progressText>