a mega cool windows xp app
1; Shortwave Radio Installer
2; Compatible with Windows XP and later
3
4!define APPNAME "Shortwave Radio"
5!define COMPANYNAME "Kieran Klukas"
6!define DESCRIPTION "Vintage Shortwave Radio Tuner with Internet Streaming"
7!define VERSIONMAJOR 1
8!define VERSIONMINOR 0
9!define VERSIONBUILD 0
10!define HELPURL "https://github.com/taciturnaxolotl/shortwave"
11!define UPDATEURL "https://github.com/taciturnaxolotl/shortwave/releases"
12!define ABOUTURL "https://github.com/taciturnaxolotl/shortwave"
13!define INSTALLSIZE 2048
14
15; Disable CRC check to avoid cross-platform issues
16CRCCheck off
17; Use solid compression
18SetCompressor /SOLID lzma
19
20RequestExecutionLevel admin
21InstallDir "$PROGRAMFILES\${APPNAME}"
22Name "${APPNAME}"
23outFile "ShortwaveRadioInstaller.exe"
24
25!include LogicLib.nsh
26
27page directory
28page instfiles
29
30!macro VerifyUserIsAdmin
31UserInfo::GetAccountType
32pop $0
33${If} $0 != "admin"
34 messageBox mb_iconstop "Administrator rights required!"
35 setErrorLevel 740
36 quit
37${EndIf}
38!macroend
39
40function .onInit
41 setShellVarContext all
42 !insertmacro VerifyUserIsAdmin
43functionEnd
44
45section "install"
46 setOutPath $INSTDIR
47
48 ; Main executable
49 file "result/bin/Shortwave.exe"
50
51 ; BASS audio library
52 file "libs/bass.dll"
53
54 ; License and documentation
55 file "LICENSE.md"
56 file "README.md"
57
58 ; Create uninstaller
59 writeUninstaller "$INSTDIR\uninstall.exe"
60
61 ; Start menu shortcuts
62 createDirectory "$SMPROGRAMS\${APPNAME}"
63 createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\Shortwave.exe"
64 createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
65
66 ; Desktop shortcut
67 createShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\Shortwave.exe"
68
69 ; Registry entries for Add/Remove Programs
70 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME} - ${DESCRIPTION}"
71 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
72 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
73 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
74 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\Shortwave.exe$\""
75 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${COMPANYNAME}"
76 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "HelpLink" "${HELPURL}"
77 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "URLUpdateInfo" "${UPDATEURL}"
78 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "URLInfoAbout" "${ABOUTURL}"
79 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}"
80 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
81 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "VersionMinor" ${VERSIONMINOR}
82 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
83 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
84 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
85sectionEnd
86
87function un.onInit
88 SetShellVarContext all
89 MessageBox MB_OKCANCEL "Remove ${APPNAME}?" IDOK next
90 Abort
91 next:
92 !insertmacro VerifyUserIsAdmin
93functionEnd
94
95section "uninstall"
96 ; Remove files
97 delete "$INSTDIR\Shortwave.exe"
98 delete "$INSTDIR\bass.dll"
99 delete "$INSTDIR\LICENSE.md"
100 delete "$INSTDIR\README.md"
101 delete "$INSTDIR\uninstall.exe"
102
103 ; Remove shortcuts
104 delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
105 delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
106 rmDir "$SMPROGRAMS\${APPNAME}"
107 delete "$DESKTOP\${APPNAME}.lnk"
108
109 ; Remove registry entries
110 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
111
112 ; Remove installation directory
113 rmDir "$INSTDIR"
114sectionEnd