1 ; Script generated by the HM NIS Edit Script Wizard.
3 ; HM NIS Edit Wizard helper defines
4 ; Old versions of makensis don't like this, moved to Makefile
5 ;!define /file PRODUCT_VERSION "client/VERSION"
6 !define PRODUCT_TAG "Trunk"
7 !define PRODUCT_NAME "Evergreen Staff Client ${PRODUCT_TAG}"
8 !define PRODUCT_PUBLISHER "Evergreen Community"
9 !define PRODUCT_WEB_SITE "http://evergreen-ils.org/"
10 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\evergreen.exe"
11 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
12 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
13 !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
14 !ifndef PRODUCT_LICENSE
15 !define PRODUCT_LICENSE
18 ; MUI 1.67 compatible ------
22 !include "FileFunc.nsh"
25 !define MUI_ABORTWARNING
26 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
27 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
29 ; Language Selection Dialog Settings
30 !define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
31 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
32 !define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
35 !insertmacro MUI_PAGE_WELCOME
36 ; License page, if we have one
37 !if "${PRODUCT_LICENSE}" != ""
38 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE}"
41 !ifdef AUTOUPDATE | DEVELOPER | PERMACHINE
42 !insertmacro MUI_PAGE_COMPONENTS
45 !insertmacro MUI_PAGE_DIRECTORY
48 !define MUI_STARTMENUPAGE_NODISABLE
49 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "Evergreen Staff Client ${PRODUCT_TAG}"
50 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
51 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
52 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
53 !insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
55 !insertmacro MUI_PAGE_INSTFILES
57 !define MUI_FINISHPAGE_RUN "$INSTDIR\evergreen.exe"
58 !insertmacro MUI_PAGE_FINISH
61 !insertmacro MUI_UNPAGE_INSTFILES
64 !insertmacro MUI_LANGUAGE "Czech"
65 !insertmacro MUI_LANGUAGE "English"
66 !insertmacro MUI_LANGUAGE "French"
70 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
71 OutFile "evergreen_staff_client_setup.exe"
72 InstallDir "$PROGRAMFILES\Evergreen Staff Client ${PRODUCT_TAG}"
73 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
75 ShowUnInstDetails show
76 RequestExecutionLevel admin
78 Section "Staff Client" SECMAIN
79 SetShellVarContext All ; All Users (for shortcuts)
80 ; Uninstall old (inno) variant?
81 IfFileExists "$INSTDIR/unin000.exe" 0 +3
82 ExecWait '"$INSTDIR/unins000.exe" /VERYSILENT'
83 Sleep 5000 ; Wait five seconds in case the uninstaller returned before it was done
84 ; Uninstall old (nsis) version?
85 IfFileExists "$INSTDIR/uninst.exe" 0 +4
86 ExecWait '"$INSTDIR/uninst.exe" /S _?="$INSTDIR"'
87 Sleep 5000 ; Wait five seconds in case the uninstaller returned before it was done
88 Delete "$INSTDIR/uninst.exe"
90 File /r /x "autoupdate.js" /x "autochannel.js" /x "developers.js" /x "aa_per_machine.js" "client\*"
93 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
94 CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
96 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client.lnk" "$INSTDIR\evergreen.exe" "" "$INSTDIR\evergreen.ico"
98 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client Profile Manager.lnk" "$INSTDIR\evergreen.exe" "-profilemanager" "$INSTDIR\evergreen.ico"
101 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client.lnk" "$INSTDIR\evergreen.exe"
103 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client Profile Manager.lnk" "$INSTDIR\evergreen.exe" "-profilemanager"
106 CreateShortCut "$DESKTOP\Evergreen Staff Client ${PRODUCT_TAG}.lnk" "$INSTDIR\evergreen.exe"
108 ; External script for extra things.
109 !define EXTERNAL_EXTRAS_SECMAIN
110 !include /NONFATAL "extras.nsi"
111 !undef EXTERNAL_EXTRAS_SECMAIN
113 !insertmacro MUI_STARTMENU_WRITE_END
115 !ifdef AUTOUPDATE | PERMACHINE
116 ; For autoupdate and/or registering per machine, make sure we can write to the install directory.
117 !addplugindir AccessControl/Plugins
118 AccessControl::GrantOnFile "$INSTDIR" "Everyone" "FullAccess"
123 Section /o "Automatic Update" SECAUTO
124 SetOutPath "$INSTDIR\defaults\preferences"
125 File "client\defaults\preferences\autoupdate.js"
126 File "client\defaults\preferences\autochannel.js"
127 SetOutPath "$INSTDIR"
132 Section /o "Developer Options" SECDEV
133 SetOutPath "$INSTDIR\defaults\preferences"
134 File "client\defaults\preferences\developers.js"
135 SetOutPath "$INSTDIR"
140 Section /o "Registration Per Machine" SECPERMAC
141 SetOutPath "$INSTDIR\defaults\preferences"
142 File "client\defaults\preferences\aa_per_machine.js"
143 SetOutPath "$INSTDIR"
148 !insertmacro MUI_LANGDLL_DISPLAY
149 SectionSetFlags ${SECMAIN} 17
150 ; This is mainly for silent installs
151 !ifdef AUTOUPDATE | DEVELOPER | PERMACHINE
154 ${GetParameters} $CMD_ARGS
156 !ifdef AUTOUPDATE_NODEFAULT
157 ${GetOptions} $CMD_ARGS "/autoupdate" $0
160 ${GetOptions} $CMD_ARGS "/noautoupdate" $0
163 SectionSetFlags ${SECAUTO} 1
166 !ifdef PERMACHINE_NODEFAULT
167 ${GetOptions} $CMD_ARGS "/permachine" $0
170 ${GetOptions} $CMD_ARGS "/nopermachine" $0
173 SectionSetFlags ${SECPERMAC} 1
176 ${GetOptions} $CMD_ARGS "/developer" $0
178 SectionSetFlags ${SECDEV} 1
183 Section -AdditionalIcons
184 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
185 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
186 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
187 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
188 !insertmacro MUI_STARTMENU_WRITE_END
192 WriteUninstaller "$INSTDIR\uninst.exe"
193 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\evergreen.exe"
194 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
195 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
196 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\evergreen.exe"
197 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
198 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
199 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
202 ; Section descriptions
203 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
204 !insertmacro MUI_DESCRIPTION_TEXT ${SECMAIN} "The Evergreen Staff Client with XULRunner, Required"
206 !insertmacro MUI_DESCRIPTION_TEXT ${SECAUTO} "Automatic Update Functionality"
209 !insertmacro MUI_DESCRIPTION_TEXT ${SECDEV} "Developer Options"
212 !insertmacro MUI_DESCRIPTION_TEXT ${SECPERMAC} "Default registration and offline storage to per machine instead of per user"
214 !insertmacro MUI_FUNCTION_DESCRIPTION_END
217 Function un.onUninstSuccess
219 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." /SD IDOK
223 !insertmacro MUI_UNGETLANGUAGE
224 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" /SD IDYES IDYES +2
228 Function "un.RemoveFileCheck"
229 StrCmp $R7 "open_ils_staff_client" +5
238 SetShellVarContext All ; All Users (for shortcuts)
239 !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
240 Delete "$INSTDIR\${PRODUCT_NAME}.url"
241 Delete "$INSTDIR\uninst.exe"
242 Delete "$INSTDIR\evergreen.exe"
243 Delete "$INSTDIR\application.ini"
244 Delete "$INSTDIR\BUILD_ID"
245 Delete "$INSTDIR\STAMP_ID"
246 Delete "$INSTDIR\VERSION"
247 Delete "$INSTDIR\install.rdf"
248 Delete "$INSTDIR\active-update.xml"
249 Delete "$INSTDIR\chrome.manifest"
250 Delete "$INSTDIR\updates.xml"
251 Delete "$INSTDIR\log.txt"
252 Delete "$INSTDIR\evergreen.ico"
254 Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
255 Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
256 Delete "$DESKTOP\Evergreen Staff Client ${PRODUCT_TAG}.lnk"
257 Delete "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client.lnk"
259 ; External script for removing extra files before we wipe out the install directory
260 !define EXTERNAL_EXTRAS_UNINSTALL
261 !include /NONFATAL "extras.nsi"
262 !undef EXTERNAL_EXTRAS_UNINSTALL
264 RMDir "$SMPROGRAMS\$ICONS_GROUP"
265 RMDir /r "$INSTDIR\updates"
266 RMDir /r "$INSTDIR\xulrunner"
267 RMDir /r "$INSTDIR\extensions"
268 ; RMDir /r "$INSTDIR\chrome" ; We can't wipe out the chrome directory normally. Per-machine info would be lost on upgrade.
269 RMDir /r "$INSTDIR\components"
270 RMDir /r "$INSTDIR\defaults"
272 ; Basically, we want to remove everything but "open_ils_staff_client" from the chrome dir
273 ; So we pass over every file and folder in it. If it matches, we leave it alone.
274 ${Locate} "$INSTDIR\chrome" "/G=0" "un.RemoveFileCheck"
275 ; Then, we remove the folder non-recursively, which won't wipe out the folder if it is still there.
276 RMDir "$INSTDIR\chrome"
280 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
281 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"