3 ; Began as a version written by Michel Meyers (michel@tcnnet.dyndns.org)
5 ; Adapted 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 ; D. Scott Barninger Dec 05 2004
15 ; added specification of default permissions for bacula-fd.conf
16 ; - thanks to Jamie Ffolliott for pointing me at cacls
17 ; added removal of working-dir files if user selects to remove config
18 ; uninstall is now 100% clean
20 ; D. Scott Barninger Apr 17 2005
21 ; 1.36.3 release docs update
22 ; add pdf manual and menu shortcut
24 ; Command line options:
26 ; /cygwin - do cygwin install into c:\cygwin\bacula
30 !define PRODUCT "Bacula"
31 !define VERSION "@VERSION@"
34 ; Include the Modern UI
44 OutFile "winbacula-${VERSION}.exe"
46 InstallDir "c:\bacula"
51 !insertmacro MUI_PAGE_WELCOME
52 ; !insertmacro MUI_PAGE_LICENSE "..\..\LICENSE"
53 !insertmacro MUI_PAGE_COMPONENTS
54 !insertmacro MUI_PAGE_DIRECTORY
55 !insertmacro MUI_PAGE_INSTFILES
56 !insertmacro MUI_PAGE_FINISH
58 !insertmacro MUI_UNPAGE_WELCOME
59 !insertmacro MUI_UNPAGE_CONFIRM
60 !insertmacro MUI_UNPAGE_INSTFILES
61 !insertmacro MUI_UNPAGE_FINISH
64 !define MUI_ABORTWARNING
66 !insertmacro MUI_LANGUAGE "English"
70 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."
73 Section "Bacula File Service" SecService
75 ; /cygwin on command line forces install dir to c:\cygwin\bacula (useful for silent install)
81 StrCpy $INSTDIR "c:\cygwin\bacula"
83 ; IfFileExists "c:\cygwin\bin\cygwin1.dll" Cygwin ReallyNoCygwin
85 ; StrCpy $INSTDIR "c:\cygwin\bacula"
88 ; Check for existing installation
90 IfFileExists "$INSTDIR\bin\bacula-fd.conf" Upgrade NoUpgrade
93 ; Shutdown any bacula that could be running
94 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
95 ; give it some time to shutdown
99 ; Set output path to the installation directory.
100 SetOutPath "$INSTDIR\bin"
101 CreateDirectory "$INSTDIR"
102 CreateDirectory "$INSTDIR\bin"
103 CreateDirectory "$INSTDIR\working"
104 CreateDirectory "c:\tmp"
106 File baculafd\Release\bacula-fd.exe
107 File c:\windows\system32\msvcr71.dll
108 File ..\..\..\depkgs-win32\pthreads\pthreadVCE.dll
110 Delete /REBOOTOK "$INSTDIR\bin\License.txt"
111 IfFileExists "$INSTDIR\bin\bacula-fd.conf" newconf
112 File baculafd\bacula-fd.conf
115 File /oname=bacula-fd.conf.new baculafd\bacula-fd.conf
117 ; If /service was given jump to the service install part
124 ; If silent install and not /service don't ask questions and goto NoService...
127 ; If already installed as service skip it too
128 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
129 StrCmp $9 "1" NoService
131 ; Install as service?
132 MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to install the Bacula Client as a service (automatically starts with your PC)?" IDNO NoService
134 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /install'
136 WriteRegDWORD HKLM "Software\Bacula" "InstalledService" "1"
139 ; Create Start Menu Directory
140 SetShellVarContext all
141 CreateDirectory "$SMPROGRAMS\Bacula"
142 ; If not installed as service create Start Menu link
143 StrCmp $9 "1" Uninstall
144 CreateShortCut "$SMPROGRAMS\Bacula\Start Bacula Client.lnk" "$INSTDIR\bin\bacula-fd.exe" "-c $INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.exe" 0
147 ; Write the uninstall keys for Windows & create Start Menu entry
148 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula Client"
149 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
150 WriteUninstaller "$INSTDIR\Uninstall.exe"
151 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
153 ; Create bacula-fd.conf and have the user edit it (skipped if silent)
155 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
156 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."
157 Exec 'write "$INSTDIR\bin\bacula-fd.conf"' ; spawn wordpad with the file to be edited
160 ; Start the client? (default skipped if silent, use /start to force starting)
168 StrCmp $R0 "false" do_win98
169 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO SetPerms
170 Exec 'net start bacula'
173 ; set default permissions on config file so it's not world readable
174 Exec 'cmd /C echo Y|cacls "$INSTDIR\bin\bacula-fd.conf" /G SYSTEM:F Administrators:F'
179 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
181 Exec '"$INSTDIR\bin\bacula-fd.exe" -c "$INSTDIR\bin\bacula-fd.conf"'
186 Section "Install Console" SecConsole
187 SetOutPath "$INSTDIR\bin"
188 File console\Release\bconsole.exe
189 IfFileExists "$INSTDIR\bin\pthreadVCE.dll" msvcr711
190 File ..\..\..\depkgs-win32\pthreads\pthreadVCE.dll
192 IfFileExists "$INSTDIR\bin\msvcr71.dll" testconf1
193 File c:\windows\system32\msvcr71.dll
195 IfFileExists "$INSTDIR\bin\bconsole.conf" newconf
196 File console\bconsole.conf
199 File /oname=bconsole.conf.new console\bconsole.conf
202 ; Create bconsole.conf and have the user edit it (skipped if silent)
204 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
205 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."
206 Exec 'write "$INSTDIR\bin\bconsole.conf"' ; spawn wordpad with the file to be edited
210 Section "Install wx-Console" SecWxConsole
211 SetOutPath "$INSTDIR\bin"
212 File wx-console\Release\wx-console.exe
213 IfFileExists "$INSTDIR\bin\pthreadVCE.dll" msvcr712
214 File ..\..\..\depkgs-win32\pthreads\pthreadVCE.dll
216 IfFileExists "$INSTDIR\bin\msvcr71.dll" testconf2
217 File c:\windows\system32\msvcr71.dll
219 IfFileExists "$INSTDIR\bin\wx-console.conf" newconf
220 File wx-console\wx-console.conf
223 File /oname=wx-console.conf.new wx-console\wx-console.conf
225 ; Create Start Menu entry
226 SetShellVarContext all
227 CreateShortCut "$SMPROGRAMS\Bacula\WX-Console.lnk" "$INSTDIR\bin\wx-console.exe" "-c $INSTDIR\bin\wx-console.conf" "$INSTDIR\bin\wx-console.exe" 0
229 ; Create wx-console.conf and have the user edit it (skipped if silent)
231 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
232 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."
233 Exec 'write "$INSTDIR\bin\wx-console.conf"' ; spawn wordpad with the file to be edited
238 Section "Install Documentation" SecDoc
239 SetOutPath "$INSTDIR\doc"
240 CreateDirectory "$INSTDIR\doc"
241 File ..\..\..\docs\manual\bacula\*.html
242 File ..\..\..\docs\manual\bacula\*.png
243 File ..\..\..\docs\manual\bacula\*.css
244 File ..\..\..\docs\manual\bacula.pdf
245 ; Create Start Menu entry
246 SetShellVarContext all
247 CreateShortCut "$SMPROGRAMS\Bacula\Manual.lnk" "$INSTDIR\doc\bacula.pdf"
251 ; Extra Page descriptions
254 LangString DESC_SecService ${LANG_ENGLISH} "Install Bacula client on this system."
255 LangString DESC_SecConsole ${LANG_ENGLISH} "Install Console program on this system."
256 LangString DESC_SecWxConsole ${LANG_ENGLISH} "Install graphical console program on this system."
257 LangString DESC_SecDoc ${LANG_ENGLISH} "Install Documentation on this system."
259 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
260 !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
261 !insertmacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
262 !insertmacro MUI_DESCRIPTION_TEXT ${SecWxConsole} $(DESC_SecWxConsole)
263 !insertmacro MUI_DESCRIPTION_TEXT ${SecDoc} $(DESC_SecDoc)
264 !insertmacro MUI_FUNCTION_DESCRIPTION_END
270 UninstallText "This will uninstall the Bacula Client. Hit next to continue."
274 ; Shutdown any baculum that could be running
275 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
277 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
278 StrCmp $9 "" NoService
279 ; Remove bacula service
280 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /remove'
283 ; remove registry keys
284 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
285 DeleteRegKey HKLM "Software\Bacula"
287 ; remove start menu items
288 SetShellVarContext all
289 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
291 ; remove files and uninstaller (preserving config for now)
292 CopyFiles /SILENT "$INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bacula-fd.conf"
293 IfFileExists "$INSTDIR\bin\bconsole.conf" save_bconsole nosave_bconsole
295 CopyFiles /SILENT "$INSTDIR\bin\bconsole.conf" "$INSTDIR\bconsole.conf"
297 IfFileExists "$INSTDIR\bin\wx-console.conf" save_wxconsole nosave_wxconsole
299 CopyFiles /SILENT "$INSTDIR\bin\wx-console.conf" "$INSTDIR\wx-console.conf"
301 Delete /REBOOTOK "$INSTDIR\bin\*.*"
302 Delete /REBOOTOK "$INSTDIR\doc\*.*"
303 CopyFiles /SILENT "$INSTDIR\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.conf"
304 CopyFiles /SILENT "$INSTDIR\bconsole.conf" "$INSTDIR\bin\bconsole.conf"
305 CopyFiles /SILENT "$INSTDIR\wx-console.conf" "$INSTDIR\bin\wx-console.conf"
306 Delete /REBOOTOK "$INSTDIR\*.conf"
307 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
309 ; Check for existing installation
310 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to delete the current configuration files and the working state file?" IDNO LeaveConfig
311 Delete /REBOOTOK "$INSTDIR\bin\*.conf"
312 Delete /REBOOTOK "$INSTDIR\working\*"
313 ; remove directories used
316 RMDir "$INSTDIR\working"
320 RMDir "$SMPROGRAMS\Bacula"