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 "..\..\..\LICENSE.txt"
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 ; Uninstall old (inno) variant?
80 IfFileExists "$INSTDIR/unin000.exe" 0 +3
81 ExecWait '"$INSTDIR/unins000.exe" /VERYSILENT'
82 Sleep 5000 ; Wait five seconds in case the uninstaller returned before it was done
83 ; Uninstall old (nsis) version?
84 IfFileExists "$INSTDIR/uninst.exe" 0 +4
85 ExecWait '"$INSTDIR/uninst.exe" /S _?="$INSTDIR"'
86 Sleep 5000 ; Wait five seconds in case the uninstaller returned before it was done
87 Delete "$INSTDIR/uninst.exe"
89 File /r /x "autoupdate.js" /x "autochannel.js" /x "developers.js" /x "aa_per_machine.js" "client\*"
92 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
93 CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
95 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client.lnk" "$INSTDIR\evergreen.exe" "" "$INSTDIR\evergreen.ico"
97 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client Profile Manager.lnk" "$INSTDIR\evergreen.exe" "-profilemanager" "$INSTDIR\evergreen.ico"
100 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client.lnk" "$INSTDIR\evergreen.exe"
102 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client Profile Manager.lnk" "$INSTDIR\evergreen.exe" "-profilemanager"
105 CreateShortCut "$DESKTOP\Evergreen Staff Client ${PRODUCT_TAG}.lnk" "$INSTDIR\evergreen.exe"
107 ; External script for extra things.
108 !define EXTERNAL_EXTRAS_SECMAIN
109 !include /NONFATAL "extras.nsi"
110 !undef EXTERNAL_EXTRAS_SECMAIN
112 !insertmacro MUI_STARTMENU_WRITE_END
114 !ifdef AUTOUPDATE | PERMACHINE
115 ; For autoupdate and/or registering per machine, make sure we can write to the install directory.
116 ; If the AccessControl plugin was packaged or part of nsis we would use it instead.
117 ; Also, as cacls.exe is depreciated when icacls.exe exists, try icacls.exe first.
118 IfFileExists "$SYSDIR/icacls.exe" 0 +3
119 ExecWait '"$SYSDIR/icacls.exe" "$INSTDIR" /grant Everyone:(OI)(CI)F'
121 IfFileExists "$SYSDIR/cacls.exe" 0 +2
122 ExecWait '"$SYSDIR/cacls.exe" "$INSTDIR" /E /G Everyone:F'
127 Section /o "Automatic Update" SECAUTO
128 SetOutPath "$INSTDIR\defaults\preferences"
129 File "client\defaults\preferences\autoupdate.js"
130 File "client\defaults\preferences\autochannel.js"
131 SetOutPath "$INSTDIR"
136 Section /o "Developer Options" SECDEV
137 SetOutPath "$INSTDIR\defaults\preferences"
138 File "client\defaults\preferences\developers.js"
139 SetOutPath "$INSTDIR"
144 Section /o "Registration Per Machine" SECPERMAC
145 SetOutPath "$INSTDIR\defaults\preferences"
146 File "client\defaults\preferences\aa_per_machine.js"
147 SetOutPath "$INSTDIR"
152 !insertmacro MUI_LANGDLL_DISPLAY
153 SectionSetFlags ${SECMAIN} 17
154 ; This is mainly for silent installs
155 !ifdef AUTOUPDATE | DEVELOPER | PERMACHINE
158 ${GetParameters} $CMD_ARGS
160 !ifdef AUTOUPDATE_NODEFAULT
161 ${GetOptions} $CMD_ARGS "/autoupdate" $0
164 ${GetOptions} $CMD_ARGS "/noautoupdate" $0
167 SectionSetFlags ${SECAUTO} 1
170 !ifdef PERMACHINE_NODEFAULT
171 ${GetOptions} $CMD_ARGS "/permachine" $0
174 ${GetOptions} $CMD_ARGS "/nopermachine" $0
177 SectionSetFlags ${SECPERMAC} 1
180 ${GetOptions} $CMD_ARGS "/developer" $0
182 SectionSetFlags ${SECDEV} 1
187 Section -AdditionalIcons
188 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
189 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
190 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
191 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
192 !insertmacro MUI_STARTMENU_WRITE_END
196 WriteUninstaller "$INSTDIR\uninst.exe"
197 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\evergreen.exe"
198 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
199 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
200 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\evergreen.exe"
201 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
202 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
203 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
206 ; Section descriptions
207 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
208 !insertmacro MUI_DESCRIPTION_TEXT ${SECMAIN} "The Evergreen Staff Client with XULRunner, Required"
210 !insertmacro MUI_DESCRIPTION_TEXT ${SECAUTO} "Automatic Update Functionality"
213 !insertmacro MUI_DESCRIPTION_TEXT ${SECDEV} "Developer Options"
216 !insertmacro MUI_DESCRIPTION_TEXT ${SECPERMAC} "Default registration and offline storage to per machine instead of per user"
218 !insertmacro MUI_FUNCTION_DESCRIPTION_END
221 Function un.onUninstSuccess
223 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." /SD IDOK
227 !insertmacro MUI_UNGETLANGUAGE
228 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
232 Function "un.RemoveFileCheck"
233 StrCmp $R7 "open_ils_staff_client" +5
242 !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
243 Delete "$INSTDIR\${PRODUCT_NAME}.url"
244 Delete "$INSTDIR\uninst.exe"
245 Delete "$INSTDIR\evergreen.exe"
246 Delete "$INSTDIR\application.ini"
247 Delete "$INSTDIR\BUILD_ID"
248 Delete "$INSTDIR\STAMP_ID"
249 Delete "$INSTDIR\VERSION"
250 Delete "$INSTDIR\install.rdf"
251 Delete "$INSTDIR\active-update.xml"
252 Delete "$INSTDIR\chrome.manifest"
253 Delete "$INSTDIR\updates.xml"
254 Delete "$INSTDIR\log.txt"
255 Delete "$INSTDIR\evergreen.ico"
257 Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
258 Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
259 Delete "$DESKTOP\Evergreen Staff Client ${PRODUCT_TAG}.lnk"
260 Delete "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client.lnk"
262 ; External script for removing extra files before we wipe out the install directory
263 !define EXTERNAL_EXTRAS_UNINSTALL
264 !include /NONFATAL "extras.nsi"
265 !undef EXTERNAL_EXTRAS_UNINSTALL
267 RMDir "$SMPROGRAMS\$ICONS_GROUP"
268 RMDir /r "$INSTDIR\updates"
269 RMDir /r "$INSTDIR\xulrunner"
270 RMDir /r "$INSTDIR\extensions"
271 ; RMDir /r "$INSTDIR\chrome" ; We can't wipe out the chrome directory normally. Per-machine info would be lost on upgrade.
272 RMDir /r "$INSTDIR\components"
273 RMDir /r "$INSTDIR\defaults"
275 ; Basically, we want to remove everything but "open_ils_staff_client" from the chrome dir
276 ; So we pass over every file and folder in it. If it matches, we leave it alone.
277 ${Locate} "$INSTDIR\chrome" "/G=0" "un.RemoveFileCheck"
278 ; Then, we remove the folder non-recursively, which won't wipe out the folder if it is still there.
279 RMDir "$INSTDIR\chrome"
283 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
284 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"