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
97 ; If /service was given jump to the service install part
104 ; If silent install and not /service don't ask questions and goto NoService...
107 ; If already installed as service skip it too
108 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
109 StrCmp $9 "1" NoService
111 ; Install as service?
112 MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to install the Bacula Client as a service (automatically starts with your PC)?" IDNO NoService
114 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /install'
116 WriteRegDWORD HKLM "Software\Bacula" "InstalledService" "1"
119 ; Write the uninstall keys for Windows
120 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "DisplayName" "Bacula Client"
121 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula" "UninstallString" '"$INSTDIR\uninstall.exe"'
122 WriteUninstaller "$INSTDIR\Uninstall.exe"
124 ; Create bacula-fd.conf and have the user edit it (skipped if silent)
126 StrCmp $7 "1" NoReminder ; skip if it is an upgrade
127 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."
128 Exec 'write "$INSTDIR\bin\bacula-fd.conf"' ; spawn wordpad with the file to be edited
131 ; Start the client? (default skipped if silent, use /start to force starting)
139 StrCmp $R0 "false" do_win98
140 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
141 Exec 'net start bacula'
146 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to start the Bacula Client now?" IDNO NoStart
148 Exec '"$INSTDIR\bin\bacula-fd.exe" -c "$INSTDIR\bin\bacula-fd.conf"'
154 Section "Install Documentation" SecDoc
155 SetOutPath "$INSTDIR\doc"
156 CreateDirectory "$INSTDIR\doc"
157 File ..\..\doc\html-manual\*.html
158 File ..\..\doc\html-manual\*.gif
159 File ..\..\doc\html-manual\*.jpg
163 ; Extra Page descriptions
166 LangString DESC_SecService ${LANG_ENGLISH} "Install Bacula client on this system."
167 LangString DESC_SecDoc ${LANG_ENGLISH} "Install Documenation on this system."
169 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
170 !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
171 !insertmacro MUI_DESCRIPTION_TEXT ${SecDoc} $(DESC_SecDoc)
172 !insertmacro MUI_FUNCTION_DESCRIPTION_END
178 UninstallText "This will uninstall the Bacula Client. Hit next to continue."
182 ; Shutdown any baculum that could be running
183 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /kill'
185 ReadRegDWORD $9 HKLM "Software\Bacula" "InstalledService"
186 StrCmp $9 "" NoService
187 ; Remove bacula service
188 ExecWait '"$INSTDIR\bin\bacula-fd.exe" /remove'
191 ; remove registry keys
192 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Bacula"
193 DeleteRegKey HKLM "Software\Bacula"
195 ; remove files and uninstaller (preserving config for now)
196 CopyFiles /SILENT "$INSTDIR\bin\bacula-fd.conf" "$INSTDIR\bacula-fd.conf"
197 Delete /REBOOTOK "$INSTDIR\bin\*.*"
198 Delete /REBOOTOK "$INSTDIR\doc\*.*"
199 CopyFiles /SILENT "$INSTDIR\bacula-fd.conf" "$INSTDIR\bin\bacula-fd.conf"
200 Delete /REBOOTOK "$INSTDIR\bacula-fd.conf"
201 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
203 ; Check for existing installation
204 MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to delete the current configuration file ($INSTDIR\bin\bacula-fd.conf)?" IDNO LeaveConfig
205 Delete /REBOOTOK "$INSTDIR\bin\bacula-fd.conf"
206 ; remove directories used
209 RMDir "$INSTDIR\working"