forked from ed-chemnitz/qmodbus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qmodbus.nsi
115 lines (89 loc) · 4.02 KB
/
qmodbus.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
############################## Symbol Definitions ##############################
!define APP_NAME "QModBus"
!system 'echo "!define VERSION" $(git describe | sed -e "s/^v//g") > version.nsh'
!include version.nsh
!define COMPANY "EDC Electronic Design Chemnitz GmbH"
!define WEBSITE "http://www.ed-chemnitz.de"
!define COPYRIGHT "© EDC Electronic Design Chemnitz GmbH 2009-2018"
!define DESCRIPTION "Application with modbus RTU slave / TCP client"
!define INSTALLER_NAME "${APP_NAME}-${VERSION}-setup.exe"
!define APP_EXE "${APP_NAME}.exe"
!define REG_ROOT "HKLM"
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${APP_EXE}"
!define REG_UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
!define BINARYDIR "install"
################################## Some Keys ###################################
VIProductVersion "${VERSION}.0"
VIAddVersionKey "ProductName" "${APP_NAME}"
VIAddVersionKey "ProductVersion" "${VERSION}"
VIAddVersionKey "CompanyName" "${COMPANY}"
VIAddVersionKey "CompanyWebsite" "${WEBSITE}"
VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
VIAddVersionKey "FileDescription" "${DESCRIPTION}"
VIAddVersionKey "FileVersion" "${VERSION}"
############################### Installer Config ###############################
SetCompressor /SOLID Lzma
RequestExecutionLevel admin
Name "${APP_NAME}"
Caption "${APP_NAME} ${VERSION}"
OutFile "${INSTALLER_NAME}"
BrandingText "${APP_NAME} ${VERSION}"
CRCCheck on
XPStyle on
InstallDirRegKey "${REG_ROOT}" "${REG_APP_PATH}" ""
InstallDir "$PROGRAMFILES64\${APP_NAME}"
ShowInstDetails show
AutoCloseWindow false
ShowUninstDetails show
################################ Include files #################################
!include "Sections.nsh"
!include "MUI.nsh"
######################### Modern User Interface Usage ##########################
!define MUI_ABORTWARNING
!define MUI_UNABORTWARNING
!define MUI_LANGDLL_REGISTRY_ROOT "${REG_ROOT}"
!define MUI_LANGDLL_REGISTRY_KEY "${REG_UNINSTALL_PATH}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_RESERVEFILE_LANGDLL
########################### Actual Installer Section ###########################
Section ""
SetShellVarContext all
SetOutPath $INSTDIR
SetOverwrite on
File /r "${BINARYDIR}\*"
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
CreateDirectory "$SMPROGRAMS\${APP_NAME}"
CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}" $INSTDIR
CreateShortcut "$SMPROGRAMS\${APP_NAME}\Uninstall ${APP_NAME}.lnk" "$INSTDIR\uninstall.exe" $INSTDIR
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}" $INSTDIR
WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${APP_EXE}"
WriteRegStr ${REG_ROOT} "${REG_UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
WriteRegStr ${REG_ROOT} "${REG_UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr ${REG_ROOT} "${REG_UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${APP_EXE}"
WriteRegStr ${REG_ROOT} "${REG_UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
WriteRegStr ${REG_ROOT} "${REG_UNINSTALL_PATH}" "Publisher" "${COMPANY}"
WriteRegStr ${REG_ROOT} "${REG_UNINSTALL_PATH}" "URLInfoAbout" "${WEBSITE}"
WriteRegDWORD ${REG_ROOT} "${REG_UNINSTALL_PATH}" "NoModify" 1
WriteRegDWORD ${REG_ROOT} "${REG_UNINSTALL_PATH}" "NoRepair" 1
SectionEnd
########################## Actual Uninstaller Section ##########################
Section "Uninstall"
SetShellVarContext all
RmDir /r "$INSTDIR"
Delete "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk"
Delete "$SMPROGRAMS\${APP_NAME}\Uninstall ${APP_NAME}.lnk"
RmDir /r "$SMPROGRAMS\${APP_NAME}"
Delete "$DESKTOP\${APP_NAME}.lnk"
DeleteRegKey ${REG_ROOT} "${REG_APP_PATH}"
DeleteRegKey ${REG_ROOT} "${REG_UNINSTALL_PATH}"
SectionEnd