Only check for java if -downloadonly isn't defined
This commit is contained in:
parent
90c01b8a8d
commit
2e05cf1501
@ -40,39 +40,40 @@ if not lv["osName"] in ["windows","linux","macos"]:
|
||||
print(colored(colorama.Fore.MAGENTA,"Falling back to assuming Linux."))
|
||||
lv["osName"] = "linux"
|
||||
|
||||
print(colored(colorama.Fore.GREEN,"Checking for Java..."))
|
||||
global javaExe
|
||||
javaExe = whereis(lv["java"])
|
||||
if javaExe == None:
|
||||
print(colored(colorama.Fore.RED,"Java wasn't found at '" +lv["java"]+ "'. Please configure java in config.ini."))
|
||||
sys.exit(1)
|
||||
if not "-downloadonly" in sys.argv:
|
||||
print(colored(colorama.Fore.GREEN,"Checking for Java..."))
|
||||
global javaExe
|
||||
javaExe = whereis(lv["java"])
|
||||
if javaExe == None:
|
||||
print(colored(colorama.Fore.RED,"Java wasn't found at '" +lv["java"]+ "'. Please configure java in config.ini."))
|
||||
sys.exit(1)
|
||||
|
||||
if lv["jvmArch"] == "":
|
||||
print(colored(colorama.Fore.GREEN,"Querying JVM architecture... "),end="")
|
||||
try:
|
||||
if lv["osName"] != "windows":
|
||||
with open(javaExe,"rb") as jh:
|
||||
jh.seek(4)
|
||||
if int.from_bytes(jh.read(1),"little") == 1:
|
||||
lv["jvmArch"] = "x86"
|
||||
print("x86")
|
||||
else:
|
||||
lv["jvmArch"] = "amd64"
|
||||
print("Not x86, assuming amd64")
|
||||
else:
|
||||
with open(javaExe,"rb") as jh:
|
||||
jh.seek(60)
|
||||
jh.seek(int.from_bytes(jh.read(2),"little") + 4)
|
||||
if int.from_bytes(jh.read(2),"little") == 332:
|
||||
lv["jvmArch"] = "x86"
|
||||
print("x86")
|
||||
else:
|
||||
lv["jvmArch"] = "amd64"
|
||||
print("Not x86, assuming amd64")
|
||||
except:
|
||||
print(colored(colorama.Fore.YELLOW,"\nWarning, could not query JVM architecture. Needs to be either amd64 or x86. Define it with jvmArch=arch in the config."),file=sys.stderr)
|
||||
print(colored(colorama.Fore.MAGENTA,"Assuming amd64."))
|
||||
raise
|
||||
if lv["jvmArch"] == "":
|
||||
print(colored(colorama.Fore.GREEN,"Querying JVM architecture... "),end="")
|
||||
try:
|
||||
if lv["osName"] != "windows":
|
||||
with open(javaExe,"rb") as jh:
|
||||
jh.seek(4)
|
||||
if int.from_bytes(jh.read(1),"little") == 1:
|
||||
lv["jvmArch"] = "x86"
|
||||
print("x86")
|
||||
else:
|
||||
lv["jvmArch"] = "amd64"
|
||||
print("Not x86, assuming amd64")
|
||||
else:
|
||||
with open(javaExe,"rb") as jh:
|
||||
jh.seek(60)
|
||||
jh.seek(int.from_bytes(jh.read(2),"little") + 4)
|
||||
if int.from_bytes(jh.read(2),"little") == 332:
|
||||
lv["jvmArch"] = "x86"
|
||||
print("x86")
|
||||
else:
|
||||
lv["jvmArch"] = "amd64"
|
||||
print("Not x86, assuming amd64")
|
||||
except:
|
||||
print(colored(colorama.Fore.YELLOW,"\nWarning, could not query JVM architecture. Needs to be either amd64 or x86. Define it with jvmArch=arch in the config."),file=sys.stderr)
|
||||
print(colored(colorama.Fore.MAGENTA,"Assuming amd64."))
|
||||
raise
|
||||
|
||||
print("")
|
||||
if not "version" in lv: lv["version"] = input("Version ID: ")
|
||||
|
Loading…
Reference in New Issue
Block a user