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" "You have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work."
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 have more options, but you will have to manually edit your bacula-fd.conf file before Bacula will work."
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."
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."
58 ${If} $InstallType <> ${NewInstall}
59 ${AndIf} $PreviousComponents = 0
60 ${If} ${FileExists} "$R1\bacula-fd.conf"
61 IntOp $PreviousComponents $PreviousComponents | ${ComponentFile}
63 ${If} ${FileExists} "$R1\bconsole.conf"
64 IntOp $PreviousComponents $PreviousComponents | ${ComponentTextConsole}
66 ${If} ${FileExists} "$R1\bat.conf"
67 IntOp $PreviousComponents $PreviousComponents | ${ComponentBatConsole}
69 ${If} ${FileExists} "$R2\main.pdf"
70 IntOp $PreviousComponents $PreviousComponents | ${ComponentPDFDocs}
74 !InsertMacro MUI_HEADER_TEXT "$(TITLE_InstallType)" "$(SUBTITLE_InstallType)"
75 !InsertMacro MUI_INSTALLOPTIONS_INITDIALOG "InstallType.ini"
76 Pop $HDLG ;HWND of dialog
78 !insertmacro MUI_INSTALLOPTIONS_SHOW
82 !insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallType.ini" "Field 3" "State"
85 StrCpy $AutomaticInstall 1
87 StrCpy $AutomaticInstall 0