]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/installer/InstallType.nsh
Enhance Job messages from SD when the FD->SD protocol is incorrect
[bacula/bacula] / bacula / src / win32 / installer / InstallType.nsh
1 Function EnterInstallType\r
2   Push $R0\r
3   Push $R1\r
4   Push $R2\r
5 \r
6   ; Check if this is an upgrade by looking for an uninstaller configured \r
7   ; in the registry.\r
8   ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString"\r
9 \r
10   ${If} "$R0" != ""\r
11     ; Check registry for new installer\r
12     ReadRegStr $R1 HKLM "Software\Bacula" "InstallLocation"\r
13     ${If} "$R1" != ""\r
14       ; New Installer \r
15       StrCpy $OldInstallDir $R1\r
16       StrCpy $InstallType ${UpgradeInstall}\r
17 \r
18       SetShellVarContext all\r
19 \r
20       StrCpy $R1 "$APPDATA\Bacula"\r
21       StrCpy $R2 "$INSTDIR\Doc"\r
22 \r
23       ReadRegDWORD $PreviousComponents HKLM "Software\Bacula" "Components"\r
24 \r
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."\r
26       WriteINIStr "$PLUGINSDIR\InstallType.ini" "Field 5" "Text" "The configuration files for additional components will be generated using defaults applicable to most installations."\r
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."\r
28 \r
29       ReadRegDWORD $ConfigDirectorDB HKLM Software\Bacula Database\r
30 \r
31       ${If} $ConfigDirectorDB = 0\r
32         IntOp $R0 $PreviousComponents & ${ComponentDirector}\r
33         ${If} $R0 <> 0\r
34           StrCpy $ConfigDirectorDB 1\r
35         ${EndIf}\r
36       ${EndIf}\r
37     ${Else}\r
38       ; Processing Upgrade - Get Install Directory\r
39       ${StrRep} $R0 $R0 '"' ''\r
40       ${GetParent} $R0 $OldInstallDir\r
41 \r
42       ; Old Installer \r
43       StrCpy $InstallType ${MigrateInstall}\r
44       StrCpy $R1 "$OldInstallDir\bin"\r
45       StrCpy $R2 "$OldInstallDir\Doc"\r
46 \r
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."\r
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."\r
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."\r
50     ${EndIf}\r
51   ${Else}\r
52     ; New Install\r
53     StrCpy $InstallType ${NewInstall}\r
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."\r
55   ${EndIf}\r
56 \r
57   ${If} $InstallType <> ${NewInstall}\r
58   ${AndIf} $PreviousComponents = 0\r
59     ${If} ${FileExists} "$R1\bacula-fd.conf"\r
60       IntOp $PreviousComponents $PreviousComponents | ${ComponentFile}\r
61     ${EndIf}\r
62     ${If} ${FileExists} "$R1\bconsole.conf"\r
63       IntOp $PreviousComponents $PreviousComponents | ${ComponentTextConsole}\r
64     ${EndIf}\r
65     ${If} ${FileExists} "$R1\wx-console.conf"\r
66       IntOp $PreviousComponents $PreviousComponents | ${ComponentGUIConsole}\r
67     ${EndIf}\r
68     ${If} ${FileExists} "$R2\bacula.pdf"\r
69       IntOp $PreviousComponents $PreviousComponents | ${ComponentPDFDocs}\r
70     ${EndIf}\r
71     ${If} ${FileExists} "$R2\bacula\bacula.html"\r
72       IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs}\r
73     ${EndIf}\r
74     ${If} ${FileExists} "$R2\bacula.html"\r
75       IntOp $PreviousComponents $PreviousComponents | ${ComponentHTMLDocs}\r
76     ${EndIf}\r
77   ${EndIf}\r
78 \r
79   !InsertMacro MUI_HEADER_TEXT "$(TITLE_InstallType)" "$(SUBTITLE_InstallType)"\r
80   !InsertMacro MUI_INSTALLOPTIONS_INITDIALOG "InstallType.ini"\r
81   Pop $HDLG ;HWND of dialog\r
82 \r
83   !insertmacro MUI_INSTALLOPTIONS_SHOW\r
84 \r
85   ; Process Results\r
86 \r
87   !insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallType.ini" "Field 3" "State"\r
88 \r
89   ${If} $R0 = 1\r
90     StrCpy $AutomaticInstall 1\r
91   ${Else}\r
92     StrCpy $AutomaticInstall 0\r
93   ${EndIf}\r
94 \r
95   Pop $R2\r
96   Pop $R1\r
97   Pop $R0\r
98 FunctionEnd\r