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 ; 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 ; Command line options:
22 ; /cygwin - do cygwin install into c:\cygwin\bacula
26 !define PRODUCT "Bacula"
27 !define VERSION "@VERSION@"
30 ; Include the Modern UI
40 OutFile "winbacula-${VERSION}.exe"
42 InstallDir "c:\bacula"
47 !insertmacro MUI_PAGE_WELCOME
48 ; !insertmacro MUI_PAGE_LICENSE "License.txt"
49 !insertmacro MUI_PAGE_COMPONENTS
50 !insertmacro MUI_PAGE_DIRECTORY
51 !insertmacro MUI_PAGE_INSTFILES
52 !insertmacro MUI_PAGE_FINISH
54 !insertmacro MUI_UNPAGE_WELCOME
55 !insertmacro MUI_UNPAGE_CONFIRM
56 !insertmacro MUI_UNPAGE_INSTFILES
57 !insertmacro MUI_UNPAGE_FINISH
60 !define MUI_ABORTWARNING
62 !insertmacro MUI_LANGUAGE "English"
66 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."
69 Section "Bacula File Service" SecService
71 ; /cygwin on command line forces install dir to c:\cygwin\bacula (useful for silent install)
77 StrCpy $INSTDIR "c:\cygwin\bacula"
79 ; IfFileExists "c:\cygwin" Cygwin ReallyNoCygwin
81 ; StrCpy $INSTDIR "c:\cygwin\bacula"
84 ; Check for existing installation
86 IfFileExists "$INSTDIR\bin\bacula-fd.conf" Upgrade NoUpgrade
89 ; Shutdown any baculas that could be running
90 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
91 ; give it some time to shutdown
95 ; Set output path to the installation directory.
96 SetOutPath "$INSTDIR\bin"
97 CreateDirectory "$INSTDIR"
98 CreateDirectory "$INSTDIR\bin"
99 CreateDirectory "$INSTDIR\working"
100 CreateDirectory "c:\tmp"
102 File baculafd\Release\bacula-fd.exe
103 File ..\..\..\depkgs-win32\pthreads\pthreadVCE.dll
105 IfFileExists "$INSTDIR\bin\bacula-fd.conf" newconf
106 File baculafd\bacula-fd.conf
109 File /oname=bacula-fd.conf.new baculafd\bacula-fd.conf
111 ; If /service was given jump to the service install part
118 ; If silent install and not /service don't ask questions and goto NoService...
121 ; If already installed as service skip it too
122 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
123 StrCmp $9 "1" NoService
125 ; Install as service?
126 MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to install the Bacula Client as a service (automatically starts with your PC)?" IDNO NoService
128 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /install'
130 WriteRegDWORD HKLM "Software\Bacula" "InstalledService" "1"
133 ; Create Start Menu Directory
134 SetShellVarContext all
135 CreateDirectory "$SMPROGRAMS\Bacula"
136 ; If not installed as service create Start Menu link
137 StrCmp $9 "1" Uninstall
138 CreateShortCut "$SMPROGRAMS\Bacula\Start Bacula Client.lnk" "$INSTDIR\bin\bacula-fd.exe" "-c $INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.exe" 0
141 ; Write the uninstall keys for Windows & create Start Menu entry
142 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula Client"
143 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
144 WriteUninstaller "$INSTDIR\Uninstall.exe"
145 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
147 ; Create bacula-fd.conf and have the user edit it (skipped if silent)
149 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
150 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."
151 Exec 'write "$INSTDIR\bin\bacula-fd.conf"' ; spawn wordpad with the file to be edited
154 ; Start the client? (default skipped if silent, use /start to force starting)
162 StrCmp $R0 "false" do_win98
163 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO SetPerms
164 Exec 'net start bacula'
166 ; set default permissions on config file so it's not world readable
167 Exec 'cmd /C echo Y|cacls "$INSTDIR\bin\bacula-fd.conf" /G SYSTEM:F Administrators:F'
172 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
174 Exec '"$INSTDIR\bin\bacula-fd.exe" -c "$INSTDIR\bin\bacula-fd.conf"'
178 Section "Install Console" SecConsole
179 SetOutPath "$INSTDIR\bin"
180 File console\Release\bconsole.exe
181 IfFileExists "$INSTDIR\bin\bconsole.conf" newconf
182 File console\bconsole.conf
185 File /oname=bconsole.conf.new console\bconsole.conf
188 ; Create bconsole.conf and have the user edit it (skipped if silent)
190 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
191 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."
192 Exec 'write "$INSTDIR\bin\bconsole.conf"' ; spawn wordpad with the file to be edited
196 Section "Install wx-Console" SecWxConsole
197 SetOutPath "$INSTDIR\bin"
198 File wx-console\Release\wx-console.exe
199 IfFileExists "$INSTDIR\bin\wx-console.conf" newconf
200 File wx-console\wx-console.conf
203 File /oname=wx-console.conf.new wx-console\wx-console.conf
205 ; Create Start Menu entry
206 SetShellVarContext all
207 CreateShortCut "$SMPROGRAMS\Bacula\WX-Console.lnk" "$INSTDIR\bin\wx-console.exe" "-c $INSTDIR\bin\wx-console.conf" "$INSTDIR\bin\wx-console.exe" 0
209 ; Create wx-console.conf and have the user edit it (skipped if silent)
211 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
212 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."
213 Exec 'write "$INSTDIR\bin\wx-console.conf"' ; spawn wordpad with the file to be edited
218 Section "Install Documentation" SecDoc
219 SetOutPath "$INSTDIR\doc"
220 CreateDirectory "$INSTDIR\doc"
221 File ..\..\doc\html-manual\*.html
222 File ..\..\doc\html-manual\*.gif
223 File ..\..\doc\html-manual\*.jpg
227 ; Extra Page descriptions
230 LangString DESC_SecService ${LANG_ENGLISH} "Install Bacula client on this system."
231 LangString DESC_SecConsole ${LANG_ENGLISH} "Install Console program on this system."
232 LangString DESC_SecWxConsole ${LANG_ENGLISH} "Install graphical console program on this system."
233 LangString DESC_SecDoc ${LANG_ENGLISH} "Install Documentation on this system."
235 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
236 !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
237 !insertmacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
238 !insertmacro MUI_DESCRIPTION_TEXT ${SecWxConsole} $(DESC_SecWxConsole)
239 !insertmacro MUI_DESCRIPTION_TEXT ${SecDoc} $(DESC_SecDoc)
240 !insertmacro MUI_FUNCTION_DESCRIPTION_END
246 UninstallText "This will uninstall the Bacula Client. Hit next to continue."
250 ; Shutdown any baculum that could be running
251 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
253 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
254 StrCmp $9 "" NoService
255 ; Remove bacula service
256 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /remove'
259 ; remove registry keys
260 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
261 DeleteRegKey HKLM "Software\Bacula"
263 ; remove start menu items
264 SetShellVarContext all
265 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
267 ; remove files and uninstaller (preserving config for now)
268 CopyFiles /SILENT "$INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bacula-fd.conf"
269 IfFileExists "$INSTDIR\bin\bconsole.conf" save_bconsole nosave_bconsole
271 CopyFiles /SILENT "$INSTDIR\bin\bconsole.conf" "$INSTDIR\bconsole.conf"
273 IfFileExists "$INSTDIR\bin\wx-console.conf" save_wxconsole nosave_wxconsole
275 CopyFiles /SILENT "$INSTDIR\bin\wx-console.conf" "$INSTDIR\wx-console.conf"
277 Delete /REBOOTOK "$INSTDIR\bin\*.*"
278 Delete /REBOOTOK "$INSTDIR\doc\*.*"
279 CopyFiles /SILENT "$INSTDIR\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.conf"
280 CopyFiles /SILENT "$INSTDIR\bconsole.conf" "$INSTDIR\bin\bconsole.conf"
281 CopyFiles /SILENT "$INSTDIR\wx-console.conf" "$INSTDIR\bin\wx-console.conf"
282 Delete /REBOOTOK "$INSTDIR\*.conf"
283 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
285 ; Check for existing installation
286 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to delete the current configuration files and the working state file?" IDNO LeaveConfig
287 Delete /REBOOTOK "$INSTDIR\bin\*.conf"
288 Delete /REBOOTOK "$INSTDIR\working\*"
289 ; remove directories used
292 RMDir "$INSTDIR\working"
296 RMDir "$SMPROGRAMS\Bacula"