3 ; Written by Michel Meyers (michel@tcnnet.dyndns.org)
5 ; Updated by Kern Sibbald for native Win32 Bacula
6 ; added a number of elements from Christopher Hull's installer
8 ; D. Scott Barninger Nov 13 2004
9 ; added configuration editing for bconsole.conf and wx-console.conf
10 ; better explanation in dialog boxes for editing config files
11 ; added Start Menu items
12 ; fix uninstall of config files to do all not just bacula-fd.conf
14 ; Command line options:
16 ; /cygwin - do cygwin install into c:\cygwin\bacula
20 !define PRODUCT "Bacula"
21 !define VERSION "@VERSION@"
24 ; Include the Modern UI
34 OutFile "winbacula-${VERSION}.exe"
36 InstallDir "c:\bacula"
41 !insertmacro MUI_PAGE_WELCOME
42 ; !insertmacro MUI_PAGE_LICENSE "License.txt"
43 !insertmacro MUI_PAGE_COMPONENTS
44 !insertmacro MUI_PAGE_DIRECTORY
45 !insertmacro MUI_PAGE_INSTFILES
46 !insertmacro MUI_PAGE_FINISH
48 !insertmacro MUI_UNPAGE_WELCOME
49 !insertmacro MUI_UNPAGE_CONFIRM
50 !insertmacro MUI_UNPAGE_INSTFILES
51 !insertmacro MUI_UNPAGE_FINISH
54 !define MUI_ABORTWARNING
56 !insertmacro MUI_LANGUAGE "English"
60 DirText "Setup will install the Bacula Client ${VERSION} to the directory specified below. To install in a different folder, click Browse and select another folder.$\n$\nNote to CYGWIN users: please choose your CYGWIN root directory."
63 Section "Bacula File Service" SecService
65 ; /cygwin on command line forces install dir to c:\cygwin\bacula (useful for silent install)
71 StrCpy $INSTDIR "c:\cygwin\bacula"
73 ; IfFileExists "c:\cygwin" Cygwin ReallyNoCygwin
75 ; StrCpy $INSTDIR "c:\cygwin\bacula"
78 ; Check for existing installation
80 IfFileExists "$INSTDIR\bin\bacula-fd.conf" Upgrade NoUpgrade
83 ; Shutdown any baculas that could be running
84 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
85 ; give it some time to shutdown
89 ; Set output path to the installation directory.
90 SetOutPath "$INSTDIR\bin"
91 CreateDirectory "$INSTDIR"
92 CreateDirectory "$INSTDIR\bin"
93 CreateDirectory "$INSTDIR\working"
94 CreateDirectory "c:\tmp"
96 File baculafd\Release\bacula-fd.exe
97 File ..\..\..\depkgs-win32\pthreads\pthreadVCE.dll
99 IfFileExists "$INSTDIR\bin\bacula-fd.conf" newconf
100 File baculafd\bacula-fd.conf
103 File /oname=bacula-fd.conf.new baculafd\bacula-fd.conf
105 ; If /service was given jump to the service install part
112 ; If silent install and not /service don't ask questions and goto NoService...
115 ; If already installed as service skip it too
116 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
117 StrCmp $9 "1" NoService
119 ; Install as service?
120 MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to install the Bacula Client as a service (automatically starts with your PC)?" IDNO NoService
122 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /install'
124 WriteRegDWORD HKLM "Software\Bacula" "InstalledService" "1"
127 ; Create Start Menu Directory
128 SetShellVarContext all
129 CreateDirectory "$SMPROGRAMS\Bacula"
130 ; If not installed as service create Start Menu link
131 StrCmp $9 "1" Uninstall
132 CreateShortCut "$SMPROGRAMS\Bacula\Start Bacula Client.lnk" "$INSTDIR\bin\bacula-fd.exe" "-c $INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.exe" 0
135 ; Write the uninstall keys for Windows & create Start Menu entry
136 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula Client"
137 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
138 WriteUninstaller "$INSTDIR\Uninstall.exe"
139 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
141 ; Create bacula-fd.conf and have the user edit it (skipped if silent)
143 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
144 MessageBox MB_OK "Please edit the client configuration file $INSTDIR\bin\bacula-fd.conf to fit your installation. When you click the OK button Wordpad will open to allow you to do this. Be sure to save your changes before closing Wordpad."
145 Exec 'write "$INSTDIR\bin\bacula-fd.conf"' ; spawn wordpad with the file to be edited
148 ; Start the client? (default skipped if silent, use /start to force starting)
156 StrCmp $R0 "false" do_win98
157 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
158 Exec 'net start bacula'
163 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
165 Exec '"$INSTDIR\bin\bacula-fd.exe" -c "$INSTDIR\bin\bacula-fd.conf"'
169 Section "Install Console" SecConsole
170 SetOutPath "$INSTDIR\bin"
171 File console\Release\bconsole.exe
172 IfFileExists "$INSTDIR\bin\bconsole.conf" newconf
173 File console\bconsole.conf
176 File /oname=bconsole.conf.new console\bconsole.conf
179 ; Create bconsole.conf and have the user edit it (skipped if silent)
181 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
182 MessageBox MB_OK "Please edit the command line console configuration file $INSTDIR\bin\bconsole.conf to fit your installation. When you click the OK button Wordpad will open to allow you to do this. Be sure to save your changes before closing Wordpad."
183 Exec 'write "$INSTDIR\bin\bconsole.conf"' ; spawn wordpad with the file to be edited
187 Section "Install wx-Console" SecWxConsole
188 SetOutPath "$INSTDIR\bin"
189 File wx-console\Release\wx-console.exe
190 IfFileExists "$INSTDIR\bin\wx-console.conf" newconf
191 File wx-console\wx-console.conf
194 File /oname=wx-console.conf.new wx-console\wx-console.conf
196 ; Create Start Menu entry
197 SetShellVarContext all
198 CreateShortCut "$SMPROGRAMS\Bacula\WX-Console.lnk" "$INSTDIR\bin\wx-console.exe" "-c $INSTDIR\bin\wx-console.conf" "$INSTDIR\bin\wx-console.exe" 0
200 ; Create wx-console.conf and have the user edit it (skipped if silent)
202 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
203 MessageBox MB_OK "Please edit the WX-console configuration file $INSTDIR\bin\wx-console.conf to fit your installation. When you click the OK button Wordpad will open to allow you to do this. Be sure to save your changes before closing Wordpad."
204 Exec 'write "$INSTDIR\bin\wx-console.conf"' ; spawn wordpad with the file to be edited
209 Section "Install Documentation" SecDoc
210 SetOutPath "$INSTDIR\doc"
211 CreateDirectory "$INSTDIR\doc"
212 File ..\..\doc\html-manual\*.html
213 File ..\..\doc\html-manual\*.gif
214 File ..\..\doc\html-manual\*.jpg
218 ; Extra Page descriptions
221 LangString DESC_SecService ${LANG_ENGLISH} "Install Bacula client on this system."
222 LangString DESC_SecConsole ${LANG_ENGLISH} "Install Console program on this system."
223 LangString DESC_SecWxConsole ${LANG_ENGLISH} "Install graphical console program on this system."
224 LangString DESC_SecDoc ${LANG_ENGLISH} "Install Documentation on this system."
226 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
227 !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
228 !insertmacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
229 !insertmacro MUI_DESCRIPTION_TEXT ${SecWxConsole} $(DESC_SecWxConsole)
230 !insertmacro MUI_DESCRIPTION_TEXT ${SecDoc} $(DESC_SecDoc)
231 !insertmacro MUI_FUNCTION_DESCRIPTION_END
237 UninstallText "This will uninstall the Bacula Client. Hit next to continue."
241 ; Shutdown any baculum that could be running
242 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
244 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
245 StrCmp $9 "" NoService
246 ; Remove bacula service
247 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /remove'
250 ; remove registry keys
251 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
252 DeleteRegKey HKLM "Software\Bacula"
254 ; remove start menu items
255 SetShellVarContext all
256 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
258 ; remove files and uninstaller (preserving config for now)
259 CopyFiles /SILENT "$INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bacula-fd.conf"
260 IfFileExists "$INSTDIR\bin\bconsole.conf" save_bconsole nosave_bconsole
262 CopyFiles /SILENT "$INSTDIR\bin\bconsole.conf" "$INSTDIR\bconsole.conf"
264 IfFileExists "$INSTDIR\bin\wx-console.conf" save_wxconsole nosave_wxconsole
266 CopyFiles /SILENT "$INSTDIR\bin\wx-console.conf" "$INSTDIR\wx-console.conf"
268 Delete /REBOOTOK "$INSTDIR\bin\*.*"
269 Delete /REBOOTOK "$INSTDIR\doc\*.*"
270 CopyFiles /SILENT "$INSTDIR\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.conf"
271 CopyFiles /SILENT "$INSTDIR\bconsole.conf" "$INSTDIR\bin\bconsole.conf"
272 CopyFiles /SILENT "$INSTDIR\wx-console.conf" "$INSTDIR\bin\wx-console.conf"
273 Delete /REBOOTOK "$INSTDIR\*.conf"
274 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
276 ; Check for existing installation
277 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to delete the current configuration files?" IDNO LeaveConfig
278 Delete /REBOOTOK "$INSTDIR\bin\*.conf"
279 ; remove directories used
282 RMDir "$INSTDIR\working"
286 RMDir "$SMPROGRAMS\Bacula"