1 ;NSIS Modern User Interface version 1.63
2 ;Start Menu Folder Selection Example Script
3 ;Written by Joost Verburg
5 !define MUI_PRODUCT "Bacula" ;Define your own software name here
6 !define MUI_VERSION "1.33.4" ;Define your own software version here
11 ;--------------------------------
15 OutFile "bacula-install.exe"
17 ;Folder selection page
18 InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
20 ;Remember install folder
21 InstallDirRegKey HKCU "Software\${MUI_PRODUCT}" ""
23 ;$9 is being used to store the Start Menu Folder.
24 ;Do not use this variable in your script (or Push/Pop it)!
26 ;To change this variable, use MUI_STARTMENUPAGE_VARIABLE.
27 ;Have a look at the Readme for info about other options (default folder,
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"
37 ;--------------------------------
38 ;Modern UI Configuration
40 !define MUI_LICENSEPAGE
41 !define MUI_COMPONENTSPAGE
42 !define MUI_DIRECTORYPAGE
43 !define MUI_STARTMENUPAGE
45 !define MUI_ABORTWARNING
47 !define MUI_UNINSTALLER
48 !define MUI_UNCONFIRMPAGE
50 ;--------------------------------
53 !insertmacro MUI_LANGUAGE "English"
55 ;--------------------------------
59 LangString DESC_SecCopyUI ${LANG_ENGLISH} "Install Bacula client on this system."
61 ;--------------------------------
64 LicenseData "License.txt"
66 ;--------------------------------
69 Section "Bacula File Service" SecCopyUI
71 ;ADD YOUR OWN STUFF HERE!
74 File baculafd\Release\bacula-fd.exe
75 File pthreads\pthreadVCE.dll
76 IfFileExists "$INSTDIR\bacula-fd.conf" sconf
80 File /oname=bacula-fd.conf.N bacula-fd.conf
82 CreateDirectory "$INSTDIR\working"
85 WriteRegStr HKCU "Software\${MUI_PRODUCT}" "" $INSTDIR
87 !insertmacro MUI_STARTMENU_WRITE_BEGIN
90 CreateDirectory "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}"
91 CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
94 StrCmp $R0 "false" do98sc
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
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
104 !insertmacro MUI_STARTMENU_WRITE_END
107 WriteUninstaller "$INSTDIR\Uninstall.exe"
110 ExecWait '"$INSTDIR\bacula-fd.exe" /install -c "$INSTDIR\bacula-fd.conf"'
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
118 ;--------------------------------
121 !insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
122 !insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI)
123 !insertmacro MUI_FUNCTIONS_DESCRIPTION_END
125 ;--------------------------------
130 ;ADD YOUR OWN STUFF HERE!
131 ExecWait '"$INSTDIR\bacula-fd.exe" /kill'
133 ExecWait '"$INSTDIR\bacula-fd.exe" /remove'
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"
142 ReadRegStr ${TEMP} "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
144 StrCmp ${TEMP} "" noshortcuts
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
155 DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
157 ;Display the Finish header
158 !insertmacro MUI_UNFINISHHEADER