1 Function EnterInstallType
6 ; Check if this is an upgrade by looking for an uninstaller configured
8 ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString"
11 ; Check registry for new installer
12 ReadRegStr $R1 HKLM "Software\Bacula" "InstallLocation"
15 StrCpy $OldInstallDir $R1
16 StrCpy $InstallType ${UpgradeInstall}
18 SetShellVarContext all
20 StrCpy $R1 "$APPDATA\Bacula"
21 StrCpy $R2 "$INSTDIR\Doc"
23 ReadRegDWORD $PreviousComponents HKLM "Software\Bacula" "Components"
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" "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."
29 ReadRegDWORD $ConfigDirectorDB HKLM Software\Bacula Database
31 ${If} $ConfigDirectorDB = 0
32 IntOp $R0 $PreviousComponents & ${ComponentDirector}
34 StrCpy $ConfigDirectorDB 1
38 ; Processing Upgrade - Get Install Directory
39 ${StrRep} $R0 $R0 '"' ''
40 ${GetParent} $R0 $OldInstallDir
43 StrCpy $InstallType ${MigrateInstall}
44 StrCpy $R1 "$OldInstallDir\bin"
45 StrCpy $R2 "$OldInstallDir\Doc"
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 $\"C:\Program Files\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 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."
53 StrCpy $InstallType ${NewInstall}
54 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."
57 ${If} $InstallType <> ${NewInstall}
58 ${AndIf} $PreviousComponents = 0
59 ${If} ${FileExists} "$R1\bacula-fd.conf"
60 IntOp $PreviousComponents $PreviousComponents | ${ComponentFile}
62 ${If} ${FileExists} "$R1\bconsole.conf"
63 IntOp $PreviousComponents $PreviousComponents | ${ComponentTextConsole}
65 ${If} ${FileExists} "$R1\wx-console.conf"
66 IntOp $PreviousComponents $PreviousComponents | ${ComponentGUIConsole}
68 ${If} ${FileExists} "$R2\bacula.pdf"
69 IntOp $PreviousComponents $PreviousComponents | ${ComponentPDFDocs}
71 ${If} ${FileExists} "$R2\bacula\bacula.html"
72 IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs}
74 ${If} ${FileExists} "$R2\bacula.html"
75 IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs}
79 !InsertMacro MUI_HEADER_TEXT "$(TITLE_InstallType)" "$(SUBTITLE_InstallType)"
80 !InsertMacro MUI_INSTALLOPTIONS_INITDIALOG "InstallType.ini"
81 Pop $HDLG ;HWND of dialog
83 !insertmacro MUI_INSTALLOPTIONS_SHOW
87 !insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallType.ini" "Field 3" "State"
90 StrCpy $AutomaticInstall 1
92 StrCpy $AutomaticInstall 0