-
Notifications
You must be signed in to change notification settings - Fork 3
/
altera_installer.nsi
executable file
·104 lines (74 loc) · 3.01 KB
/
altera_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
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
; example2.nsi
;
; This script is based on example1.nsi, but it remember the directory,
; has uninstall support and (optionally) installs start menu shortcuts.
;
; It will install example2.nsi into a directory that the user selects,
;--------------------------------
; The name of the installer
Name "AlteraOrbis"
; The file to write
OutFile "AlteraOrbisInstaller.exe"
; The default installation directory
InstallDir $PROGRAMFILES\AlteraOrbis
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\NSIS_AlteraOrbis" "Install_Dir"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
; Pages
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; The stuff to install
Section "AlteraOrbis (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File /r Altera\*.*
File vc_redist.x86.exe
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\NSIS_AlteraOrbis "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AlteraOrbis" "DisplayName" "AlteraOrbis"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AlteraOrbis" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AlteraOrbis" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AlteraOrbis" "NoRepair" 1
WriteUninstaller "uninstall.exe"
MessageBox MB_YESNO "Install Microsoft 2015 Redistributables (required if not installed)?" /SD IDYES IDNO endRedist
ExecWait "$INSTDIR\vc_redist.x86.exe"
Goto endRedist
endRedist:
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\AlteraOrbis"
CreateShortCut "$SMPROGRAMS\AlteraOrbis\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\AlteraOrbis\AlteraOrbis.lnk" "$INSTDIR\Altera.exe" "" "$INSTDIR\Altera.exe" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AlteraOrbis"
DeleteRegKey HKLM SOFTWARE\NSIS_AlteraOrbis
; Remove files and uninstaller
RMDir /r $INSTDIR\cache
RMDir /r $INSTDIR\res
RMDir /r $INSTDIR\save
Delete $INSTDIR\Altera.exe
Delete $INSTDIR\README.txt
Delete $INSTDIR\SDL2.dll
Delete $INSTDIR\SDL2_mixer.dll
Delete $INSTDIR\vc_redist.x86.exe
Delete $INSTDIR\uninstall.exe
; Remove shortcuts, if any
Delete "$SMPROGRAMS\AlteraOrbis\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\AlteraOrbis"
RMDir "$INSTDIR"
SectionEnd