Just open Java download URL in Win-Installer

Previously, the installer downloaded Java and installed a Desktop
shortcut to the downloaded installer. However the old download
URL is dead now and NSIS does not support the new https URLs
without a plugin.

Anyways it is not much of a difference in convenience whether the
installer downloads an installer or opens a browser with the
download location.

It has been considered to switch from NSIS to msitools[1]. However
both technologies are strange to all current YaCy devs and NSIS
still seems to be less complex and more widely adopted.

[1] https://wiki.gnome.org/msitools

I could only test this change in WINE because the developer virtual
machine from microsoft[2] freezed always soon after boot under QEMU.

[2] https://developer.microsoft.com/de-de/windows/downloads/virtual-machines/

The browser did not open under WINE.
pull/488/head
Thomas Koch 2 years ago
parent c98d09b664
commit aa23167e87

@ -56,20 +56,6 @@ RequestExecutionLevel admin
SetCompressor /SOLID LZMA
!insertmacro MUI_RESERVEFILE_LANGDLL ;loads faster
; ----------------------------------------
; JAVA VERSION
; http://www.java.com/de/download/manual.jsp BundleId +1 / +2
; User-Agent to see the 64bit link: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Win64; x64; Trident/4.0)
; at least we need Java 8
!define JRE_VERSION8 "1.8"
; download links for Oracle Java 8 Update 211 (available at https://java.com/en/download/manual.jsp)
; 32 bit / jre-8u211-windows-i586.exe
!define JRE_32 "http://javadl.oracle.com/webapps/download/AutoDL?BundleId=238727_478a62b7d4e34b78b671c754eaaf38ab"
; 64 bit / jre-8u211-windows-x64.exe
!define JRE_64 "http://javadl.oracle.com/webapps/download/AutoDL?BundleId=238729_478a62b7d4e34b78b671c754eaaf38ab"
; ----------------------------------------
; GENERAL APPEARANCE
@ -123,33 +109,59 @@ ComponentText "YaCy v@REPL_VERSION@"
LangString stillRunning ${LANG_ENGLISH} "YaCy is still active. Please stop YaCy first."
LangString keepData 0 "Do you want to keep the data?"
LangString noAdminForJava 0 "You need Administrator privileges to install Java. Java will now be downloaded to the shared documents folder. YaCy won't run without Java."
LangString finishPage 0 "Show how to configure the Windows Firewall for YaCy."
LangString yacyNoHd 0 "YaCy should be installed on a hard disk. Continue with selected folder?"
LangString yacyNeedSpace 0 "We recommend ${RecommendSpace} GB free space for YaCy. There are only $TempDriveFree GB left. Continue anyway?"
LangString yacyNeedOs 0 "Please run Windows 2000 or better (e.g. Windows XP, Vista or Windows 7) for YaCy."
LangString yacyNoJavaFoundOpenBrowser ${LANG_ENGLISH} "Java 8 has not been found in the Windows registry!$\r$\n(Key: SOFTWARE\JavaSoft\Java Runtime Environment)$\r$\nOpen download location (adoptium.net) in Browser?"
LangString yacyNoJavaFoundContinue ${LANG_ENGLISH} "Click Retry to check again for installed Java version!"
LangString stillRunning ${LANG_FRENCH} "YaCy is still active. Please stop YaCy first."
LangString keepData 0 "Do you want to keep the data?"
LangString noAdminForJava 0 "You need Administrator privileges to install Java. Java will now be downloaded to the shared documents folder. YaCy won't run without Java."
LangString finishPage 0 "Show how to configure the Windows Firewall for YaCy."
LangString yacyNoHd 0 "YaCy should be installed on a hard disk. Continue with selected folder?"
LangString yacyNeedSpace 0 "We recommend ${RecommendSpace} GB free space for YaCy. There are only $TempDriveFree GB left. Continue anyway?"
LangString yacyNeedOs 0 "Please run Windows 2000 or better (e.g. Windows XP, Vista or Windows 7) for YaCy."
LangString yacyNoJavaFoundOpenBrowser 0 "Java 8 has not been found in the Windows registry!$\r$\n(Key: SOFTWARE\JavaSoft\Java Runtime Environment)$\r$\nOpen download location (adoptium.net) in Browser?"
LangString yacyNoJavaFoundContinue 0 "Click Retry to check again for installed Java version!"
LangString stillRunning ${LANG_GERMAN} "YaCy ist noch aktiv. Bitte beenden Sie YaCy."
LangString keepData 0 "Moechten Sie die Daten behalten?"
LangString noAdminForJava 0 "Sie benoetigen Administrator-Rechte um Java zu installieren. Java wird nun in 'Gemeinsame Dokumente' gespeichert. YaCy benoetigt Java zur Ausfuehrung."
LangString finishPage 0 "Zeige die Windows Firewall Konfiguration fuer YaCy."
LangString yacyNoHd 0 "YaCy sollte auf einer Festplatte installiert werden. Soll der gewaehlte Ordner trotzdem verwendet werden?"
LangString yacyNeedSpace 0 "Wir empfehlen ${RecommendSpace} GB fuer YaCy. Es sind noch $TempDriveFree GB frei. Trotzdem fortfahren?"
LangString yacyNeedOs 0 "YaCy benoetigt Windows 2000 oder besser (z.B. Windows XP, Vista oder Windows 7)."
LangString yacyNoJavaFoundOpenBrowser 0 "Java 8 has not been found in the Windows registry!$\r$\n(Key: SOFTWARE\JavaSoft\Java Runtime Environment)$\r$\nOpen download location (adoptium.net) in Browser?"
LangString yacyNoJavaFoundContinue 0 "Click Retry to check again for installed Java version!"
; ----------------------------------------
; INSTALLABLE MODULES
;InstType "Normal"
Section "check Java 8 installed" Sec_Java_id
SectionIn 1 RO
SetShellVarContext current
; init of JRE section
; detect JRE first
var /global InstalledJREVersion
${If} ${RunningX64}
SetRegView 64
${EndIf}
Retry:
ReadRegStr $InstalledJREVersion HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
${If} $InstalledJREVersion != "1.8"
MessageBox MB_ICONEXCLAMATION|MB_YESNO "$(yacyNoJavaFoundOpenBrowser)" IDNO ContinueWithoutJava
ExecShell open "https://adoptium.net/de/temurin/releases/?version=8"
MessageBox MB_ICONEXCLAMATION|MB_ABORTRETRYIGNORE "$(yacyNoJavaFoundContinue)" IDIGNORE ContinueWithoutJava IDRETRY Retry
Abort
${EndIf}
ContinueWithoutJava:
SectionEnd
Section "YaCy"
SectionIn 1 RO
SetShellVarContext current ; use system variables (folders) for current user
@ -171,12 +183,6 @@ Section "YaCy"
WriteUninstaller "uninstall.exe"
SectionEnd
Section "Java (Oracle JRE)" Sec_Java_id
SectionIn 1 RO
SetShellVarContext current
Call GetJRE
SectionEnd
Section "Start Menu Group"
SectionIn 1
SetShellVarContext current
@ -259,19 +265,6 @@ Function .onInit
Abort
${EndIf}
; init of JRE section
; detect JRE first
var /global InstalledJREVersion
${If} ${RunningX64}
SetRegView 64
${EndIf}
ReadRegStr $InstalledJREVersion HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
; if right JRE already installed hide and deselect JRE section
${If} $InstalledJREVersion = ${JRE_VERSION8}
SectionSetText ${Sec_Java_id} ""
SectionSetFlags ${Sec_Java_id} 0
${EndIf}
; init of Firewall section, only valid for WindowsXP SP2/SP3 and Vista/Win 7 with Admin
var /global FirewallServiceStart
IntOp $FirewallServiceStart 3 + 0
@ -302,41 +295,6 @@ Function .onInit
${EndIf}
FunctionEnd
Function GetJRE
; based on http://nsis.sourceforge.net/Simple_Java_Runtime_Download_Script
${If} ${RunningX64}
StrCpy $3 ${JRE_64}
${Else}
StrCpy $3 ${JRE_32}
${EndIf}
;check if admin before download, advise if non
userInfo::getAccountType
Pop $0
${IfNot} $0 = "Admin"
MessageBox MB_ICONEXCLAMATION "$(noAdminForJava)" /SD IDOK
${EndIf}
SetShellVarContext all
StrCpy $2 "$DOCUMENTS\Java Runtime (install for YaCy).exe"
SetShellVarContext current
nsisdl::download /TIMEOUT=30000 $3 $2
Pop $R0 ;Get the return value
${IfNot} $R0 = "success"
MessageBox MB_OK "Download failed: $R0" /SD IDOK
Return
${EndIf}
${If} $0 == "Admin"
ExecWait "$2 /s"
Delete $2
${Else}
CreateShortCut "$DESKTOP\Install Java for YaCy.lnk" "$2"
${EndIf}
FunctionEnd
Function CheckDriveSpace
var /global RootFolder
var /global TempDriveFree

Loading…
Cancel
Save