1Function EnterInstallType 2 Push $R0 3 Push $R1 4 Push $R2 5 6 ; Check if this is an upgrade by looking for an uninstaller configured 7 ; in the registry. 8 ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" 9 10 ${If} "$R0" != "" 11 ; Check registry for new installer 12 ReadRegStr $R1 HKLM "Software\Bacula" "InstallLocation" 13 ${If} "$R1" != "" 14 ; New Installer 15 StrCpy $OldInstallDir $R1 16 StrCpy $InstallType ${UpgradeInstall} 17 18 SetShellVarContext all 19 20 StrCpy $R1 "$APPDATA\Bacula" 21 StrCpy $R2 "$INSTDIR\Doc" 22 23 ReadRegDWORD $PreviousComponents HKLM "Software\Bacula" "Components" 24 25 WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 1" "Text" "A previous installation has been found in $OldInstallDir. Please choose the installation type for any additional components you select." 26 WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The configuration files for additional components will be generated using defaults applicable to most installations." 27 WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." 28 29 ReadRegDWORD $ConfigDirectorDB HKLM Software\Bacula Database 30 31 ${If} $ConfigDirectorDB = 0 32 IntOp $R0 $PreviousComponents & ${ComponentDirector} 33 ${If} $R0 <> 0 34 StrCpy $ConfigDirectorDB 1 35 ${EndIf} 36 ${EndIf} 37 ${Else} 38 ; Processing Upgrade - Get Install Directory 39 ${StrRep} $R0 $R0 '"' '' 40 ${GetParent} $R0 $OldInstallDir 41 42 ; Old Installer 43 StrCpy $InstallType ${MigrateInstall} 44 StrCpy $R1 "$OldInstallDir\bin" 45 StrCpy $R2 "$OldInstallDir\Doc" 46 47 WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 1" "Text" "An old installation has been found in $OldInstallDir. The Configuration will be migrated. Please choose the installation type for any additional components you select." 48 WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"$PROGRAMFILES\Bacula$\". The configuration files for additional components will be generated using defaults applicable to most installations." 49 WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." 50 ${EndIf} 51 ${Else} 52 ; New Install 53 StrCpy $InstallType ${NewInstall} 54 WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"$PROGRAMFILES\Bacula$\". The configuration files will be generated using defaults applicable to most installations." 55 WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work." 56 ${EndIf} 57 58 ${If} $InstallType <> ${NewInstall} 59 ${AndIf} $PreviousComponents = 0 60 ${If} ${FileExists} "$R1\bacula-fd.conf" 61 IntOp $PreviousComponents $PreviousComponents | ${ComponentFile} 62 ${EndIf} 63 ${If} ${FileExists} "$R1\bconsole.conf" 64 IntOp $PreviousComponents $PreviousComponents | ${ComponentTextConsole} 65 ${EndIf} 66 ${If} ${FileExists} "$R1\bat.conf" 67 IntOp $PreviousComponents $PreviousComponents | ${ComponentBatConsole} 68 ${EndIf} 69 ${If} ${FileExists} "$R1\wx-console.conf" 70 IntOp $PreviousComponents $PreviousComponents | ${ComponentGUIConsole} 71 ${EndIf} 72 ${If} ${FileExists} "$R2\bacula.pdf" 73 IntOp $PreviousComponents $PreviousComponents | ${ComponentPDFDocs} 74 ${EndIf} 75 ${If} ${FileExists} "$R2\bacula\bacula.html" 76 IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs} 77 ${EndIf} 78 ${If} ${FileExists} "$R2\bacula.html" 79 IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs} 80 ${EndIf} 81 ${EndIf} 82 83 !InsertMacro MUI_HEADER_TEXT "$(TITLE_InstallType)" "$(SUBTITLE_InstallType)" 84 !InsertMacro MUI_INSTALLOPTIONS_INITDIALOG "InstallType.ini" 85 Pop $HDLG ;HWND of dialog 86 87 !insertmacro MUI_INSTALLOPTIONS_SHOW 88 89 ; Process Results 90 91 !insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallType.ini" "Field 3" "State" 92 93 ${If} $R0 = 1 94 StrCpy $AutomaticInstall 1 95 ${Else} 96 StrCpy $AutomaticInstall 0 97 ${EndIf} 98 99 Pop $R2 100 Pop $R1 101 Pop $R0 102FunctionEnd 103