forked from desura/desura-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Desura.nsi
126 lines (86 loc) · 3.36 KB
/
Desura.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
!include "MUI2.nsh"
; Desura.nsi
;
;--------------------------------
!define MUI_ICON ".\src\branding_desura\desura.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ".\src\branding_desura\header.bmp"
#!define MUI_HEADERIMAGE_RIGHT
; The name of the installer
Name "Desura"
; The file to write
OutFile "DesuraInstaller.exe"
; The default installation directory
InstallDir $PROGRAMFILES\Desura
; Registry key to check for directory (so if you install again, it will overwrite the old one automatically)
InstallDirRegKey HKLM "Software\Desura" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
; Functions
Function RunDesura
SetOutPath $INSTDIR
Exec "$INSTDIR\desura.exe"
FunctionEnd
; Pages
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_CHECKED
!define MUI_FINISHPAGE_RUN_FUNCTION RunDesura
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
; The stuff to install
Section "Desura (required)"
SetShellVarContext all
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "build\RelWithDebInfo_Out\desura.exe"
File "build\RelWithDebInfo_Out\desura_service.exe"
File "build\RelWithDebInfo_Out\Desura_Uninstaller.exe"
File "build\RelWithDebInfo_Out\dumpgen.exe"
File "build\RelWithDebInfo_Out\java_launcher.exe"
File "build\RelWithDebInfo_Out\mcf_util.exe"
File "build\RelWithDebInfo_Out\toolhelper.exe"
File "build\RelWithDebInfo_Out\utility.exe"
File /r "build\RelWithDebInfo_Out\bin"
File /r "build\RelWithDebInfo_Out\data"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\Desura "Install_Dir" "$INSTDIR"
; Registry key to force proxy off (helpful for some users)
WriteRegDWORD HKLM "Software\Desura\DesuraApp" "PrivateProxyOff" 1
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Desura" "DisplayName" "Desura"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Desura" "UninstallString" '"$INSTDIR\Desura_Uninstaller.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Desura" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Desura" "NoRepair" 1
WriteUninstaller "Desura_Uninstaller.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\Desura"
CreateShortcut "$SMPROGRAMS\Desura\Uninstall.lnk" "$INSTDIR\Desura_Uninstaller.exe" "" "$INSTDIR\Desura_Uninstaller.exe" 0
CreateShortcut "$SMPROGRAMS\Desura\Desura.lnk" "$INSTDIR\Desura.exe" "" "$INSTDIR\Desura.exe" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
SetShellVarContext all
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Desura"
DeleteRegKey HKLM SOFTWARE\Desura
; Remove files and uninstaller
Delete $INSTDIR\*.*
; Remove shortcuts, if any
Delete "$SMPROGRAMS\Desura\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\Desura"
RMDir "$INSTDIR"
SectionEnd