-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbzflag-launcher.nsi
106 lines (84 loc) · 4.81 KB
/
bzflag-launcher.nsi
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
!include "MUI.nsh"
!define APPNAME "BZFlag Launcher"
!define APPID "bzflag-launcher"
!define COMPANYNAME "The Noah"
!define DESCRIPTION "Simple launcher for BZFlag which can handle a custom URI scheme on Windows"
# These three must be integers
!define VERSIONMAJOR 1
!define VERSIONMINOR 0
!define VERSIONREVISION 0
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://github.com/The-Noah/bzflag-launcher" # "Support Information" link
!define ABOUTURL "http://github.com/The-Noah/" # "Publisher" link
# This is the size (in kB) of all the files copied into the install location
!define INSTALLSIZE 507
RequestExecutionLevel user
SetCompress auto
SetCompressor /SOLID lzma
InstallDir "$LOCALAPPDATA\Programs\${APPNAME}"
# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
#LicenseData "LICENSE"
# This will be in the installer/uninstaller's title bar
Name "${APPNAME}"
OutFile "${APPID}.${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONREVISION}-setup.exe"
!include LogicLib.nsh
!define MUI_ABORTWARNING
!define MUI_ICON "icon.ico"
!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "install"
# Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
SetOutPath $INSTDIR
# Files added here should be removed by the uninstaller (see section "uninstall")
File "bin\${APPID}.exe"
File "bin\${APPID}.dll"
File "bin\${APPID}.runtimeconfig.json"
File "LICENSE"
File "README.md"
# Add any other files for the install directory (license files, app data, etc) here
# Uninstaller - See function un.onInit and section "uninstall" for configuration
WriteUninstaller "$INSTDIR\uninstall.exe"
# Start Menu
CreateShortCut "$SMPROGRAMS\${APPNAME}.lnk" "$INSTDIR\${APPID}.exe" "" "$INSTDIR\${APPID}.exe"
# Registry information for add/remove programs
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\${APPID}.exe$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${COMPANYNAME}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONREVISION}"
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMinor" ${VERSIONMINOR}
# There is no option for modifying or repairing the install
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
# URI scheme handler
WriteRegStr HKCU "Software\Classes\${APPID}" "" "URL:${APPNAME} Protocol"
WriteRegStr HKCU "Software\Classes\${APPID}" "URL PROTOCOL" ""
WriteRegStr HKCU "Software\Classes\${APPID}\DefaultIcon" "" "$INSTDIR\${APPID}.exe"
WriteRegStr HKCU "Software\Classes\${APPID}\shell\open\command" "" "$\"$INSTDIR\${APPID}.exe$\" $\"%1$\""
DetailPrint "Created URI scheme handler"
SectionEnd
# Uninstaller
Section "uninstall"
# Remove Start Menu launcher
Delete "$SMPROGRAMS\${APPNAME}.lnk"
# Remove files
Delete $INSTDIR\${APPID}.exe
Delete $INSTDIR\LICENSE
Delete $INSTDIR\README.md
# Always delete uninstaller as the last action
Delete $INSTDIR\uninstall.exe
# Try to remove the install directory - this will only happen if it is empty
RMDir $INSTDIR
# Remove uninstaller information from the registry
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKCU "Software\Classes\${APPID}"
SectionEnd