Index: win_installer/src/installer.nsi =================================================================== diff -u -rdb1ce9627b426554947ee0857efa91639ed0552a -r79c1de30d6cd1ce1886f9990e2407556e6a5d561 --- win_installer/src/installer.nsi (.../installer.nsi) (revision db1ce9627b426554947ee0857efa91639ed0552a) +++ win_installer/src/installer.nsi (.../installer.nsi) (revision 79c1de30d6cd1ce1886f9990e2407556e6a5d561) @@ -190,6 +190,10 @@ Var WILDFIRE_PASS Var WINTEMP Var RETAIN_DIR +Var RETAIN_FILES +Var RETAIN_CONF +Var RETAIN_DB +Var RETAIN_REP # installer sections @@ -224,6 +228,10 @@ File /a "..\build\lams-stop.exe" Call SetupStartMenu + ${if} $RETAIN_FILES == "1" + Call OverWriteRetainedFiles + ${endif} + WriteUninstaller "$INSTDIR\lams-uninstall.exe" SectionEnd @@ -385,6 +393,44 @@ Abort ${EndIf} ${EndIf} + + Strcpy $RETAIN_FILES "0" + Strcpy $RETAIN_CONF "0" + Strcpy $RETAIN_DB "0" + Strcpy $RETAIN_REP "0" + IfFileExists "$INSTDIR\jboss-4.0.2" instdirExists newInstDir + instdirExists: + ; CHECK if there are files retained from a previous uninstall + ; THEN after installation, overwrite retained files and free files from temp folder temp folder + + + IfFileExists "$INSTDIR\repository" repositoryExists noRepository + repositoryExists: + strcpy $6 "- Repository and uploaded files from previous installation" + Strcpy $RETAIN_REP "1" + noRepository: + + IfFileExists "$INSTDIR\jboss-4.0.2\server\default\conf" configs noConfigs + configs: + strcpy $7 "- Configuration files from a previous install 'log4j.xml' and 'server.xml'" + Strcpy $RETAIN_CONF "1" + noConfigs: + + IfFileExists "$INSTDIR\lamsDump.sql" database noDatabase + database: + strcpy $8 "- Database dump from previous installation" + Strcpy $RETAIN_DB "1" + noDatabase: + + MessageBox MB_YESNO|MB_ICONQUESTION "Installer has detected some files retained from a previous install, do you wish to use them? $\r $\n$6$\n$7$\n$8" \ + IDYES retainFiles \ + IDNO newInstDir + retainFiles: + Strcpy $WINTEMP "C:\WINDOWS\Temp" + Strcpy $RETAIN_FILES "1" + CopyFiles $INSTDIR $WINTEMP + MessageBox MB_OK|MB_ICONEXCLAMATION "$RETAIN_FILES \n $RETAIN_REP $\n $RETAIN_CONF $\n $RETAIN_DB" + newInstDir: FunctionEnd @@ -774,6 +820,23 @@ WriteRegStr HKLM "${REG_HEAD}" "wildfire_pass" $WILDFIRE_PASS FunctionEnd +Function OverWriteRetainedFiles + + MessageBox MB_OK|MB_ICONSTOP "repository files to be retained" + + ${if} $RETAIN_REP == "1" + #copy repository and uploaded files to install directory + MessageBox MB_OK|MB_ICONSTOP "repository files to be retained" + CopyFiles "$WINTEMP\lams\repository" "$INSTDIR\" + CopyFiles "$WINTEMP\lams\jboss-4.0.2\server\default\deploy\lams.ear\lams-www.war" "$INSTDIR\jboss-4.0.2\server\default\deploy\lams.ear\" + ${endif} + ${if} $RETAIN_CONF == "1" + #copy configuration files to be kept + MessageBox MB_OK|MB_ICONSTOP "CONF files to be retained" + CopyFiles "$WINTEMP\lams\jboss-4.0.2\server\default\conf\log4j.xml" "$INSTDIR\jboss-4.0.2\server\default\conf\log4j.xml" + CopyFiles "$WINTEMP\lams\jboss-4.0.2\server\default\deploy\jbossweb-tomcat55.sar" "$INSTDIR\jboss-4.0.2\server\default\deploy\jbossweb-tomcat55.sar\server.xml" + ${endif} +FunctionEnd Function SetupStartMenu CreateDirectory "$SMPROGRAMS\LAMSv2" @@ -862,7 +925,7 @@ FunctionEnd Function un.PostUninstall - !insertmacro MUI_INSTALLOPTIONS_READ $UNINSTALL_DB "uninstall.ini" "Field 4" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $UNINSTALL_DB "uninstall.ini" "Field 1" "State" !insertmacro MUI_INSTALLOPTIONS_READ $UNINSTALL_RP "uninstall.ini" "Field 2" "State" !insertmacro MUI_INSTALLOPTIONS_READ $UNINSTALL_CF "uninstall.ini" "Field 3" "State" FunctionEnd @@ -941,10 +1004,12 @@ strcpy $RETAIN_DIR $INSTDIR ;create a directory in temp to store retained folders until they can be put into permanent storage ;NOTE that $TEMP cannot be used here as it does not point to C:\WINDOWS\TEMP + RMDir /r "$WINTEMP\lams" CreateDirectory "$WINTEMP\lams" ;Now copy files that are to be retained to the temp folder ${If} $UNINSTALL_RP == 0 + MessageBox MB_OK|MB_ICONEXCLAMATION "retaining repository" ; KEEP repository and uploaded files ; Copy repository and jboss-4.0.2\server\default\deploy\lams.ear\lams-www.war to TEMP ReadRegStr $6 HKLM "${REG_HEAD}" "dir_repository" @@ -953,7 +1018,8 @@ CopyFiles "$INSTDIR\jboss-4.0.2\server\default\deploy\lams.ear\lams-www.war" "$WINTEMP\lams\jboss-4.0.2\server\default\deploy\lams.ear\" DetailPrint 'Saving repository and uploaded files to: $RETAIN_DIR' ${EndIf} - ${If} $UNINSTALL_CF == 0 + ${If} $UNINSTALL_CF == 0 + Messagebox MB_OK|MB_ICONEXCLAMATION "retaining conf" ;KEEP some configuration files CreateDirectory "$WINTEMP\lams\jboss-4.0.2\server\default\conf" CreateDirectory "$WINTEMP\lams\jboss-4.0.2\server\default\deploy\jbossweb-tomcat55.sar" @@ -966,12 +1032,17 @@ RMDir /r $INSTDIR - ; RESTORE Retained folders to their original localtion - CreateDirectory "$RETAIN_DIR" - CopyFiles "$WINTEMP\LAMS" "$RETAIN_DIR\..\" - RMDir /r "$RETAIN_DIR\jboss-4.0.2\server\default\deploy\jbossweb-tomcat55.sar\jbossweb-tomcat55.sar" - Delete "$RETAIN_DIR\jboss-4.0.2\server\default\deploy\server.xml" - RMDir /r "$WINTEMP\Lams" + ; RESTORE Retained folders to their original localtion then delete temp files + ${if} $UNINSTALL_CF == 0 + ${orif} $UNINSTALL_DB == 0 + CreateDirectory "$RETAIN_DIR" + CopyFiles "$WINTEMP\lams" "$RETAIN_DIR\..\" + RMDir /r "$RETAIN_DIR\jboss-4.0.2\server\default\deploy\jbossweb-tomcat55.sar\jbossweb-tomcat55.sar" + Delete "$RETAIN_DIR\jboss-4.0.2\server\default\deploy\server.xml" + ${endif} + RMDir /r "$WINTEMP\lams" + + ; NOT SURE IF THIS SECTION OF CODE IS NECCESSARY ReadRegStr $0 HKLM "${REG_HEAD}" "dir_conf" RMDir /r $0 @@ -981,12 +1052,12 @@ ReadRegStr $2 HKLM "${REG_HEAD}" "db_user" ReadRegStr $3 HKLM "${REG_HEAD}" "db_pass" ${If} $UNINSTALL_DB == 0 + Messagebox MB_OK|MB_ICONEXCLAMATION "retaining db" ; DUMP the database file into the retained install directory Strcpy $4 "$0\bin\mysqldump -r $RETAIN_DIR\lamsDump.sql $1 -u $2 -p$3" nsExec::ExecToStack $4 Pop $8 Pop $9 - MessageBox MB_OK|MB_ICONEXCLAMATION "$8 $\n $9" DetailPrint 'Dumping database to: $RETAIN_DIR' ${EndIf} StrLen $9 $3 Index: win_installer/src/uninstall.ini =================================================================== diff -u -rae13f2caa2572e368b592d80912e09782ce5a56a -r79c1de30d6cd1ce1886f9990e2407556e6a5d561 --- win_installer/src/uninstall.ini (.../uninstall.ini) (revision ae13f2caa2572e368b592d80912e09782ce5a56a) +++ win_installer/src/uninstall.ini (.../uninstall.ini) (revision 79c1de30d6cd1ce1886f9990e2407556e6a5d561) @@ -1,11 +1,37 @@ [Settings] -NumFields=1 +NumFields=4 [Field 1] Type=CheckBox -Left=8 -Top=30 -Right=121 -Bottom=40 -Text=Remove LAMS database? +Left=17 +Top=42 +Right=130 +Bottom=52 +Text=Remove LAMS database State=1 + +[Field 2] +Type=CheckBox +Left=17 +Top=64 +Right=178 +Bottom=74 +Text=Remove LAMS repository and uplloaded files +State=1 + +[Field 3] +Type=CheckBox +Left=17 +Top=86 +Right=130 +Bottom=96 +Text=Remove configuration files +State=1 + +[Field 4] +Type=GroupBox +Left=9 +Top=25 +Right=267 +Bottom=113 +Text=Do you wish to remove all LAMS files? Fisheye: Tag 79c1de30d6cd1ce1886f9990e2407556e6a5d561 refers to a dead (removed) revision in file `win_installer/src/uninstall_back.ini'. Fisheye: No comparison available. Pass `N' to diff?