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"
29 InstallDir "c:\bacula"
34 !insertmacro MUI_PAGE_WELCOME
35 ; !insertmacro MUI_PAGE_LICENSE "License.txt"
36 !insertmacro MUI_PAGE_COMPONENTS
37 !insertmacro MUI_PAGE_DIRECTORY
38 !insertmacro MUI_PAGE_INSTFILES
39 !insertmacro MUI_PAGE_FINISH
41 !insertmacro MUI_UNPAGE_WELCOME
42 !insertmacro MUI_UNPAGE_CONFIRM
43 !insertmacro MUI_UNPAGE_INSTFILES
44 !insertmacro MUI_UNPAGE_FINISH
47 !define MUI_ABORTWARNING
49 !insertmacro MUI_LANGUAGE "English"
53 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."
56 Section "Bacula File Service" SecService
58 ; /cygwin on command line forces install dir to c:\cygwin\bacula (useful for silent install)
64 StrCpy $INSTDIR "c:\cygwin\bacula"
66 ; IfFileExists "c:\cygwin" Cygwin ReallyNoCygwin
68 ; StrCpy $INSTDIR "c:\cygwin\bacula"
71 ; Check for existing installation
73 IfFileExists "$INSTDIR\bin\bacula-fd.conf" Upgrade NoUpgrade
76 ; Shutdown any baculas that could be running
77 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
78 ; give it some time to shutdown
82 ; Set output path to the installation directory.
83 SetOutPath "$INSTDIR\bin"
84 CreateDirectory "$INSTDIR"
85 CreateDirectory "$INSTDIR\bin"
86 CreateDirectory "$INSTDIR\working"
87 CreateDirectory "c:\tmp"
89 File baculafd\Release\bacula-fd.exe
90 File ..\..\..\depkgs-win32\pthreads\pthreadVCE.dll
92 IfFileExists "$INSTDIR\bin\bacula-fd.conf" newconf
96 File /oname=bacula-fd.conf.new bacula-fd.conf
98 ; If /service was given jump to the service install part
105 ; If silent install and not /service don't ask questions and goto NoService...
108 ; If already installed as service skip it too
109 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
110 StrCmp $9 "1" NoService
112 ; Install as service?
113 MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to install the Bacula Client as a service (automatically starts with your PC)?" IDNO NoService
115 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /install'
117 WriteRegDWORD HKLM "Software\Bacula" "InstalledService" "1"
120 ; Write the uninstall keys for Windows
121 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula Client"
122 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
123 WriteUninstaller "$INSTDIR\Uninstall.exe"
125 ; Create bacula-fd.conf and have the user edit it (skipped if silent)
127 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
128 MessageBox MB_OK "Please edit $INSTDIR\bin\bacula-fd.conf according to your requirements/installation! Also remember to put a shortcut into your start menu if you didn't install the client as a service."
129 Exec 'write "$INSTDIR\bin\bacula-fd.conf"' ; spawn wordpad with the file to be edited
132 ; Start the client? (default skipped if silent, use /start to force starting)
140 StrCmp $R0 "false" do_win98
141 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
142 Exec 'net start bacula'
147 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
149 Exec '"$INSTDIR\bin\bacula-fd.exe" -c "$INSTDIR\bin\bacula-fd.conf"'
153 Section "Install Console" SecConsole
154 SetOutPath "$INSTDIR\bin"
155 File console\Release\bconsole.exe
156 IfFileExists "$INSTDIR\bin\bconsole.conf" newconf
157 File console\bconsole.conf
160 File /oname=bconsole.conf.new console\bconsole.conf
162 ; If /service was given jump to the service install part
167 Section "Install Documentation" SecDoc
168 SetOutPath "$INSTDIR\doc"
169 CreateDirectory "$INSTDIR\doc"
170 File ..\..\doc\html-manual\*.html
171 File ..\..\doc\html-manual\*.gif
172 File ..\..\doc\html-manual\*.jpg
176 ; Extra Page descriptions
179 LangString DESC_SecService ${LANG_ENGLISH} "Install Bacula client on this system."
180 LangString DESC_SecConsole ${LANG_ENGLISH} "Install Console program on this system."
181 LangString DESC_SecDoc ${LANG_ENGLISH} "Install Documenation on this system."
183 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
184 !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
185 !insertmacro MUI_DESCRIPTION_TEXT ${SecConsole} $(DESC_SecConsole)
186 !insertmacro MUI_DESCRIPTION_TEXT ${SecDoc} $(DESC_SecDoc)
187 !insertmacro MUI_FUNCTION_DESCRIPTION_END
193 UninstallText "This will uninstall the Bacula Client. Hit next to continue."
197 ; Shutdown any baculum that could be running
198 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
200 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
201 StrCmp $9 "" NoService
202 ; Remove bacula service
203 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /remove'
206 ; remove registry keys
207 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
208 DeleteRegKey HKLM "Software\Bacula"
210 ; remove files and uninstaller (preserving config for now)
211 CopyFiles /SILENT "$INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bacula-fd.conf"
212 Delete /REBOOTOK "$INSTDIR\bin\*.*"
213 Delete /REBOOTOK "$INSTDIR\doc\*.*"
214 CopyFiles /SILENT "$INSTDIR\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.conf"
215 CopyFiles /SILENT "$INSTDIR\bconsole.conf" "$INSTDIR\bin\bconsole.conf"
216 Delete /REBOOTOK "$INSTDIR\bacula-fd.conf"
217 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
219 ; Check for existing installation
220 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to delete the current configuration file ($INSTDIR\bin\bacula-fd.conf)?" IDNO LeaveConfig
221 Delete /REBOOTOK "$INSTDIR\bin\bacula-fd.conf"
222 ; remove directories used
225 RMDir "$INSTDIR\working"