3 ; Written by Michel Meyers (michel@tcnnet.dyndns.org)
5 ; Updated by Kern Sibbald for native Win32 Bacula
7 ; Command line options:
9 ; /cygwin - do cygwin install into c:\cygwin\bacula
13 !define PRODUCT "Bacula"
14 !define VERSION "@VERSION@"
17 ; Include the Modern UI
27 OutFile "winbacula-${VERSION}.exe"
28 InstallDir "c:\bacula"
33 !insertmacro MUI_PAGE_WELCOME
34 ; !insertmacro MUI_PAGE_LICENSE "License.txt"
35 !insertmacro MUI_PAGE_COMPONENTS
36 !insertmacro MUI_PAGE_DIRECTORY
37 !insertmacro MUI_PAGE_INSTFILES
38 !insertmacro MUI_PAGE_FINISH
40 !insertmacro MUI_UNPAGE_WELCOME
41 !insertmacro MUI_UNPAGE_CONFIRM
42 !insertmacro MUI_UNPAGE_INSTFILES
43 !insertmacro MUI_UNPAGE_FINISH
46 !define MUI_ABORTWARNING
48 !insertmacro MUI_LANGUAGE "English"
52 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."
55 Section "Bacula File Service" SecService
57 ; /cygwin on command line forces install dir to c:\cygwin\bacula (useful for silent install)
63 StrCpy $INSTDIR "c:\cygwin\bacula"
65 ; IfFileExists "c:\cygwin" Cygwin ReallyNoCygwin
67 ; StrCpy $INSTDIR "c:\cygwin\bacula"
70 ; Check for existing installation
72 IfFileExists "$INSTDIR\bin\bacula-fd.conf" Upgrade NoUpgrade
75 ; Shutdown any baculas that could be running
76 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
77 ; give it some time to shutdown
81 ; Set output path to the installation directory.
82 SetOutPath "$INSTDIR\bin"
83 CreateDirectory "$INSTDIR"
84 CreateDirectory "$INSTDIR\bin"
85 CreateDirectory "$INSTDIR\working"
86 CreateDirectory "c:\tmp"
88 File baculafd\Release\bacula-fd.exe
89 File pthreads\pthreadVCE.dll
91 IfFileExists "$INSTDIR\bin\bacula-fd.conf" newconf
95 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'
145 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
147 Exec '"$INSTDIR\bin\bacula-fd.exe" -c "$INSTDIR\bin\bacula-fd.conf"'
153 Section "Install Documentation" SecDoc
157 ; Extra Page descriptions
160 LangString DESC_SecService ${LANG_ENGLISH} "Install Bacula client on this system."
161 LangString DESC_SecDoc ${LANG_ENGLISH} "Install Documenation (not implemented)."
163 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
164 !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
165 !insertmacro MUI_DESCRIPTION_TEXT ${SecDoc} $(DESC_SecDoc)
166 !insertmacro MUI_FUNCTION_DESCRIPTION_END
172 UninstallText "This will uninstall the Bacula Client. Hit next to continue."
176 ; Shutdown any baculum that could be running
177 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
179 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
180 StrCmp $9 "" NoService
181 ; Remove bacula service
182 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /remove'
185 ; remove registry keys
186 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
187 DeleteRegKey HKLM "Software\Bacula"
189 ; remove files and uninstaller (preserving config for now)
190 CopyFiles /SILENT "$INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bacula-fd.conf"
191 Delete /REBOOTOK "$INSTDIR\bin\*.*"
192 CopyFiles /SILENT "$INSTDIR\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.conf"
193 Delete /REBOOTOK "$INSTDIR\bacula-fd.conf"
194 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
196 ; Check for existing installation
197 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to delete the current configuration file ($INSTDIR\bin\bacula-fd.conf)?" IDNO LeaveConfig
198 Delete /REBOOTOK "$INSTDIR\bin\bacula-fd.conf"
199 ; remove directories used
201 RMDir "$INSTDIR\working"
206 ; If we need to reboot we'll ask
207 IfRebootFlag Reboot Continue
209 MessageBox MB_YESNO|MB_ICONQUESTION "Some files will only be deleted after restarting. Reboot now?" IDNO Continue