EDU installer for windows: download jre x86.

This commit is contained in:
Vladimir.Orlov
2016-12-27 15:47:23 +03:00
parent ef5bee12bc
commit ec2b33c96b
2 changed files with 39 additions and 28 deletions
@@ -1,5 +1,5 @@
!include "TextFunc.nsh"
!define INSTALL_OPTION_ELEMENTS 7
!define INSTALL_OPTION_ELEMENTS 8
!define PYTHON_VERSIONS 4
${StrTok}
@@ -16,29 +16,29 @@ getPythonFileInfo:
cantOpenFile:
MessageBox MB_OK|MB_ICONEXCLAMATION "python.txt is not exist. Python will not be downloaded."
removePythonChoice:
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 5" "Flags" "DISABLED"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 6" "Flags" "DISABLED"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 7" "Flags" "DISABLED"
goto done
getPythonInfo:
Call getPythonInfo
StrCmp $0 "Error" removePythonChoice
;check if pythons are already installed
; check if pythons are already installed
StrCpy $R2 $0
Call searchPython
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 5" "Text" "Python $0"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 6" "Text" "Python $0"
StrCmp $R2 "Absent" checkPython3
StrCpy $R2 $0
StrCpy $R4 "Field 5"
StrCpy $R5 "Field 6"
StrCpy $R4 "Field 6"
StrCpy $R5 "Field 7"
Call updatePythonControls
checkPython3:
StrCpy $R2 $R0
Call searchPython
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 6" "Text" "Python $R0"
!insertmacro INSTALLOPTIONS_WRITE "Desktop.ini" "Field 7" "Text" "Python $R0"
StrCmp $R2 "Absent" done
StrCpy $R2 $R0
StrCpy $R4 "Field 6"
StrCpy $R5 "Field 5"
StrCpy $R4 "Field 7"
StrCpy $R5 "Field 6"
Call updatePythonControls
done:
FunctionEnd
@@ -46,14 +46,15 @@ FunctionEnd
Function customInstallActions
${LineSum} "$TEMP\python.txt" $R0
IfErrors cantOpenFile
StrCmp $R0 ${PYTHON_VERSIONS} getPythonInfo ;info about 2 and 3 version of python
; info about 2 and 3 version of python
StrCmp $R0 ${PYTHON_VERSIONS} getPythonInfo
cantOpenFile:
MessageBox MB_OK|MB_ICONEXCLAMATION "python.txt is invalid. Python will not be downloaded."
goto skip_python_download
getPythonInfo:
Call getPythonInfo
StrCmp $0 "Error" skip_python_download
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 5" "State"
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 6" "State"
StrCpy $R8 "$0.msi"
StrCpy $R9 "/quiet /qn /norestart"
StrCmp $R2 1 "" python3
@@ -61,7 +62,7 @@ getPythonInfo:
StrCpy $R3 $1
goto check_python
python3:
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 6" "State"
!insertmacro INSTALLOPTIONS_READ $R2 "Desktop.ini" "Field 7" "State"
StrCpy $R8 "$R0.exe"
StrCpy $R9 "InstallAllUsers=1 /quiet"
StrCmp $R2 1 "" skip_python_download
@@ -78,12 +79,12 @@ verefy_python_launcher:
IfFileExists $1python.exe python_exists get_python
get_python:
CreateDirectory "$INSTDIR\python"
inetc::get "$R3" "$INSTDIR\python\python_$R8"
inetc::get "$R3" "$INSTDIR\python\python_$R8" /END
Pop $0
${If} $0 == "OK"
ExecCmd::exec '"$INSTDIR\python\python_$R8" $R9'
${Else}
MessageBox MB_OK|MB_ICONEXCLAMATION "The download is failed"
MessageBox MB_OK|MB_ICONEXCLAMATION "The download is failed: $0"
${EndIf}
python_exists:
skip_python_download:
@@ -101,19 +102,20 @@ FunctionEnd
Function getPythonInfo
ClearErrors
FileOpen $3 $Temp\python.txt r
IfErrors cantOpenFile ;file can not be open.
; file can not be open.
IfErrors cantOpenFile
${If} ${RunningX64}
goto getPythonInfo
${Else}
FileRead $3 $4
FileRead $3 $4
${EndIf}
;get python2 info
; get python2 info
getPythonInfo:
FileRead $3 $4
${StrTok} $0 $4 " " "1" "1"
${StrTok} $1 $4 " " "2" "1"
;get python3 info
; get python3 info
FileRead $3 $4
${StrTok} $R0 $4 " " "1" "1"
${StrTok} $R1 $4 " " "2" "1"
@@ -125,7 +127,7 @@ done:
FunctionEnd
Function searchPython
;$R2 - version of python
; $R2 - version of python
ReadRegStr $1 "HKCU" "Software\Python\PythonCore\$R2\InstallPath" ""
StrCmp $1 "" CU_32bit verifyPythonLauncher
CU_32bit:
+19 -10
View File
@@ -1,5 +1,5 @@
[Settings]
NumFields=7
NumFields=8
[Field 1]
Type=GroupBox
@@ -27,6 +27,15 @@ Text=""
State=0
[Field 4]
Type=Label
Text=""
Left=5
Right=-1
Top=123
Bottom=133
State=0
[Field 5]
Type=GroupBox
Left=1
Right=-1
@@ -34,7 +43,7 @@ Top=45
Bottom=75
Text=Choose Python version
[Field 5]
[Field 6]
Type=RadioButton
Left=5
Right=100
@@ -43,7 +52,7 @@ Bottom=70
State=1
Text=Python 2
[Field 6]
[Field 7]
Type=RadioButton
Left=120
Right=-1
@@ -52,7 +61,7 @@ Bottom=70
State=0
Text=Python 3
[Field 7]
[Field 8]
Type=GroupBox
Left=1
Right=-1
@@ -60,7 +69,7 @@ Top=80
Bottom=110
Text=Create associations
[Field 8]
[Field 9]
Type=checkbox
Left=5
Right=45
@@ -68,7 +77,7 @@ Top=95
Bottom=105
State=0
[Field 9]
[Field 10]
Type=checkbox
Left=50
Right=90
@@ -76,7 +85,7 @@ Top=95
Bottom=105
State=0
[Field 10]
[Field 11]
Type=checkbox
Left=95
Right=135
@@ -84,7 +93,7 @@ Top=95
Bottom=105
State=0
[Field 11]
[Field 12]
Type=checkbox
Left=140
Right=180
@@ -92,7 +101,7 @@ Top=95
Bottom=105
State=0
[Field 12]
[Field 13]
Type=checkbox
Left=185
Right=225
@@ -100,7 +109,7 @@ Top=95
Bottom=105
State=0
[Field 13]
[Field 14]
Type=checkbox
Left=230
Right=270