-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.nsi
More file actions
230 lines (179 loc) · 8.84 KB
/
Copy pathinstall.nsi
File metadata and controls
230 lines (179 loc) · 8.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
; Created by Alexander Griffing on 02/26/04 from a
; script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Ciphertool"
!define PRODUCT_VERSION "1.6.5"
!define PRODUCT_PUBLISHER "Ciphertool Devleopment Group"
!define PRODUCT_WEB_SITE "http://ciphertool.sourceforge.net"
;!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\AppMainExe.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; AG helper defines
!define SHORT_NAME "${PRODUCT_NAME}"
!define FULL_NAME "${PRODUCT_NAME} ${PRODUCT_VERSION}"
!define PRODUCT_LICENSE "./COPYING"
!define REMOTE_TCL_DIR "C:\Tcl"
!define REMOTE_TCL_BIN_DIR "${REMOTE_TCL_DIR}\bin"
!define REMOTE_CT_LIB_DIR "${REMOTE_TCL_DIR}\lib\cipher${PRODUCT_VERSION}"
!define REMOTE_CT_DOC_DIR "${REMOTE_TCL_DIR}\lib\cipher${PRODUCT_VERSION}\doc"
!define REMOTE_CT_BIN_DIR "${REMOTE_TCL_DIR}\lib\cipher${PRODUCT_VERSION}\bin"
!define REMOTE_WISH_PATH "${REMOTE_TCL_BIN_DIR}\wish.exe"
!define LOCAL_ROOT_DIR ""
!define LOCAL_CT_LIB_DIR "${LOCAL_ROOT_DIR}\lib\cipher${PRODUCT_VERSION}"
!define LOCAL_CT_DOC_DIR "${LOCAL_ROOT_DIR}\share\doc\cipher-${PRODUCT_VERSION}"
!define LOCAL_CT_BIN_DIR "${LOCAL_ROOT_DIR}\bin"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; **********************
; **********************
; testing code saying we need Tcl installed.
Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "install_custompage_1.ini" "UserTcl"
FunctionEnd
Page custom InitCustomPage ValidateCustomPage "label that will never be seen as far as I can tell"
Function InitCustomPage
IfFileExists "C:\Tcl\*.*" End
!insertmacro MUI_HEADER_TEXT "Tcl must be installed in order to install Ciphertool." " "
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "UserTcl"
End:
FunctionEnd
Function ValidateCustomPage
IfFileExists "C:\Tcl\*.*" End
MessageBox MB_ICONEXCLAMATION|MB_OK "C:\Tcl installation was not found."
Abort
End:
FunctionEnd
; **********************
; **********************
; License page
!insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE}"
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
; ****************************************************************************************************
;Run an application shortcut after an install | | |
;Written by jpannequin 2004-01-09 06:22:58 Last updated by jpannequin 2004-01-09 06:24:03
;Here is how to launch a shortcut at the end of an install (in the MUI).
;You may need this if you need to use a specific working directory and don't want to modify the MUI.
;So suppose I want to launch "C:\User\test.lnk".
;Before calling the macro for finish, you must define the run variables.
;If you define
;!define MUI_FINISHPAGE_RUN "C:\User\test.lnk"
;it will not work, because it is not an application.
;You must set MUI_FINISHPAGE_RUN empty, and use a function instead.
;!define MUI_FINISHPAGE_RUN
;!define MUI_FINISHPAGE_RUN_TEXT "Start a shortcut"
;!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
;!insertmacro MUI_PAGE_FINISH
;You can then define the function and execute the link with ExecShell.
;Function LaunchLink
; ExecShell "" "C:\User\test.lnk"
;FunctionEnd
; *****************************************************************************************************
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Start ${PRODUCT_NAME}"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!insertmacro MUI_PAGE_FINISH
Function LaunchLink
; ExecShell "" "C:\User\test.lnk"
ExecShell "" "$INSTDIR\${PRODUCT_NAME}.lnk"
FunctionEnd
;!define MUI_FINISHPAGE_RUN "${REMOTE_WISH_PATH} ${REMOTE_CT_BIN_DIR}\ctool"
;!define MUI_FINISHPAGE_RUN "$INSTDIR\${PRODUCT_NAME}.lnk"
;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\Example.file_readme"
;!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Ciphertool_1.6.5_Setup.exe"
InstallDir "$PROGRAMFILES\Ciphertool"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
CreateShortcut "$INSTDIR\${PRODUCT_NAME}.lnk" "${REMOTE_WISH_PATH}" "${REMOTE_CT_BIN_DIR}\ctool"
CreateDirectory "$SMPROGRAMS\${FULL_NAME}"
CreateShortCut "$SMPROGRAMS\${FULL_NAME}\${SHORT_NAME}.lnk" "${REMOTE_WISH_PATH}" "${REMOTE_CT_BIN_DIR}\ctool"
CreateShortCut "$DESKTOP\${SHORT_NAME}.lnk" "${REMOTE_WISH_PATH}" "${REMOTE_CT_BIN_DIR}\ctool"
;File "..\..\..\..\..\path\to\file\AppMainExe.exe"
;CreateDirectory "$SMPROGRAMS\Ciphertool 1.5.10"
;CreateShortCut "$SMPROGRAMS\Ciphertool 1.5.10\Ciphertool.lnk" "$INSTDIR\AppMainExe.exe"
;CreateShortCut "$DESKTOP\Ciphertool.lnk" "$INSTDIR\AppMainExe.exe"
;File "readme.txt"
; ************************************************************************************************
; ************************************************************************************************
; Create the necessary directories.
CreateDirectory "${REMOTE_CT_LIB_DIR}"
CreateDirectory "${REMOTE_CT_DOC_DIR}"
CreateDirectory "${REMOTE_CT_BIN_DIR}"
; Copy the bin folder into the tcl lib directory.
SetOutPath "${REMOTE_CT_BIN_DIR}"
File /r "${LOCAL_CT_BIN_DIR}\*.*"
; Copy the doc folder into the tcl lib cipher directory.
SetOutPath "${REMOTE_CT_DOC_DIR}"
File /r "${LOCAL_CT_DOC_DIR}\*.*"
; Put the tcl lib files in the tcl lib cipher directory.
SetOutPath "${REMOTE_CT_LIB_DIR}"
File /r "${LOCAL_CT_LIB_DIR}\*.*"
; ************************************************************************************************
; ************************************************************************************************
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\${FULL_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\${FULL_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
; Added for documentation help
CreateShortCut "$SMPROGRAMS\${FULL_NAME}\Documentation.lnk" "${REMOTE_CT_DOC_DIR}\index.html"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
;WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\AppMainExe.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
;WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\AppMainExe.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
; ************************************************************************************************
; ************************************************************************************************
; Removing is a little easier than adding in this case.
RMDir /r "${REMOTE_CT_LIB_DIR}"
; ************************************************************************************************
; ************************************************************************************************
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\${PRODUCT_LICENSE}"
Delete "$INSTDIR\${PRODUCT_NAME}.lnk"
Delete "$SMPROGRAMS\${FULL_NAME}\Uninstall.lnk"
Delete "$SMPROGRAMS\${FULL_NAME}\Website.lnk"
Delete "$DESKTOP\${SHORT_NAME}.lnk"
Delete "$SMPROGRAMS\${FULL_NAME}\${SHORT_NAME}.lnk"
; Added to match above.
Delete "$SMPROGRAMS\${FULL_NAME}\Documentation.lnk"
RMDir "$SMPROGRAMS\${FULL_NAME}"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
;DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd