]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/bacula.nsi
5de4a6ddc07f102ff819b9865b27dbf274e407ea
[bacula/bacula] / bacula / src / win32 / bacula.nsi
1 ;NSIS Modern User Interface version 1.63
2 ;Start Menu Folder Selection Example Script
3 ;Written by Joost Verburg
4
5 !define MUI_PRODUCT "Bacula" ;Define your own software name here
6 !define MUI_VERSION "1.32f-3" ;Define your own software version here
7
8 !include "MUI.nsh"
9 !include "util.nsh"
10
11 ;--------------------------------
12 ;Configuration
13
14   ;General
15   OutFile "bacula-install.exe"
16
17   ;Folder selection page
18   InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
19   
20   ;Remember install folder
21   InstallDirRegKey HKCU "Software\${MUI_PRODUCT}" ""
22   
23   ;$9 is being used to store the Start Menu Folder.
24   ;Do not use this variable in your script (or Push/Pop it)!
25
26   ;To change this variable, use MUI_STARTMENUPAGE_VARIABLE.
27   ;Have a look at the Readme for info about other options (default folder,
28   ;registry).
29
30   ;Remember the Start Menu Folder
31   !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" 
32   !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${MUI_PRODUCT}" 
33   !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
34
35   !define TEMP $R0
36   
37 ;--------------------------------
38 ;Modern UI Configuration
39
40   !define MUI_LICENSEPAGE
41   !define MUI_COMPONENTSPAGE
42   !define MUI_DIRECTORYPAGE
43   !define MUI_STARTMENUPAGE
44   
45   !define MUI_ABORTWARNING
46   
47   !define MUI_UNINSTALLER
48   !define MUI_UNCONFIRMPAGE
49   
50 ;--------------------------------
51 ;Languages
52  
53   !insertmacro MUI_LANGUAGE "English"
54   
55 ;--------------------------------
56 ;Language Strings
57
58   ;Description
59   LangString DESC_SecCopyUI ${LANG_ENGLISH} "Install Bacula client on this system."
60
61 ;--------------------------------
62 ;Data
63   
64   LicenseData "License.txt"
65
66 ;--------------------------------
67 ;Installer Sections
68
69 Section "Bacula File Service" SecCopyUI
70
71   ;ADD YOUR OWN STUFF HERE!
72
73   SetOutPath "$INSTDIR"
74   File baculafd\Release\bacula-fd.exe
75   File pthreads\pthreadVCE.dll
76   IfFileExists "$INSTDIR\bacula-fd.conf" sconf 
77   File bacula-fd.conf
78   goto doDir
79   sconf:
80   File /oname=bacula-fd.conf.N bacula-fd.conf
81   doDir:
82   CreateDirectory "$INSTDIR\working"
83   
84   ;Store install folder
85   WriteRegStr HKCU "Software\${MUI_PRODUCT}" "" $INSTDIR
86   
87   !insertmacro MUI_STARTMENU_WRITE_BEGIN
88     
89     ;Create shortcuts
90     CreateDirectory "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}"
91     CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
92     Call IsNT
93     Pop $R0
94     StrCmp $R0 "false" do98sc
95
96     CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Start Service.lnk" "$SYSDIR\net.exe" "start bacula" "$INSTDIR\bacula-fd.exe" 2
97     CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Stop Service.lnk" "$SYSDIR\net.exe" "stop bacula" "$INSTDIR\bacula-fd.exe" 3
98    goto scend
99     do98sc:
100
101     CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Start Service.lnk" "$INSTDIR\bacula-fd.exe" "-c bacula-fd.conf" "$INSTDIR\bacula-fd.exe" 2
102     CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Stop Service.lnk" "$INSTDIR\bacula-fd.exe" "/kill" "$INSTDIR\bacula-fd.exe" 3
103    scend:
104   !insertmacro MUI_STARTMENU_WRITE_END
105
106   ;Create uninstaller
107   WriteUninstaller "$INSTDIR\Uninstall.exe"
108
109   ; Install service
110   ExecWait '"$INSTDIR\bacula-fd.exe" /install -c "$INSTDIR\bacula-fd.conf"'
111
112 SectionEnd
113
114 ;Display the Finish header
115 ;Insert this macro after the sections if you are not using a finish page
116 !insertmacro MUI_SECTIONS_FINISHHEADER
117
118 ;--------------------------------
119 ;Descriptions
120
121 !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
122 !insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI)
123 !insertmacro MUI_FUNCTIONS_DESCRIPTION_END
124  
125 ;--------------------------------
126 ;Uninstaller Section
127
128 Section "Uninstall"
129
130   ;ADD YOUR OWN STUFF HERE!
131   ExecWait   '"$INSTDIR\bacula-fd.exe" /kill'
132   Sleep 1000
133   ExecWait   '"$INSTDIR\bacula-fd.exe" /remove'
134   Sleep 1000
135
136   Delete "$INSTDIR\bacula-fd.exe"
137   Delete "$INSTDIR\bacula-fd.conf.N"
138   Delete "$INSTDIR\pthreadVCE.dll"
139   Delete "$INSTDIR\Uninstall.exe"
140   RMDir  "$INSTDIR\working"  
141   ;Remove shortcut
142   ReadRegStr ${TEMP} "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
143   
144   StrCmp ${TEMP} "" noshortcuts
145   
146     Delete "$SMPROGRAMS\${TEMP}\Uninstall.lnk"
147     Delete "$SMPROGRAMS\${TEMP}\Start Service.lnk"
148     Delete "$SMPROGRAMS\${TEMP}\Stop Service.lnk"
149     RMDir "$SMPROGRAMS\${TEMP}" ;Only if empty, so it won't delete other shortcuts
150     
151   noshortcuts:
152
153   RMDir "$INSTDIR"
154
155   DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
156
157   ;Display the Finish header
158   !insertmacro MUI_UNFINISHHEADER
159
160 SectionEnd