-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.nsi
110 lines (83 loc) · 2.92 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
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
; Turn off old selected section
; 26 06 2015: Fadiga Ibrahima
; -------------------------------
; Start
!define MUI_PRODUCT "Example app"
!define MUI_FILE "main"
!define MUI_VERSION "1.3"
!define MUI_BRANDINGTEXT "${MUI_PRODUCT} ${MUI_VERSION}"
!define MEDIA "media"
!define IMAGES "img"
;CRCCheck On
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
;---------------------------------
;General
OutFile "Install-${MUI_PRODUCT} ${MUI_VERSION}.exe"
;ShowInstDetails "nevershow"
;ShowUninstDetails "nevershow"
;SetCompressor off
!define MUI_ICON "logo.ico"
!define MUI_UNICON "logo.ico"
!define MUI_SPECIALBITMAP "Bitmap.bmp"
;--------------------------------
;Folder selection page
InstallDir "C:\${MUI_PRODUCT}"
;--------------------------------
;Data
;LicenseData "README.txt"
;--------------------------------
;Installer Sections
;Section "install" Installation info
Section "install"
;Add files
SetOutPath "$INSTDIR"
; List of files/folders to copy
File /r dist\*.*
File ressources\*.dll
File /r ${IMAGES}
;create desktop shortcut
CreateShortCut "$DESKTOP\${MUI_PRODUCT}.lnk" "$INSTDIR\${MUI_FILE}.exe" parameters "$INSTDIR\${MEDIA}\${IMAGES}\${MUI_ICON}"
;create start-menu items
CreateDirectory "$SMPROGRAMS\${MUI_PRODUCT}"
CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\${MEDIA}\${IMAGES}\${MUI_ICON}" 0
CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT}\${MUI_PRODUCT}.lnk" "$INSTDIR\${MUI_FILE}.exe" "" "$INSTDIR\${MEDIA}\${IMAGES}\${MUI_ICON}" 0
;write uninstall information to the registry
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "DisplayName" "${MUI_PRODUCT} (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;Delete Files
;RMDir /r "$INSTDIR\*.*"
;Remove the installation directory
; RMDir "$INSTDIR"
# now delete installed file
delete $INSTDIR\*.exe
delete $INSTDIR\*.dll
delete $INSTDIR\*.lib
delete $INSTDIR\*.zip
delete $INSTDIR\*.pdf
delete $INSTDIR\*.pyd
RMDir /r $INSTDIR\build
RMDir /r $INSTDIR\${MEDIA}
RMDir /r $INSTDIR\dist
RMDir /r $INSTDIR\tcl
;Delete Start Menu Shortcuts
Delete "$DESKTOP\${MUI_PRODUCT}.lnk"
Delete "$SMPROGRAMS\${MUI_PRODUCT}\*.*"
RmDir "$SMPROGRAMS\${MUI_PRODUCT}"
;Delete Uninstaller And Unistall Registry Entries
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${MUI_PRODUCT}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}"
SectionEnd
;--------------------------------
Function .onInstSuccess
SetOutPath $INSTDIR
ExecShell "" '"$INSTDIR\${MUI_FILE}"'
FunctionEnd
Function un.onUninstSuccess
; MessageBox MB_OK "You have successfully uninstalled ${MUI_PRODUCT}."
FunctionEnd
;eof