-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.nsi
80 lines (60 loc) · 2.48 KB
/
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
Name "wifi-qr"
OutFile "wifi-qr-setup.exe"
Unicode true
ManifestDPIAware true
ManifestDPIAwareness PerMonitorV2
SetCompressor /SOLID lzma
InstallDir "$LOCALAPPDATA\wifi-qr"
!include "MUI2.nsh"
!include "FileFunc.nsh"
RequestExecutionLevel user
!define PRODUCTNAME "wifi-qr"
!define MAINBINARYNAME "wifi-qr.exe"
!define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}"
!define VERSION "0.3.1"
Var AppStartMenuFolder
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $AppStartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create desktop shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDesktopShortcut
!define MUI_FINISHPAGE_RUN "$INSTDIR\${MAINBINARYNAME}"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section
SetOutPath "$INSTDIR"
File "${MAINBINARYNAME}"
WriteUninstaller "$INSTDIR\uninstall.exe"
WriteRegStr HKCU "${UNINSTKEY}" "DisplayName" "${PRODUCTNAME}"
WriteRegStr HKCU "${UNINSTKEY}" "DisplayIcon" "$\"$INSTDIR\${MAINBINARYNAME}$\""
WriteRegStr HKCU "${UNINSTKEY}" "DisplayVersion" "${VERSION}"
WriteRegStr HKCU "${UNINSTKEY}" "Publisher" "Amr Bashir"
WriteRegStr HKCU "${UNINSTKEY}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKCU "${UNINSTKEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegDWORD HKCU "${UNINSTKEY}" "NoModify" "1"
WriteRegDWORD HKCU "${UNINSTKEY}" "NoRepair" "1"
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKCU "${UNINSTKEY}" "EstimatedSize" "$0"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$AppStartMenuFolder"
CreateShortcut "$SMPROGRAMS\$AppStartMenuFolder\${PRODUCTNAME}.lnk" "$INSTDIR\${MAINBINARYNAME}"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section Uninstall
Delete "$INSTDIR\${MAINBINARYNAME}"
Delete "$INSTDIR\uninstall.exe"
!insertmacro MUI_STARTMENU_GETFOLDER Application $AppStartMenuFolder
Delete "$SMPROGRAMS\$AppStartMenuFolder\${PRODUCTNAME}.lnk"
RMDir "$SMPROGRAMS\$AppStartMenuFolder"
Delete "$DESKTOP\${PRODUCTNAME}.lnk"
DeleteRegKey HKCU "${UNINSTKEY}"
SectionEnd
Function CreateDesktopShortcut
CreateShortcut "$DESKTOP\${PRODUCTNAME}.lnk" "$INSTDIR\${MAINBINARYNAME}"
FunctionEnd