-Function EnterInstallType\r
- Push $R0\r
- Push $R1\r
- Push $R2\r
-\r
- ; Check if this is an upgrade by looking for an uninstaller configured \r
- ; in the registry.\r
- ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString"\r
-\r
- ${If} "$R0" != ""\r
- ; Check registry for new installer\r
- ReadRegStr $R1 HKLM "Software\Bacula" "InstallLocation"\r
- ${If} "$R1" != ""\r
- ; New Installer \r
- StrCpy $OldInstallDir $R1\r
- StrCpy $InstallType ${UpgradeInstall}\r
-\r
- SetShellVarContext all\r
-\r
- StrCpy $R1 "$APPDATA\Bacula"\r
- StrCpy $R2 "$INSTDIR\Doc"\r
-\r
- ReadRegDWORD $PreviousComponents HKLM "Software\Bacula" "Components"\r
-\r
- 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."\r
- WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The configuration files for additional components will be generated using defaults applicable to most installations."\r
- WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "The configuration defaults for additional components will be displayed and you will be given the chance to make changes before the configuration files are written."\r
-\r
- ReadRegDWORD $ConfigDirectorDB HKLM Software\Bacula Database\r
-\r
- ${If} $ConfigDirectorDB = 0\r
- IntOp $R0 $PreviousComponents & ${ComponentDirector}\r
- ${If} $R0 <> 0\r
- StrCpy $ConfigDirectorDB 1\r
- ${EndIf}\r
- ${EndIf}\r
- ${Else}\r
- ; Processing Upgrade - Get Install Directory\r
- ${StrRep} $R0 $R0 '"' ''\r
- ${GetParent} $R0 $OldInstallDir\r
-\r
- ; Old Installer \r
- StrCpy $InstallType ${MigrateInstall}\r
- StrCpy $R1 "$OldInstallDir\bin"\r
- StrCpy $R2 "$OldInstallDir\Doc"\r
-\r
- 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."\r
- 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."\r
- WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You may choose the installation directory. The configuration defaults will be displayed and you will be given the chance to make changes before the configuration files are written."\r
- ${EndIf}\r
- ${Else}\r
- ; New Install\r
- StrCpy $InstallType ${NewInstall}\r
- 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."\r
- ${EndIf}\r
-\r
- ${If} $InstallType <> ${NewInstall}\r
- ${AndIf} $PreviousComponents = 0\r
- ${If} ${FileExists} "$R1\bacula-fd.conf"\r
- IntOp $PreviousComponents $PreviousComponents | ${ComponentFile}\r
- ${EndIf}\r
- ${If} ${FileExists} "$R1\bconsole.conf"\r
- IntOp $PreviousComponents $PreviousComponents | ${ComponentTextConsole}\r
- ${EndIf}\r
- ${If} ${FileExists} "$R1\wx-console.conf"\r
- IntOp $PreviousComponents $PreviousComponents | ${ComponentGUIConsole}\r
- ${EndIf}\r
- ${If} ${FileExists} "$R2\bacula.pdf"\r
- IntOp $PreviousComponents $PreviousComponents | ${ComponentPDFDocs}\r
- ${EndIf}\r
- ${If} ${FileExists} "$R2\bacula\bacula.html"\r
- IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs}\r
- ${EndIf}\r
- ${If} ${FileExists} "$R2\bacula.html"\r
- IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs}\r
- ${EndIf}\r
- ${EndIf}\r
-\r
- !InsertMacro MUI_HEADER_TEXT "$(TITLE_InstallType)" "$(SUBTITLE_InstallType)"\r
- !InsertMacro MUI_INSTALLOPTIONS_INITDIALOG "InstallType.ini"\r
- Pop $HDLG ;HWND of dialog\r
-\r
- !insertmacro MUI_INSTALLOPTIONS_SHOW\r
-\r
- ; Process Results\r
-\r
- !insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallType.ini" "Field 3" "State"\r
-\r
- ${If} $R0 = 1\r
- StrCpy $AutomaticInstall 1\r
- ${Else}\r
- StrCpy $AutomaticInstall 0\r
- ${EndIf}\r
-\r
- Pop $R2\r
- Pop $R1\r
- Pop $R0\r
-FunctionEnd\r
+Function EnterInstallType
+ Push $R0
+ Push $R1
+ Push $R2
+
+ ; Check if this is an upgrade by looking for an uninstaller configured
+ ; in the registry.
+ ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString"
+
+ ${If} "$R0" != ""
+ ; Check registry for new installer
+ ReadRegStr $R1 HKLM "Software\Bacula" "InstallLocation"
+ ${If} "$R1" != ""
+ ; New Installer
+ StrCpy $OldInstallDir $R1
+ StrCpy $InstallType ${UpgradeInstall}
+
+ SetShellVarContext all
+
+ StrCpy $R1 "$APPDATA\Bacula"
+ StrCpy $R2 "$INSTDIR\Doc"
+
+ ReadRegDWORD $PreviousComponents HKLM "Software\Bacula" "Components"
+
+ 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."
+ WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The configuration files for additional components will be generated using defaults applicable to most installations."
+ WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "The configuration defaults for additional components will be displayed and you will be given the chance to make changes before the configuration files are written."
+
+ ReadRegDWORD $ConfigDirectorDB HKLM Software\Bacula Database
+
+ ${If} $ConfigDirectorDB = 0
+ IntOp $R0 $PreviousComponents & ${ComponentDirector}
+ ${If} $R0 <> 0
+ StrCpy $ConfigDirectorDB 1
+ ${EndIf}
+ ${EndIf}
+ ${Else}
+ ; Processing Upgrade - Get Install Directory
+ ${StrRep} $R0 $R0 '"' ''
+ ${GetParent} $R0 $OldInstallDir
+
+ ; Old Installer
+ StrCpy $InstallType ${MigrateInstall}
+ StrCpy $R1 "$OldInstallDir\bin"
+ StrCpy $R2 "$OldInstallDir\Doc"
+
+ 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."
+ WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"C:\Program Files\Bacula$\". The configuration files for additional components will be generated using defaults applicable to most installations."
+ WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 6" "Text" "You may choose the installation directory. The configuration defaults will be displayed and you will be given the chance to make changes before the configuration files are written."
+ ${EndIf}
+ ${Else}
+ ; New Install
+ StrCpy $InstallType ${NewInstall}
+ WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The software will be installed in the default directory $\"C:\Program Files\Bacula$\". The configuration files will be generated using defaults applicable to most installations."
+ ${EndIf}
+
+ ${If} $InstallType <> ${NewInstall}
+ ${AndIf} $PreviousComponents = 0
+ ${If} ${FileExists} "$R1\bacula-fd.conf"
+ IntOp $PreviousComponents $PreviousComponents | ${ComponentFile}
+ ${EndIf}
+ ${If} ${FileExists} "$R1\bconsole.conf"
+ IntOp $PreviousComponents $PreviousComponents | ${ComponentTextConsole}
+ ${EndIf}
+ ${If} ${FileExists} "$R1\wx-console.conf"
+ IntOp $PreviousComponents $PreviousComponents | ${ComponentGUIConsole}
+ ${EndIf}
+ ${If} ${FileExists} "$R2\bacula.pdf"
+ IntOp $PreviousComponents $PreviousComponents | ${ComponentPDFDocs}
+ ${EndIf}
+ ${If} ${FileExists} "$R2\bacula\bacula.html"
+ IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs}
+ ${EndIf}
+ ${If} ${FileExists} "$R2\bacula.html"
+ IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs}
+ ${EndIf}
+ ${EndIf}
+
+ !InsertMacro MUI_HEADER_TEXT "$(TITLE_InstallType)" "$(SUBTITLE_InstallType)"
+ !InsertMacro MUI_INSTALLOPTIONS_INITDIALOG "InstallType.ini"
+ Pop $HDLG ;HWND of dialog
+
+ !insertmacro MUI_INSTALLOPTIONS_SHOW
+
+ ; Process Results
+
+ !insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallType.ini" "Field 3" "State"
+
+ ${If} $R0 = 1
+ StrCpy $AutomaticInstall 1
+ ${Else}
+ StrCpy $AutomaticInstall 0
+ ${EndIf}
+
+ Pop $R2
+ Pop $R1
+ Pop $R0
+FunctionEnd