-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
nsis-installer.nsi
110 lines (82 loc) · 3.7 KB
/
nsis-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
105
106
107
108
109
110
!include "MUI2.nsh"
; The name of the installer
Name "Chameleon Ultra GUI"
; The file to write
OutFile "chameleonultragui-setup-win.exe"
; Request application privileges for Windows Vista and higher
RequestExecutionLevel admin
; Build Unicode installer
Unicode True
; The default installation directory
InstallDir $PROGRAMFILES\chameleonultragui
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\chameleonultragui" "Install_Dir"
!define MUI_ICON "chameleonultragui\windows\runner\resources\app_icon.ico"
;--------------------------------
; Pages
!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
!insertmacro MUI_LANGUAGE "English"
; The stuff to install
Section "Chameleon Ultra GUI (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put file there
File "chameleonultragui\build\windows\x64\runner\Release\chameleonultragui.exe"
File "chameleonultragui\build\windows\x64\runner\Release\flutter_libserialport_plugin.dll"
File "chameleonultragui\build\windows\x64\runner\Release\flutter_windows.dll"
File "chameleonultragui\build\windows\x64\runner\Release\recovery.dll"
File "chameleonultragui\build\windows\x64\runner\Release\serialport.dll"
File "chameleonultragui\build\windows\x64\runner\Release\file_saver_plugin.dll"
File "chameleonultragui\build\windows\x64\runner\Release\permission_handler_windows_plugin.dll"
File "chameleonultragui\build\windows\x64\runner\Release\url_launcher_windows_plugin.dll"
File "LICENSE"
File /r "chameleonultragui\build\windows\x64\runner\Release\data"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\chameleonultragui "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\chameleonultragui" "DisplayName" "Chameleon Ultra GUI"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\chameleonultragui" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\chameleonultragui" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\chameleonultragui" "NoRepair" 1
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateShortcut "$SMPROGRAMS\Chameleon Ultra GUI.lnk" "$INSTDIR\chameleonultragui.exe"
SectionEnd
; Optional section (can be disabled by the user)
Section "Desktop Shortcut"
CreateShortcut "$DESKTOP\Chameleon Ultra GUI.lnk" "$INSTDIR\chameleonultragui.exe"
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\chameleonultragui"
DeleteRegKey HKLM SOFTWARE\chameleonultragui
; Remove files and uninstaller
Delete $INSTDIR\chameleonultragui.exe
Delete $INSTDIR\flutter_libserialport_plugin.dll
Delete $INSTDIR\flutter_windows.dll
Delete $INSTDIR\recovery.dll
Delete $INSTDIR\serialport.dll
Delete $INSTDIR\file_saver_plugin.dll
Delete $INSTDIR\permission_handler_windows_plugin.dll
Delete $INSTDIR\url_launcher_windows_plugin.dll
RMDir /r $INSTDIR\data
Delete $INSTDIR\LICENSE
Delete $INSTDIR\uninstall.exe
; Remove shortcuts, if any
Delete "$SMPROGRAMS\Chameleon Ultra GUI.lnk"
Delete "$DESKTOP\Chameleon Ultra GUI.lnk"
; Remove directories
RMDir "$INSTDIR"
SectionEnd