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
13 ; Command line options:
15 ; /cygwin - do cygwin install into c:\cygwin\bacula
19 !define PRODUCT "Bacula"
20 !define VERSION "@VERSION@"
23 ; Include the Modern UI
33 OutFile "winbacula-${VERSION}.exe"
35 InstallDir "c:\bacula"
40 !insertmacro MUI_PAGE_WELCOME
41 ; !insertmacro MUI_PAGE_LICENSE "License.txt"
42 !insertmacro MUI_PAGE_COMPONENTS
43 !insertmacro MUI_PAGE_DIRECTORY
44 !insertmacro MUI_PAGE_INSTFILES
45 !insertmacro MUI_PAGE_FINISH
47 !insertmacro MUI_UNPAGE_WELCOME
48 !insertmacro MUI_UNPAGE_CONFIRM
49 !insertmacro MUI_UNPAGE_INSTFILES
50 !insertmacro MUI_UNPAGE_FINISH
53 !define MUI_ABORTWARNING
55 !insertmacro MUI_LANGUAGE "English"
59 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."
62 Section "Bacula File Service" SecService
64 ; /cygwin on command line forces install dir to c:\cygwin\bacula (useful for silent install)
70 StrCpy $INSTDIR "c:\cygwin\bacula"
72 ; IfFileExists "c:\cygwin" Cygwin ReallyNoCygwin
74 ; StrCpy $INSTDIR "c:\cygwin\bacula"
77 ; Check for existing installation
79 IfFileExists "$INSTDIR\bin\bacula-fd.conf" Upgrade NoUpgrade
82 ; Shutdown any baculas that could be running
83 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
84 ; give it some time to shutdown
88 ; Set output path to the installation directory.
89 SetOutPath "$INSTDIR\bin"
90 CreateDirectory "$INSTDIR"
91 CreateDirectory "$INSTDIR\bin"
92 CreateDirectory "$INSTDIR\working"
93 CreateDirectory "c:\tmp"
95 File baculafd\Release\bacula-fd.exe
96 File ..\..\..\depkgs-win32\pthreads\pthreadVCE.dll
98 IfFileExists "$INSTDIR\bin\bacula-fd.conf" newconf
99 File baculafd\bacula-fd.conf
102 File /oname=bacula-fd.conf.new baculafd\bacula-fd.conf
104 ; If /service was given jump to the service install part
111 ; If silent install and not /service don't ask questions and goto NoService...
114 ; If already installed as service skip it too
115 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
116 StrCmp $9 "1" NoService
118 ; Install as service?
119 MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to install the Bacula Client as a service (automatically starts with your PC)?" IDNO NoService
121 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /install'
123 WriteRegDWORD HKLM "Software\Bacula" "InstalledService" "1"
126 ; Create Start Menu Directory
127 SetShellVarContext all
128 CreateDirectory "$SMPROGRAMS\Bacula"
129 CreateShortCut "$SMPROGRAMS\Bacula\Start Bacula Client.lnk" "$INSTDIR\bin\bacula-fd.exe" "-c $INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.exe" 0
131 ; Write the uninstall keys for Windows & create Start Menu entry
132 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula Client"
133 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
134 WriteUninstaller "$INSTDIR\Uninstall.exe"
135 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
137 ; Create bacula-fd.conf and have the user edit it (skipped if silent)
139 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
140 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."
141 Exec 'write "$INSTDIR\bin\bacula-fd.conf"' ; spawn wordpad with the file to be edited
144 ; Start the client? (default skipped if silent, use /start to force starting)
152 StrCmp $R0 "false" do_win98
153 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
154 Exec 'net start bacula'
159 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
161 Exec '"$INSTDIR\bin\bacula-fd.exe" -c "$INSTDIR\bin\bacula-fd.conf"'
165 Section "Install Console" SecConsole
166 SetOutPath "$INSTDIR\bin"
167 File console\Release\bconsole.exe
168 IfFileExists "$INSTDIR\bin\bconsole.conf" newconf
169 File console\bconsole.conf
172 File /oname=bconsole.conf.new console\bconsole.conf
175 ; Create bconsole.conf and have the user edit it (skipped if silent)
177 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
178 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."
179 Exec 'write "$INSTDIR\bin\bconsole.conf"' ; spawn wordpad with the file to be edited
183 Section "Install wx-Console" SecWxConsole
184 SetOutPath "$INSTDIR\bin"
185 File wx-console\Release\wx-console.exe
186 IfFileExists "$INSTDIR\bin\wx-console.conf" newconf
187 File wx-console\wx-console.conf
190 File /oname=wx-console.conf.new wx-console\wx-console.conf
192 ; Create Start Menu entry
193 SetShellVarContext all
194 CreateShortCut "$SMPROGRAMS\Bacula\WX-Console.lnk" "$INSTDIR\bin\wx-console.exe" "-c $INSTDIR\bin\wx-console.conf" "$INSTDIR\bin\wx-console.exe" 0
196 ; Create wx-console.conf and have the user edit it (skipped if silent)
198 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
199 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."
200 Exec 'write "$INSTDIR\bin\wx-console.conf"' ; spawn wordpad with the file to be edited
205 Section "Install Documentation" SecDoc
206 SetOutPath "$INSTDIR\doc"
207 CreateDirectory "$INSTDIR\doc"
208 File ..\..\doc\html-manual\*.html
209 File ..\..\doc\html-manual\*.gif
210 File ..\..\doc\html-manual\*.jpg
214 ; Extra Page descriptions
217 LangString DESC_SecService ${LANG_ENGLISH} "Install Bacula client on this system."
218 LangString DESC_SecConsole ${LANG_ENGLISH} "Install Console program on this system."
219 LangString DESC_SecWxConsole ${LANG_ENGLISH} "Install graphical console program on this system."
220 LangString DESC_SecDoc ${LANG_ENGLISH} "Install Documentation on this system."
222 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
223 !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
224 !insertmacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
225 !insertmacro MUI_DESCRIPTION_TEXT ${SecWxConsole} $(DESC_SecWxConsole)
226 !insertmacro MUI_DESCRIPTION_TEXT ${SecDoc} $(DESC_SecDoc)
227 !insertmacro MUI_FUNCTION_DESCRIPTION_END
233 UninstallText "This will uninstall the Bacula Client. Hit next to continue."
237 ; Shutdown any baculum that could be running
238 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
240 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
241 StrCmp $9 "" NoService
242 ; Remove bacula service
243 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /remove'
246 ; remove registry keys
247 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
248 DeleteRegKey HKLM "Software\Bacula"
250 ; remove start menu items
251 SetShellVarContext all
252 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
254 ; remove files and uninstaller (preserving config for now)
255 CopyFiles /SILENT "$INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bacula-fd.conf"
256 Delete /REBOOTOK "$INSTDIR\bin\*.*"
257 Delete /REBOOTOK "$INSTDIR\doc\*.*"
258 CopyFiles /SILENT "$INSTDIR\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.conf"
259 CopyFiles /SILENT "$INSTDIR\bconsole.conf" "$INSTDIR\bin\bconsole.conf"
260 Delete /REBOOTOK "$INSTDIR\bacula-fd.conf"
261 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
263 ; Check for existing installation
264 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to delete the current configuration file ($INSTDIR\bin\bacula-fd.conf)?" IDNO LeaveConfig
265 Delete /REBOOTOK "$INSTDIR\bin\bacula-fd.conf"
266 ; remove directories used
269 RMDir "$INSTDIR\working"
272 RMDir "$SMPROGRAMS\Bacula"