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 ; Command line options:
10 ; /cygwin - do cygwin install into c:\cygwin\bacula
14 !define PRODUCT "Bacula"
15 !define VERSION "@VERSION@"
18 ; Include the Modern UI
28 OutFile "winbacula-${VERSION}.exe"
30 InstallDir "c:\bacula"
35 !insertmacro MUI_PAGE_WELCOME
36 ; !insertmacro MUI_PAGE_LICENSE "License.txt"
37 !insertmacro MUI_PAGE_COMPONENTS
38 !insertmacro MUI_PAGE_DIRECTORY
39 !insertmacro MUI_PAGE_INSTFILES
40 !insertmacro MUI_PAGE_FINISH
42 !insertmacro MUI_UNPAGE_WELCOME
43 !insertmacro MUI_UNPAGE_CONFIRM
44 !insertmacro MUI_UNPAGE_INSTFILES
45 !insertmacro MUI_UNPAGE_FINISH
48 !define MUI_ABORTWARNING
50 !insertmacro MUI_LANGUAGE "English"
54 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."
57 Section "Bacula File Service" SecService
59 ; /cygwin on command line forces install dir to c:\cygwin\bacula (useful for silent install)
65 StrCpy $INSTDIR "c:\cygwin\bacula"
67 ; IfFileExists "c:\cygwin" Cygwin ReallyNoCygwin
69 ; StrCpy $INSTDIR "c:\cygwin\bacula"
72 ; Check for existing installation
74 IfFileExists "$INSTDIR\bin\bacula-fd.conf" Upgrade NoUpgrade
77 ; Shutdown any baculas that could be running
78 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
79 ; give it some time to shutdown
83 ; Set output path to the installation directory.
84 SetOutPath "$INSTDIR\bin"
85 CreateDirectory "$INSTDIR"
86 CreateDirectory "$INSTDIR\bin"
87 CreateDirectory "$INSTDIR\working"
88 CreateDirectory "c:\tmp"
90 File baculafd\Release\bacula-fd.exe
91 File ..\..\..\depkgs-win32\pthreads\pthreadVCE.dll
93 IfFileExists "$INSTDIR\bin\bacula-fd.conf" newconf
94 File baculafd\bacula-fd.conf
97 File /oname=bacula-fd.conf.new baculafd\bacula-fd.conf
99 ; If /service was given jump to the service install part
106 ; If silent install and not /service don't ask questions and goto NoService...
109 ; If already installed as service skip it too
110 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
111 StrCmp $9 "1" NoService
113 ; Install as service?
114 MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to install the Bacula Client as a service (automatically starts with your PC)?" IDNO NoService
116 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /install'
118 WriteRegDWORD HKLM "Software\Bacula" "InstalledService" "1"
121 ; Create Start Menu Directory
122 SetShellVarContext all
123 CreateDirectory "$SMPROGRAMS\Bacula"
124 CreateShortCut "$SMPROGRAMS\Bacula\Start Bacula Client.lnk" "$INSTDIR\bin\bacula-fd.exe" "-c $INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.exe" 0
126 ; Write the uninstall keys for Windows & create Start Menu entry
127 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula Client"
128 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
129 WriteUninstaller "$INSTDIR\Uninstall.exe"
130 CreateShortCut "$SMPROGRAMS\Bacula\Uninstall Bacula.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
132 ; Create bacula-fd.conf and have the user edit it (skipped if silent)
134 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
135 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."
136 Exec 'write "$INSTDIR\bin\bacula-fd.conf"' ; spawn wordpad with the file to be edited
139 ; Start the client? (default skipped if silent, use /start to force starting)
147 StrCmp $R0 "false" do_win98
148 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
149 Exec 'net start bacula'
154 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
156 Exec '"$INSTDIR\bin\bacula-fd.exe" -c "$INSTDIR\bin\bacula-fd.conf"'
160 Section "Install Console" SecConsole
161 SetOutPath "$INSTDIR\bin"
162 File console\Release\bconsole.exe
163 IfFileExists "$INSTDIR\bin\bconsole.conf" newconf
164 File console\bconsole.conf
167 File /oname=bconsole.conf.new console\bconsole.conf
170 ; Create bconsole.conf and have the user edit it (skipped if silent)
172 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
173 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."
174 Exec 'write "$INSTDIR\bin\bconsole.conf"' ; spawn wordpad with the file to be edited
178 Section "Install wx-Console" SecWxConsole
179 SetOutPath "$INSTDIR\bin"
180 File wx-console\Release\wx-console.exe
181 IfFileExists "$INSTDIR\bin\wx-console.conf" newconf
182 File wx-console\wx-console.conf
185 File /oname=wx-console.conf.new wx-console\wx-console.conf
187 ; Create Start Menu entry
188 SetShellVarContext all
189 CreateShortCut "$SMPROGRAMS\Bacula\WX-Console.lnk" "$INSTDIR\bin\wx-console.exe" "-c $INSTDIR\bin\wx-console.conf" "$INSTDIR\bin\wx-console.exe" 0
191 ; Create wx-console.conf and have the user edit it (skipped if silent)
193 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
194 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."
195 Exec 'write "$INSTDIR\bin\wx-console.conf"' ; spawn wordpad with the file to be edited
200 Section "Install Documentation" SecDoc
201 SetOutPath "$INSTDIR\doc"
202 CreateDirectory "$INSTDIR\doc"
203 File ..\..\doc\html-manual\*.html
204 File ..\..\doc\html-manual\*.gif
205 File ..\..\doc\html-manual\*.jpg
209 ; Extra Page descriptions
212 LangString DESC_SecService ${LANG_ENGLISH} "Install Bacula client on this system."
213 LangString DESC_SecConsole ${LANG_ENGLISH} "Install Console program on this system."
214 LangString DESC_SecWxConsole ${LANG_ENGLISH} "Install graphical console program on this system."
215 LangString DESC_SecDoc ${LANG_ENGLISH} "Install Documentation on this system."
217 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
218 !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
219 !insertmacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
220 !insertmacro MUI_DESCRIPTION_TEXT ${SecWxConsole} $(DESC_SecWxConsole)
221 !insertmacro MUI_DESCRIPTION_TEXT ${SecDoc} $(DESC_SecDoc)
222 !insertmacro MUI_FUNCTION_DESCRIPTION_END
228 UninstallText "This will uninstall the Bacula Client. Hit next to continue."
232 ; Shutdown any baculum that could be running
233 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
235 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
236 StrCmp $9 "" NoService
237 ; Remove bacula service
238 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /remove'
241 ; remove registry keys
242 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
243 DeleteRegKey HKLM "Software\Bacula"
245 ; remove start menu items
246 SetShellVarContext all
247 Delete /REBOOTOK "$SMPROGRAMS\Bacula\*"
249 ; remove files and uninstaller (preserving config for now)
250 CopyFiles /SILENT "$INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bacula-fd.conf"
251 Delete /REBOOTOK "$INSTDIR\bin\*.*"
252 Delete /REBOOTOK "$INSTDIR\doc\*.*"
253 CopyFiles /SILENT "$INSTDIR\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.conf"
254 CopyFiles /SILENT "$INSTDIR\bconsole.conf" "$INSTDIR\bin\bconsole.conf"
255 Delete /REBOOTOK "$INSTDIR\bacula-fd.conf"
256 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
258 ; Check for existing installation
259 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to delete the current configuration file ($INSTDIR\bin\bacula-fd.conf)?" IDNO LeaveConfig
260 Delete /REBOOTOK "$INSTDIR\bin\bacula-fd.conf"
261 ; remove directories used
264 RMDir "$INSTDIR\working"
267 RMDir "$SMPROGRAMS\Bacula"