This repository has been archived by the owner on Jul 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
flashfit.nsis
112 lines (91 loc) · 3.77 KB
/
flashfit.nsis
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
111
112
; flashfit.nsis - Installer script for Windows.
; In Fedora, install mingw32-nsis package and then
; makensis flashfit.nsis
!include "MUI2.nsh"
!include "Sections.nsh"
!include "LogicLib.nsh"
!include "WordFunc.nsh"
; The name of the installer
Name "FlashFit ${PACKAGE_VERSION}"
Caption "FlashFit ${PACKAGE_VERSION}"
; The file to write
OutFile "flashfit-${PACKAGE_VERSION}.exe"
;Interface Settings
!define MUI_ABORTWARNING
; The default installation directory
InstallDir $PROGRAMFILES\FlashFit-${PACKAGE_VERSION}
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\FlashFit${PACKAGE_VERSION}" "Install_Dir"
SetCompressor zlib
; Necessary for correct Vista uninstallation.
RequestExecutionLevel admin
;===============================================================================
; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
;!define MUI_FINISHPAGE_RUN "$INSTDIR\flashfit.pyw"
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
;===============================================================================
; The stuff to install
;
Section "FlashFit (required)"
SectionIn 1 2 3 RO
SetOutPath $INSTDIR
; Set output path to the installation directory.
SetOutPath $INSTDIR
SetOverwrite on
File "*.py"
File /oname=flashfit.pyw "flashfit.py"
File "AUTHORS"
File "COPYING"
File "NEWS"
File "README"
; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\FlashFit${PACKAGE_VERSION}" "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FlashFit${PACKAGE_VERSION}" "DisplayName" "FlashFit ${PACKAGE_VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FlashFit${PACKAGE_VERSION}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FlashFit${PACKAGE_VERSION}" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FlashFit$${PACKAGE_VERSION}" "DisplayVersion" "${PACKAGE_VERSION}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FlashFit${PACKAGE_VERSION}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FlashFit${PACKAGE_VERSION}" "NoRepair" 1
WriteUninstaller "uninstall.exe"
SectionEnd
;===============================================================================
; Optional section (can be disabled by the user)
;
Section "Start Menu Shortcuts"
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\FlashFit ${PACKAGE_VERSION}"
CreateShortCut "$SMPROGRAMS\FlashFit ${PACKAGE_VERSION}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
CreateShortCut "$SMPROGRAMS\FlashFit ${PACKAGE_VERSION}\FlashFit.lnk" "$INSTDIR\flashfit.pyw"
SectionEnd
;===============================================================================
; Uninstaller
;
Section Uninstall
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\FlashFit${PACKAGE_VERSION}"
DeleteRegKey HKLM "Software\FlashFit\FlashFit${PACKAGE_VERSION}"
; Remove files and uninstaller
Delete "$INSTDIR\*.py"
Delete "$INSTDIR\*.pyw"
Delete "$INSTDIR\*.pyc"
Delete "$INSTDIR\AUTHORS"
Delete "$INSTDIR\COPYING"
Delete "$INSTDIR\NEWS"
Delete "$INSTDIR\README"
Delete "$INSTDIR\uninstall.exe"
; Remove shortcuts, if any
SetShellVarContext all
Delete "$SMPROGRAMS\FlashFit ${PACKAGE_VERSION}\*.*"
RMDir "$SMPROGRAMS\FlashFit ${PACKAGE_VERSION}"
; Remove directories used
RMDir $INSTDIR
SectionEnd