From dec6ccd1e18855a8bcd24b1e916714d2a8d4a841 Mon Sep 17 00:00:00 2001 From: xiaoniao Date: Tue, 6 Aug 2024 17:36:23 +0800 Subject: [PATCH 1/2] Update main.py --- main.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 197fca1..ce1832e 100644 --- a/main.py +++ b/main.py @@ -12,6 +12,7 @@ import subprocess import signal import threading from time import sleep +import platform # PyGObject @@ -34,6 +35,7 @@ from gi.repository import Gdk GObject.type_ensure(Handy.ActionRow) installedcheck = False +computer_cpu_platform = platform.machine() def resource_path(relative_path): global installedcheck @@ -275,10 +277,30 @@ class SplashScreen(Handy.Window): CheckRun = subprocess.run(command, shell=True) if not os.path.isfile(f"{(altlinuxpath)}/anisette-server"): self.lbl1.set_text("Downloading anisette-server...") - r = requests.get( - "https://github.com/vyvir/AltLinux/releases/download/v0.5.0/anisette-server-x86_64", - allow_redirects=True, - ) + if computer_cpu_platform.find('AMD64') != -1: + r = requests.get( + "https://github.com/vyvir/AltLinux/releases/download/v0.5.0/anisette-server-x86_64", + allow_redirects=True, + ) + elif computer_cpu_platform.find('v8') != -1 or computer_cpu_platform.find('ARM64') != -1 or computer_cpu_platform.find('v8') != -1: + #Thanks, Dadoum for the anisette server! + #or vyvir, do not forget to upload ur version of server. + r = requests.get( + "https://github.com/Dadoum/Provision/releases/download/2.2.0/anisette-server-aarch64", + allow_redirects=True + ) + elif computer_cpu_platform.find('v7') != -1 or computer_cpu_platform.find('ARM') != -1 or computer_cpu_platform.find('hf') != -1: + r = requests.get( + "https://github.com/Dadoum/Provision/releases/download/2.2.0/anisette-server-armv7", + allow_redirects=True + ) + else: + print('WARNING: YOUR CPU IS NOT SUPPORTED, THE PROGRAM MAY NOT WORK!') + #ooops, just download x86-64 ver + r = requests.get( + "https://github.com/vyvir/AltLinux/releases/download/v0.5.0/anisette-server-x86_64", + allow_redirects=True, + ) open(f"{(altlinuxpath)}/anisette-server", "wb").write(r.content) subprocess.run(f"chmod +x {(altlinuxpath)}/anisette-server", shell=True) subprocess.run(f"chmod 755 {(altlinuxpath)}/anisette-server", shell=True) @@ -303,7 +325,7 @@ class SplashScreen(Handy.Window): silentremove(f"{(altlinuxpath)}/am.apk") self.loadaltlinux.set_fraction(0.4) self.lbl1.set_text("Starting anisette-server...") - subprocess.run(f"cd {(altlinuxpath)} && ./anisette-server &", shell=True)#-n 127.0.0.1 -p 6969 &", shell=True) + subprocess.run(f"cd {(altlinuxpath)} && ./anisette-server &", shell=True)#-n 127.0.0.1 -p 6969 &", shell=True self.loadaltlinux.set_fraction(0.5) finished = False while not finished: @@ -315,10 +337,35 @@ class SplashScreen(Handy.Window): if not os.path.isfile(f"{(altlinuxpath)}/AltServer"): self.lbl1.set_text("Downloading AltServer...") self.loadaltlinux.set_fraction(0.6) + + """ r = requests.get( "https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-x86_64", allow_redirects=True, ) + """ + if computer_cpu_platform.find('AMD64') != -1: + r = requests.get( + "https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-x86_64", + allow_redirects=True, + ) + elif computer_cpu_platform.find('v8') != -1 or computer_cpu_platform.find('v9') != -1 or computer_cpu_platform.find('ARM64') != -1: + r = requests.get( + "https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-aarch64", + allow_redirects=True + ) + elif computer_cpu_platform.find('v7') != -1 or computer_cpu_platform.find('ARM') != -1 or computer_cpu_platform.find('hf') != -1: + r = requests.get( + "https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-armv7", + allow_redirects=True + ) + else: + print('WARNING: YOUR CPU IS NOT SUPPORTED, AltServer MAY NOT WORK!') + #ooops, just download x86-64 ver + r = requests.get( + "https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-x86_64", + allow_redirects=True, + ) open(f"{(altlinuxpath)}/AltServer", "wb").write(r.content) subprocess.run(f"chmod +x {(altlinuxpath)}/AltServer", shell=True) subprocess.run(f"chmod 755 {(altlinuxpath)}/AltServer", shell=True) From c269de2207b98fde769de30a990081459164c034 Mon Sep 17 00:00:00 2001 From: xiaoniao Date: Tue, 6 Aug 2024 17:48:16 +0800 Subject: [PATCH 2/2] Fixed arm64 problem --- main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index ce1832e..d9d0c31 100644 --- a/main.py +++ b/main.py @@ -277,18 +277,19 @@ class SplashScreen(Handy.Window): CheckRun = subprocess.run(command, shell=True) if not os.path.isfile(f"{(altlinuxpath)}/anisette-server"): self.lbl1.set_text("Downloading anisette-server...") - if computer_cpu_platform.find('AMD64') != -1: + if computer_cpu_platform == 'AMD64': r = requests.get( "https://github.com/vyvir/AltLinux/releases/download/v0.5.0/anisette-server-x86_64", allow_redirects=True, ) - elif computer_cpu_platform.find('v8') != -1 or computer_cpu_platform.find('ARM64') != -1 or computer_cpu_platform.find('v8') != -1: + elif computer_cpu_platform == "aarch64": #Thanks, Dadoum for the anisette server! #or vyvir, do not forget to upload ur version of server. r = requests.get( "https://github.com/Dadoum/Provision/releases/download/2.2.0/anisette-server-aarch64", allow_redirects=True ) + #sorry i dont know what will arm32 output elif computer_cpu_platform.find('v7') != -1 or computer_cpu_platform.find('ARM') != -1 or computer_cpu_platform.find('hf') != -1: r = requests.get( "https://github.com/Dadoum/Provision/releases/download/2.2.0/anisette-server-armv7", @@ -344,12 +345,12 @@ class SplashScreen(Handy.Window): allow_redirects=True, ) """ - if computer_cpu_platform.find('AMD64') != -1: + if computer_cpu_platform == 'AMD64': r = requests.get( "https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-x86_64", allow_redirects=True, ) - elif computer_cpu_platform.find('v8') != -1 or computer_cpu_platform.find('v9') != -1 or computer_cpu_platform.find('ARM64') != -1: + elif computer_cpu_platform == 'aarch64': r = requests.get( "https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-aarch64", allow_redirects=True