-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.nsi
More file actions
62 lines (54 loc) · 2.01 KB
/
install.nsi
File metadata and controls
62 lines (54 loc) · 2.01 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
!define APPNAME "GPDF2GTIF"
!define COMPANYNAME "DGC Software"
!define DESCRIPTION "This program converts Geospatial PDFs to Geo TIFFs using GDAL."
!define VERSIONMAJOR 1
!define VERSIONMINOR 1
!define VERSIONBUILD 1
Icon "icon.ico"
!define REGUNINSTKEY "ca1e7f4c-4809-41c9-9340-2a9c8d11ac5e"
!define REGHKEY HKLM
!define REGPATH_WINUNINST "Software\Microsoft\Windows\CurrentVersion\Uninstall"
InstallDir "$PROGRAMFILES\${APPNAME}"
Name "${APPNAME} -- Installer"
OutFile "${APPNAME} Installer.exe"
DirText "This will install GPDF2GTIF on your computer. Please choose a directory."
RequestExecutionLevel admin
!include LogicLib.nsh
!macro VerifyUserIsAdmin
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
messageBox mb_iconstop "Administrator rights required!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend
function .onInit
setShellVarContext all
!insertmacro VerifyUserIsAdmin
functionEnd
Section
SetOutPath $INSTDIR
WriteUninstaller "$INSTDIR\uninstaller.exe"
WriteRegStr ${REGHKEY} "${REGPATH_WINUNINST}\${REGUNINSTKEY}" "DisplayName" "${APPNAME}"
WriteRegStr ${REGHKEY} "${REGPATH_WINUNINST}\${REGUNINSTKEY}" "UninstallString" '"$INSTDIR\uninstaller.exe"'
WriteRegStr ${REGHKEY} "${REGPATH_WINUNINST}\${REGUNINSTKEY}" "Publisher" "${COMPANYNAME}"
File /r "Converter\"
CreateShortCut "$SMPROGRAMS\${APPNAME}.lnk" "$INSTDIR\${APPNAME}.exe" "" "$INSTDIR\icon.ico" 0
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\${APPNAME}.exe" "" "$INSTDIR\icon.ico" 0
SectionEnd
function un.onInit
SetShellVarContext all
#Verify the uninstaller - last chance to back out
MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
Abort
next:
!insertmacro VerifyUserIsAdmin
functionEnd
Section "uninstall"
Delete "$INSTDIR\uninstall.exe"
Delete "$SMPROGRAMS\${APPNAME}.lnk"
Delete "$DESKTOP\${APPNAME}.lnk"
rmDir /r $INSTDIR
DeleteRegKey ${REGHKEY} "${REGPATH_WINUNINST}\${REGUNINSTKEY}"
SectionEnd