~evergreen-bugs/evergreen/rel_3_11

« back to all changes in this revision

Viewing changes to Open-ILS/xul/staff_client/windowssetup.nsi

  • Committer: phasefx
  • Date: 2010-08-24 19:04:20 UTC
  • Revision ID: git-v1:53a0bd89fe11176c309b6bcf7f812e3bb60b1283
Staff Client Build/Update Enhancements patch from Thomas Berezansky

Among other things, allows cross-compilation of Windows installers from Unix environments via NSIS, and enables Mozilla's upgrade mechanism for performing upgrades without needing to download and execute external files.

See https://bugs.launchpad.net/evergreen/+bug/616452/ for more details.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17330 dcc99617-32d9-48b4-a31d-7c20da2025e4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; Script generated by the HM NIS Edit Script Wizard.
 
2
 
 
3
; HM NIS Edit Wizard helper defines
 
4
!define PRODUCT_NAME "Evergreen Staff Client"
 
5
; Old versions of makensis don't like this, moved to Makefile
 
6
;!define /file PRODUCT_VERSION "client/VERSION"
 
7
!define PRODUCT_PUBLISHER "Evergreen Community"
 
8
!define PRODUCT_WEB_SITE "http://evergreen-ils.org/"
 
9
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\evergreen.exe"
 
10
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
 
11
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
 
12
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
 
13
 
 
14
; MUI 1.67 compatible ------
 
15
!include "MUI.nsh"
 
16
 
 
17
; File Functions
 
18
!include "FileFunc.nsh"
 
19
 
 
20
; MUI Settings
 
21
!define MUI_ABORTWARNING
 
22
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
 
23
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
 
24
 
 
25
; Language Selection Dialog Settings
 
26
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
 
27
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
 
28
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
 
29
 
 
30
; Welcome page
 
31
!insertmacro MUI_PAGE_WELCOME
 
32
; License page
 
33
!insertmacro MUI_PAGE_LICENSE "..\..\..\LICENSE.txt"
 
34
; Components page
 
35
!ifdef AUTOUPDATE | DEVELOPER
 
36
!insertmacro MUI_PAGE_COMPONENTS
 
37
!endif
 
38
; Directory page
 
39
!insertmacro MUI_PAGE_DIRECTORY
 
40
; Start menu page
 
41
var ICONS_GROUP
 
42
!define MUI_STARTMENUPAGE_NODISABLE
 
43
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Evergreen Staff Client"
 
44
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
 
45
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
 
46
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
 
47
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
 
48
; Instfiles page
 
49
!insertmacro MUI_PAGE_INSTFILES
 
50
; Finish page
 
51
!define MUI_FINISHPAGE_RUN "$INSTDIR\evergreen.exe"
 
52
!insertmacro MUI_PAGE_FINISH
 
53
 
 
54
; Uninstaller pages
 
55
!insertmacro MUI_UNPAGE_INSTFILES
 
56
 
 
57
; Language files
 
58
!insertmacro MUI_LANGUAGE "Czech"
 
59
!insertmacro MUI_LANGUAGE "English"
 
60
!insertmacro MUI_LANGUAGE "French"
 
61
 
 
62
; MUI end ------
 
63
 
 
64
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
 
65
OutFile "evergreen_staff_client_setup.exe"
 
66
InstallDir "$PROGRAMFILES\Evergreen Staff Client"
 
67
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
 
68
ShowInstDetails show
 
69
ShowUnInstDetails show
 
70
RequestExecutionLevel admin
 
71
 
 
72
Section "Staff Client" SECMAIN
 
73
  SetOutPath "$INSTDIR"
 
74
  File /r /x "autoupdate.js" /x "autochannel.js" /x "developers.js" "client\*"
 
75
 
 
76
; Shortcuts
 
77
  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
 
78
  CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
 
79
  !ifdef WICON
 
80
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client.lnk" "$INSTDIR\evergreen.exe" "" "$INSTDIR\evergreen.ico"
 
81
  !ifdef PROFILES
 
82
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client Profile Manager.lnk" "$INSTRDIR\evergreen.exe -profilemanager" "" "$INSTDIR\evergreen.ico"
 
83
  !endif
 
84
  !else
 
85
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client.lnk" "$INSTDIR\evergreen.exe"
 
86
  !ifdef PROFILES
 
87
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client Profile Manager.lnk" "$INSTRDIR\evergreen.exe -profilemanager"
 
88
  !endif
 
89
  !endif
 
90
  CreateShortCut "$DESKTOP\Evergreen Staff Client.lnk" "$INSTDIR\evergreen.exe"
 
91
  !insertmacro MUI_STARTMENU_WRITE_END
 
92
SectionEnd
 
93
 
 
94
!ifdef AUTOUPDATE
 
95
Section /o "Automatic Update" SECAUTO
 
96
  SetOutPath "$INSTDIR\defaults\preferences"
 
97
  File "client\defaults\preferences\autoupdate.js"
 
98
  File "client\defaults\preferences\autochannel.js"
 
99
  SetOutPath "$INSTDIR"
 
100
SectionEnd
 
101
!endif
 
102
 
 
103
!ifdef DEVELOPER
 
104
Section /o "Developer Options" SECDEV
 
105
  SetOutPath "$INSTDIR\defaults\preferences"
 
106
  File "client\defaults\preferences\developers.js"
 
107
  SetOutPath "$INSTDIR"
 
108
SectionEnd
 
109
!endif
 
110
 
 
111
 
 
112
Function .onInit
 
113
  !insertmacro MUI_LANGDLL_DISPLAY
 
114
  SectionSetFlags ${SECMAIN} 17
 
115
  ; This is mainly for silent installs
 
116
  !ifdef AUTOUPDATE | DEVELOPER
 
117
    Var /GLOBAL CMD_ARGS
 
118
    StrCpy $CMD_ARGS ""
 
119
    ${GetParameters} $CMD_ARGS
 
120
    !ifdef AUTOUPDATE
 
121
      !ifdef AUTOUPDATE_NODEFAULT
 
122
        ${GetOptions} $CMD_ARGS "/autoupdate" $0
 
123
        IfErrors +2 0
 
124
      !else
 
125
        ${GetOptions} $CMD_ARGS "/noautoupdate" $0
 
126
        IfErrors 0 +2
 
127
      !endif
 
128
      SectionSetFlags ${SECAUTO} 1
 
129
    !endif
 
130
    !ifdef DEVELOPER
 
131
      ${GetOptions} $CMD_ARGS "/developer" $0
 
132
      IfErrors +2 0
 
133
      SectionSetFlags ${SECDEV} 1
 
134
    !endif
 
135
  !endif
 
136
FunctionEnd
 
137
 
 
138
Section -AdditionalIcons
 
139
  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
 
140
  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
 
141
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
 
142
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
 
143
  !insertmacro MUI_STARTMENU_WRITE_END
 
144
SectionEnd
 
145
 
 
146
Section -Post
 
147
  WriteUninstaller "$INSTDIR\uninst.exe"
 
148
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\evergreen.exe"
 
149
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
 
150
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
 
151
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\evergreen.exe"
 
152
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
 
153
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
 
154
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
 
155
SectionEnd
 
156
 
 
157
; Section descriptions
 
158
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 
159
  !insertmacro MUI_DESCRIPTION_TEXT ${SECMAIN} "The Evergreen Staff Client with XULRunner, Required"
 
160
  !ifdef AUTOUPDATE
 
161
  !insertmacro MUI_DESCRIPTION_TEXT ${SECAUTO} "Automatic Update Functionality"
 
162
  !endif
 
163
  !ifdef DEVELOPER
 
164
  !insertmacro MUI_DESCRIPTION_TEXT ${SECDEV}  "Developer Options"
 
165
  !endif
 
166
!insertmacro MUI_FUNCTION_DESCRIPTION_END
 
167
 
 
168
 
 
169
Function un.onUninstSuccess
 
170
  HideWindow
 
171
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
 
172
FunctionEnd
 
173
 
 
174
Function un.onInit
 
175
!insertmacro MUI_UNGETLANGUAGE
 
176
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
 
177
  Abort
 
178
FunctionEnd
 
179
 
 
180
Section Uninstall
 
181
  !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
 
182
  Delete "$INSTDIR\${PRODUCT_NAME}.url"
 
183
  Delete "$INSTDIR\uninst.exe"
 
184
  Delete "$INSTDIR\evergreen.exe"
 
185
  Delete "$INSTDIR\application.ini"
 
186
  Delete "$INSTDIR\BUILD_ID"
 
187
  Delete "$INSTDIR\STAMP_ID"
 
188
  Delete "$INSTDIR\VERSION"
 
189
  Delete "$INSTDIR\install.rdf"
 
190
  Delete "$INSTDIR\active-update.xml"
 
191
  Delete "$INSTDIR\chrome.manifest"
 
192
  Delete "$INSTDIR\updates.xml"
 
193
  Delete "$INSTDIR\log.txt"
 
194
 
 
195
  Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
 
196
  Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
 
197
  Delete "$DESKTOP\Evergreen Staff Client.lnk"
 
198
  Delete "$SMPROGRAMS\$ICONS_GROUP\Evergreen Staff Client.lnk"
 
199
 
 
200
  RMDir "$SMPROGRAMS\$ICONS_GROUP"
 
201
  RMDir /r "$INSTDIR\updates"
 
202
  RMDir /r "$INSTDIR\xulrunner"
 
203
  RMDir /r "$INSTDIR\extensions"
 
204
  RMDir /r "$INSTDIR\chrome"
 
205
  RMDir /r "$INSTDIR\components"
 
206
  RMDir /r "$INSTDIR\defaults"
 
207
  RMDir "$INSTDIR"
 
208
 
 
209
  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
 
210
  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
 
211
  SetAutoClose true
 
212
SectionEnd