forked from melianmiko/OpenFreebuds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openfreebuds.nsi
91 lines (64 loc) · 2.29 KB
/
openfreebuds.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
!include "MUI2.nsh"
!include "x64.nsh"
!define APP_NAME "OpenFreebuds"
!define APP_DEVELOPER "MelianMiko"
!define APP_BUILD_NAME "openfreebuds"
!define APP_EXE "openfreebuds.exe"
!define REG_KEY
Name "${APP_NAME}"
OutFile "dist\${APP_BUILD_NAME}.install.exe"
Unicode True
AutoCloseWindow True
;Default installation folder
InstallDir "$PROGRAMFILES64\${APP_DEVELOPER}\${APP_NAME}"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\${APP_DEVELOPER} ${APP_NAME}" ""
;Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Dummy Section" SecDummy
; Kill running process
nsExec::ExecToStack "C:\Windows\System32\taskkill.exe /f /im:openfreebuds.exe"
; Copy files
SetOutPath "$INSTDIR"
File /r "dist\${APP_BUILD_NAME}\"
;Shortcuts
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}"
CreateShortCut "$SMPROGRAMS\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}"
;Store installation folder
WriteRegStr HKCU "Software\${APP_DEVELOPER} ${APP_NAME}" "" $INSTDIR
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}_APP" \
"DisplayName" "OpenFreebuds"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}_APP" \
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
;Run app
Exec '"$WINDIR\explorer.exe" "$INSTDIR\${APP_EXE}"'
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
; Kill running process
nsExec::ExecToStack "C:\Windows\System32\taskkill.exe /f /im:openfreebuds.exe"
; Delete all
Delete "$INSTDIR\Uninstall.exe"
Delete "$DESKTOP\${APP_NAME}.lnk"
Delete "$SMPROGRAMS\${APP_NAME}.lnk"
RMDir /r "$INSTDIR"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}_APP"
DeleteRegKey /ifempty HKCU "Software\${APP_DEVELOPER} ${APP_NAME}"
SectionEnd