-
Notifications
You must be signed in to change notification settings - Fork 0
/
NSIS.nsi
89 lines (75 loc) · 2.97 KB
/
NSIS.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
!define APP_NAME "Compactor"
!define REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
Name "${APP_NAME}"
BrandingText " "
OutFile "x64\${APP_NAME} Installer.exe"
Unicode True
!define MULTIUSER_MUI
!define MULTIUSER_USE_PROGRAMFILES64
!define MULTIUSER_EXECUTIONLEVEL "Highest"
!define MULTIUSER_INSTALLMODE_COMMANDLINE
!define MULTIUSER_INSTALLMODE_INSTDIR "${APP_NAME}"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${REG_KEY}"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "UninstallString"
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "${REG_KEY}"
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "InstallLocation"
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_ICON "icon.ico"
!define MUI_UNICON "icon.ico"
!define MUI_FINISHPAGE_RUN "$INSTDIR\${APP_NAME}.exe"
!define MUI_FINISHPAGE_RUN_TEXT "Launch ${APP_NAME}"
!include MultiUser.nsh
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MULTIUSER_PAGE_INSTALLMODE
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
Function .onInit
!insertmacro MULTIUSER_INIT
FunctionEnd
Function un.onInit
!insertmacro MULTIUSER_UNINIT
FunctionEnd
Section "${APP_NAME}" S1
SectionIn RO
SetOutPath $INSTDIR
File "x64\Release\${APP_NAME}.exe"
WriteUninstaller "$INSTDIR\${APP_NAME} Uninstaller.exe"
WriteRegStr SHCTX "${REG_KEY}" "DisplayName" "${APP_NAME}"
WriteRegStr SHCTX "${REG_KEY}" "InstallLocation" "$INSTDIR"
WriteRegStr SHCTX "${REG_KEY}" "Publisher" "Brandon Fowler"
WriteRegDWORD SHCTX "${REG_KEY}" "NoModify" "1"
WriteRegDWORD SHCTX "${REG_KEY}" "NoRepair" "1"
WriteRegStr SHCTX "${REG_KEY}" "UninstallString" '"$INSTDIR\${APP_NAME} Uninstaller.exe"'
WriteRegStr SHCTX "${REG_KEY}" "DisplayIcon" "$INSTDIR\${APP_NAME}.exe"
SectionEnd
Section "Add To Start Menu" S2
CreateShortcut "$SMPROGRAMS\${APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe"
SectionEnd
Section "Create Desktop Shortcut" S3
CreateShortcut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe"
SectionEnd
Section "Run On Startup" S4
CreateShortcut "$SMSTARTUP\${APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe"
SectionEnd
Section "Uninstall"
RMDir /r /REBOOTOK $INSTDIR
Delete "$SMPROGRAMS\${APP_NAME}.lnk"
Delete "$SMSTARTUP\${APP_NAME}.lnk"
Delete "$DESKTOP\${APP_NAME}.lnk"
DeleteRegKey SHCTX "${REG_KEY}"
SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${S1} "Install ${APP_NAME} and its core file(s)"
!insertmacro MUI_DESCRIPTION_TEXT ${S2} "Add a shortcut to ${APP_NAME} to the Start Menu"
!insertmacro MUI_DESCRIPTION_TEXT ${S3} "Add a shortcut to ${APP_NAME} to the Desktop folder"
!insertmacro MUI_DESCRIPTION_TEXT ${S4} "Run ${APP_NAME} on startup"
!insertmacro MUI_FUNCTION_DESCRIPTION_END