Skip to content

Commit be380bb

Browse files
committed
merge in nsis installer code
2 parents 5b8a1af + 85be9f5 commit be380bb

File tree

7 files changed

+141
-1
lines changed

7 files changed

+141
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,6 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
# NSIS Output
132+
installer/*.exe
File renamed without changes.
File renamed without changes.

installer/assets/header.bmp

25.7 KB
Binary file not shown.

installer/assets/wizard.bmp

151 KB
Binary file not shown.

installer/awake.nsi

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
; includes
2+
!include "MUI2.nsh"
3+
!include "nsDialogs.nsh"
4+
!include "LogicLib.nsh"
5+
!include "x64.nsh"
6+
!include "FileFunc.nsh"
7+
8+
; defines
9+
!define $PRODUCT_NAME "Awake"
10+
!define $APPVERSION "v0.5.1"
11+
!define $PRODUCT_PUBLISHER "adambonneruk"
12+
!define $ICON_PATH "..\src\assets\awake.ico"
13+
!define $REG_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\Awake"
14+
15+
; compiler options
16+
RequestExecutionLevel admin
17+
SetCompressor /SOLID lzma
18+
Unicode True
19+
20+
; settings
21+
Name "${$PRODUCT_NAME} ${$APPVERSION}"
22+
OutFile "Awake Installer (${$APPVERSION}).exe"
23+
BrandingText "${$PRODUCT_PUBLISHER}"
24+
25+
; gui configuration
26+
!define MUI_ICON ${$ICON_PATH}
27+
!define MUI_UNICON ${$ICON_PATH}
28+
!define MUI_ABORTWARNING ; "are you sure you want to quit?" prompt
29+
!define MUI_WELCOMEFINISHPAGE_BITMAP "assets\wizard.bmp"
30+
!define MUI_HEADERIMAGE
31+
!define MUI_HEADERIMAGE_BITMAP ".\assets\header.bmp"
32+
!define MUI_COMPONENTSPAGE_SMALLDESC ; show small description for each component
33+
34+
; mui2 macros/pages
35+
!insertmacro MUI_PAGE_WELCOME
36+
!insertmacro MUI_PAGE_LICENSE "..\LICENCE"
37+
!insertmacro MUI_PAGE_DIRECTORY
38+
!insertmacro MUI_PAGE_COMPONENTS
39+
!insertmacro MUI_PAGE_INSTFILES
40+
!insertmacro MUI_UNPAGE_CONFIRM
41+
!insertmacro MUI_UNPAGE_INSTFILES
42+
!insertmacro MUI_LANGUAGE "English"
43+
44+
;installer sections
45+
Section "Base Files" SecBaseFiles
46+
47+
SectionIn RO ; read-only
48+
SetOutPath $INSTDIR
49+
DetailPrint "Cleaning install directory"
50+
RMDIR /r $INSTDIR\*.* ; clean the installation directory
51+
52+
; copy files given x86 or x86-64 operating system
53+
${If} ${RunningX64}
54+
DetailPrint "64-Bit Mode"
55+
File /r ..\dist\awake\*.*
56+
${else}
57+
DetailPrint "32-Bit Mode"
58+
File /r ..\dist\awake\*.*
59+
${EndIf}
60+
61+
; add uninstaller entry to the add/remove programs control panel
62+
WriteRegStr HKLM "${$REG_PATH}" "DisplayName" "${$PRODUCT_NAME}"
63+
WriteRegStr HKLM "${$REG_PATH}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
64+
WriteRegStr HKLM "${$REG_PATH}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
65+
WriteRegStr HKLM "${$REG_PATH}" "DisplayIcon" "$\"$INSTDIR\assets\awake.ico$\""
66+
WriteRegStr HKLM "${$REG_PATH}" "DisplayVersion" "${$APPVERSION}"
67+
WriteRegStr HKLM "${$REG_PATH}" "Publisher" "${$PRODUCT_PUBLISHER}" ; Not show in Windows 10
68+
WriteRegDWORD HKLM "${$REG_PATH}" "EstimatedSize" 26986 ; Calculated size based on v0.5.0
69+
WriteRegDWORD HKLM "${$REG_PATH}" "NoModify" 1
70+
WriteRegDWORD HKLM "${$REG_PATH}" "NoRepair" 1
71+
72+
; create uninstaller
73+
WriteUninstaller "$INSTDIR\uninstall.exe"
74+
75+
SectionEnd
76+
77+
Section "Start Menu Shortcuts" SecStartMenu
78+
79+
DetailPrint "Creating Start Menu Shortcuts"
80+
CreateDirectory "$SMPROGRAMS\Awake"
81+
CreateShortcut "$SMPROGRAMS\Awake\${$PRODUCT_NAME}.lnk" "$INSTDIR\Awake.exe"
82+
CreateShortcut "$SMPROGRAMS\Awake\Uninstall.lnk" "$INSTDIR\uninstall.exe"
83+
84+
SectionEnd
85+
86+
Section "Desktop Shortcut" SecDeskShort
87+
88+
DetailPrint "Creating Desktop Shortcut"
89+
CreateShortcut "$DESKTOP\${$PRODUCT_NAME}.lnk" "$INSTDIR\Awake.exe" "" "$INSTDIR\assets\awake.ico" 0
90+
91+
SectionEnd
92+
93+
Function .onInit
94+
95+
; set install folder given x86 or x86-64 operating system
96+
${If} ${RunningX64}
97+
StrCpy $INSTDIR "$PROGRAMFILES64\Awake"
98+
SetRegView 64
99+
${else}
100+
StrCpy $INSTDIR "$PROGRAMFILES\Awake"
101+
SetRegView 32
102+
${EndIf}
103+
104+
FunctionEnd
105+
106+
; component descriptions
107+
LangString DESC_SecBaseFiles ${LANG_ENGLISH} "Install the Awake program and all dependencies"
108+
LangString DESC_SecStartMenu ${LANG_ENGLISH} "Install Windows Start Menu shortcuts"
109+
LangString DESC_SecDeskShort ${LANG_ENGLISH} "Install Windows desktop shortcut"
110+
111+
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
112+
!insertmacro MUI_DESCRIPTION_TEXT ${SecBaseFiles} $(DESC_SecBaseFiles)
113+
!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu)
114+
!insertmacro MUI_DESCRIPTION_TEXT ${SecDeskShort} $(DESC_SecDeskShort)
115+
!insertmacro MUI_FUNCTION_DESCRIPTION_END
116+
117+
; configure uninstaller
118+
Section "Uninstall"
119+
120+
RMDIR /r $INSTDIR\*.* ; clean the installation directory
121+
Delete "$DESKTOP\${$PRODUCT_NAME}.lnk" ; delete desktop shortcut
122+
123+
; remove start menu shortcuts
124+
Delete "$SMPROGRAMS\Awake\*.lnk"
125+
RMDir "$SMPROGRAMS\Awake"
126+
127+
; set registry view given x86 or x86-64 operating system
128+
${If} ${RunningX64}
129+
SetRegView 64
130+
${else}
131+
SetRegView 32
132+
${EndIf}
133+
134+
DeleteRegKey HKLM "${$REG_PATH}" ; delete windows add/remove programs key
135+
136+
SectionEnd

tools/make.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import os
2-
os.system("pyinstaller src/awake.spec --noconfirm")
2+
os.system("pyinstaller src/awake.spec --noconfirm")
3+
os.system("makensis installer/awake.nsi")

0 commit comments

Comments
 (0)