-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathInstallerCreator.in
127 lines (105 loc) · 4.56 KB
/
InstallerCreator.in
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
127
/*
NSIS script to create an installer for the GazeTheWeb-Browser
Run this script using NSIS(https://nsis.sourceforge.io/Download)
The GazeTheWeb project needs to be compiled in Release mode
Run with "makensis.exe InstallerCreator.nsi" (when NSIS is added to Path)
Author: Christopher Dreide
*/
# Proper displaying of languages
Unicode true
# Modern UI
!include "MUI2.nsh"
# Define names and directories
Name "GazeTheWeb - Browse"
!define INSTALLATIONNAME "GazeTheWeb"
OutFile "GazeTheWebInstall_@CLIENT_MAJOR_VERSION@.@[email protected]"
InstallDir $APPDATA\${INSTALLATIONNAME}\Browse
!define InstallDir $APPDATA\${INSTALLATIONNAME}\Browse
VIAddVersionKey "ProductName" "GazeTheWeb - Browse"
VIAddVersionKey "FileDescription" "A gaze controlled web browser"
VIAddVersionKey "FileVersion" "@CLIENT_MAJOR_VERSION@.@CLIENT_MINOR_VERSION@"
VIProductVersion @CLIENT_MAJOR_VERSION@.@[email protected]
VIFileVersion @CLIENT_MAJOR_VERSION@.@[email protected]
; Choose the installer language and remember for uninstall
!define REGISTRY_ROOT_KEY "HKCU"
!define REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALLATIONNAME}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
# ----------------------------------------------------------
# INSTALLER PAGES
# Show welcome page
!insertmacro MUI_PAGE_WELCOME
# Show license
!insertmacro MUI_PAGE_LICENSE "LICENSE"
# Show component selection
!insertmacro MUI_PAGE_COMPONENTS
# Show Destination Directory
!define MUI_WELCOMEPAGE_TITLE "Destination Folder"
!define MUI_WELCOMEPAGE_TEXT "GazeTheWeb - Browse will be installed in the following directory: $\n \
$\"${InstallDir}$\""
!insertmacro MUI_PAGE_WELCOME
# Show installation process
!insertmacro MUI_PAGE_INSTFILES
# Let the user decide whether he wants to start the program after installation
!define MUI_FINISHPAGE_RUN "$INSTDIR\Client.exe"
# Let the user decide whether he wants to read the Readme after installation
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
!insertmacro MUI_PAGE_FINISH
# ----------------------------------------------------------
# UNINSTALLER PAGES
# Confirm that you really want to uninstall the software
!insertmacro MUI_UNPAGE_CONFIRM
# Show uninstalling process
!insertmacro MUI_UNPAGE_INSTFILES
# List of languages to choose from
!insertmacro MUI_LANGUAGE "English"
# Installation
Section ""
SetOutPath $INSTDIR
#File /r .\Client\Release\*.*
File /r /x *.exp /x *.lib .\Client\Release\*.*
WriteUninstaller $INSTDIR\uninstall.exe
WriteRegStr ${REGISTRY_ROOT_KEY} "${REGISTRY_KEY}" "DisplayName" ${INSTALLATIONNAME}
WriteRegStr ${REGISTRY_ROOT_KEY} "${REGISTRY_KEY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD ${REGISTRY_ROOT_KEY} "${REGISTRY_KEY}" "NoModify" 1
WriteRegDWORD ${REGISTRY_ROOT_KEY} "${REGISTRY_KEY}" "NoRepair" 1
SectionEnd
# Create Start Menu Shortcuts
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\${INSTALLATIONNAME}"
CreateShortCut "$SMPROGRAMS\${INSTALLATIONNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\${INSTALLATIONNAME}\Browse.lnk" "$INSTDIR\Client.exe" "" "$INSTDIR\Client.exe" 0
CreateShortCut "$SMPROGRAMS\${INSTALLATIONNAME}\Browse - Voice.lnk" "$INSTDIR\Client.exe" "--voice-input" "$INSTDIR\Client.exe" 0
CreateShortCut "$SMPROGRAMS\${INSTALLATIONNAME}\Readme.lnk" "$INSTDIR\Readme.txt" "$INSTDIR\Readme.txt" 0
CreateShortCut "$SMPROGRAMS\${INSTALLATIONNAME}\VoiceCommands.lnk" "$INSTDIR\VoiceCommands.txt" "$INSTDIR\VoiceCommands.txt" 0
SectionEnd
# Create Desktop Shortcuts
Section "Desktop Shortcuts"
CreateShortCut "$DESKTOP\GazeTheWeb - Browse.lnk" "$INSTDIR\Client.exe" "" "$INSTDIR\Client.exe" 0
CreateShortCut "$DESKTOP\GazeTheWeb - Browse (Voice).lnk" "$INSTDIR\Client.exe" "--voice-input" "$INSTDIR\Client.exe" 0
SectionEnd
# Start when running installer
Function .onInit
# Show language selection
!insertmacro MUI_LANGDLL_DISPLAY
ReadRegStr $R0 ${REGISTRY_ROOT_KEY} ${REGISTRY_KEY} "UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${INSTALLATIONNAME} is already installed. \
$\n$\nClick `OK` to remove the previous version or `Cancel` to cancel this installation." \
IDOK uninst
Abort
# Run the uninstaller
uninst:
ClearErrors
Exec $R0
done:
FunctionEnd
# Uninstall
Section "Uninstall"
DeleteRegKey ${REGISTRY_ROOT_KEY} ${REGISTRY_KEY}
Delete $INSTDIR\uninstall.exe
RMDir /r $INSTDIR
Delete "$SMPROGRAMS\${INSTALLATIONNAME}\*.*"
RMDir "$SMPROGRAMS\${INSTALLATIONNAME}"
Delete "$DESKTOP\Client.lnk"
SectionEnd