-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.nsi
103 lines (73 loc) · 2.81 KB
/
install.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
; -------------------------------
; Start
!define PRODUCT_NAME "PyCraft"
!define MUI_BRANDINGTEXT "PyCraft"
CRCCheck On
; Bij deze moeten we waarschijnlijk een absoluut pad gaan gebruiken
; dit moet effe uitgetest worden.
!include "MUI.nsh"
;---------------------------------
;General
OutFile "pycraft_installer.exe"
ShowInstDetails "nevershow"
ShowUninstDetails "nevershow"
;--------------------------------
;Folder selection page
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
;--------------------------------
;Modern UI Configuration
!define MUI_WELCOMEPAGE
!define MUI_LICENSEPAGE
!define MUI_DIRECTORYPAGE
!define MUI_ABORTWARNING
!define MUI_UNINSTALLER
!define MUI_UNCONFIRMPAGE
!define MUI_FINISHPAGE
;--------------------------------
;Language
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "install" Installation
EnVar::Check "NULL" "NULL"
Pop $0
DetailPrint "EnVar::Check write access HKCU returned=|$0|"
;Add files
SetOutPath "$INSTDIR"
;create desktop shortcut
;CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${MUI_FILE}.exe" ""
;create start-menu items
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
;CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${MUI_FILE}.exe" "" "$INSTDIR\${MUI_FILE}.exe" 0
;write uninstall information to the registry
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteUninstaller "$INSTDIR\Uninstall.exe"
File "dist/windows/main.exe"
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;Delete Files
RMDir /r "$INSTDIR\*.*"
;Remove the installation directory
RMDir "$INSTDIR"
;Delete Start Menu Shortcuts
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*"
RmDir "$SMPROGRAMS\${PRODUCT_NAME}"
;Delete Uninstaller And Unistall Registry Entries
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${PRODUCT_NAME}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
SectionEnd
;--------------------------------
;MessageBox Section
;Function that calls a messagebox when installation finished correctly
Function .onInstSuccess
MessageBox MB_OK "You have successfully installed ${PRODUCT_NAME}. Use the desktop icon to start the program."
FunctionEnd
Function un.onUninstSuccess
MessageBox MB_OK "You have successfully uninstalled ${PRODUCT_NAME}."
FunctionEnd
;eof