-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathwin32-installer.nsi
75 lines (56 loc) · 2.39 KB
/
win32-installer.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
#!include MUI.nsh
!define APPNAME "SpikeRecorder"
!define COMPANYNAME "Backyard Brains"
RequestExecutionLevel admin
Name "${APPNAME}"
OutFile "SpikeRecorderSetup.exe"
SetCompressor lzma
InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
Page directory
Page instfiles
#!insertmacro MUI_PAGE_WELCOME
#!insertmacro MUI_PAGE_Directory
#!insertmacro MUI_PAGE_INSTFILES
#!insertmacro MUI_PAGE_FINISH
!macro VerifyUserIsAdmin
!macroend
function .onInit
setShellVarContext all
functionEnd
Section "install"
SetOutPath $INSTDIR
File "SpikeRecorder.exe"
File /r "data"
File "bass.dll"
writeUninstaller "$INSTDIR\uninstall.exe"
createDirectory "$SMPROGRAMS\${COMPANYNAME}"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\SpikeRecorder.exe" "" ""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "${COMPANYNAME}"
# There is no option for modifying or repairing the install
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
SectionEnd
function un.onInit
SetShellVarContext all
MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
Abort
next:
functionEnd
section "uninstall"
delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
rmDir "$SMPROGRAMS\${COMPANYNAME}"
# Remove files
delete $INSTDIR\SpikeRecorder.exe
delete $INSTDIR\data
delete $INSTDIR\bass.dll
# 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 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
sectionEnd