This repository has been archived by the owner on Jul 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
liquorcabinet.nsi
143 lines (102 loc) · 3.28 KB
/
liquorcabinet.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
!include "MUI.nsh"
outFile "Installer.exe"
!define PRODUCT_NAME "Liquor Cabinet"
!define PRODUCT_VERSION "0.0.1-alpha4"
!define PRODUCT_PUBLISHER "C Nelson"
name "${PRODUCT_NAME}"
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
LicenseText "GPLv3"
LicenseData "LICENSE"
InstallDirRegKey HKCU "Software\${PRODUCT_NAME}" ""
RequestExecutionLevel user
#Get Python:
Var PythonDirectory
!define PythonExecutable "$PythonDirectory\pythonw.exe"
Function findPython
ReadRegStr $9 HKLM "SOFTWARE\Python\PythonCore\2.7\InstallPath" ""
StrCmp $9 "" tryPython26 ok
tryPython26:
ReadRegStr $9 HKLM "SOFTWARE\Python\PythonCore\2.6\InstallPath" ""
StrCmp $9 "" oops ok
oops:
MessageBox MB_YESNO "Download and Install Python?" /SD IDYES IDNO done
NSISdl::download "http://python.org/ftp/python/2.7.1/python-2.7.1.msi" "$INSTDIR\python.msi"
ExecWait '"msiexec" /i "$INSTDIR\python.msi"'
ReadRegStr $9 HKLM "SOFTWARE\Python\PythonCore\2.7\InstallPath" ""
StrCmp $9 "" done ok
ok:
StrCpy $PythonDirectory $9
done:
FunctionEnd
!define MUI_ABORTWARNING
#!define MUI_ICON "resources\bottle.png"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
Var StartMenuFolder
!insertmacro MUI_PAGE_STARTMENU "Application" $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
#Page license
#Page components
#Page directory
#Page instfiles
#UninstPage uninstConfirm
#UninstPage uninstfiles
Section "${PRODUCT_NAME}"
SectionIn RO
SetOutPath "$INSTDIR\"
File *.py
File CREDITS
File LICENSE
File README.md
File liquor_cabinet.bat
SetOutPath "$INSTDIR\resources\"
File /r "resources\*"
SetOutPath "$INSTDIR\Cheetah\"
File /r "Cheetah\*"
SetOutPath "$INSTDIR\sqlalchemy\"
File /r "sqlalchemy\*"
WriteRegStr HKCU "Software\${PRODUCT_NAME}" "" $INSTDIR
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Python"
Call findPython
SectionEnd
Section "PyQt"
ExecWait '"${PythonExecutable}" -c "import PyQt4"' $0
StrCmp $0 "0" done installPyQt4
installPyQt4:
NSISdl::download "http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-Py2.7-gpl-4.8.1-1.exe" "$INSTDIR\pyqt4.exe"
ExecWait '"$INSTDIR\pyqt4.exe"'
done:
SectionEnd
Section "StartMenu Shortcuts"
SetOutPath "$INSTDIR\"
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}\"
createShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" ${PythonExecutable} "guiclient.py"
createShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Uninstall"
Delete "$INSTDIR\*.py"
Delete "$INSTDIR\CREDITS"
Delete "$INSTDIR\LICENSE"
Delete "$INSTDIR\README.md"
Delete "$INSTDIR\liquor_cabinet.bat"
Delete "$INSTDIR\resources\*"
RMDir "$INSTDIR\resources\"
Delete "$INSTDIR\Cheetah\*"
RMDir "$INSTDIR\Cheetah\"
Delete "$INSTDIR\sqlalchemy\*"
RMDir "$INSTDIR\sqlalchemy\"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
RMDir "$SMPROGRAMS\${PRODUCT_NAME}\"
DeleteRegKey /ifempty HKCU "Software\${PRODUCT_NAME}"
SectionEnd