mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-15 20:00:00 +10:00
Add Proper .pkg link fallbacks
This commit is contained in:
@@ -34,11 +34,19 @@ jobs:
|
||||
with:
|
||||
name: OCLP-Install.pkg
|
||||
path: ./dist/OCLP-Install.pkg
|
||||
- name: Upload to Release
|
||||
- name: Upload Binary to Release
|
||||
if: github.event_name == 'release'
|
||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: OpenCore-Patcher-GUI-Offline.app.zip
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
- name: Upload Package to Release
|
||||
if: github.event_name == 'release'
|
||||
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ./dist/OCLP-Install.pkg
|
||||
tag: ${{ github.ref }}
|
||||
file_glob: true
|
||||
+17
-3
@@ -1463,9 +1463,23 @@ class wx_python_gui:
|
||||
|
||||
|
||||
def download_and_unzip_pkg(self):
|
||||
# Remove this URL overwrite when released
|
||||
self.constants.installer_pkg_url = "https://github.com/khronokernel/Storage/releases/download/1.0/OCLP-Install.pkg.zip"
|
||||
if utilities.download_file(self.constants.installer_pkg_url, self.constants.installer_pkg_zip_path):
|
||||
# Function's main goal is to grab the correct OCLP-Install.pkg and unzip it
|
||||
# Note the following:
|
||||
# - When running a release build, pull from Github's release page with the same versioning
|
||||
# - When running from source/unable to find on Github, use the nightly.link variant
|
||||
# - If nightly also fails, fall back to the manually uploaded variant
|
||||
link = self.constants.installer_pkg_url
|
||||
if not utilities.validate_link(link):
|
||||
print("- Stock Install.pkg is missing on Github, falling back to Nightly")
|
||||
link = self.constants.installer_pkg_url_nightly
|
||||
if not utilities.validate_link(link):
|
||||
print("- Nightly Install.pkg is missing on Github, falling back to manual backup")
|
||||
link = "https://github.com/khronokernel/Storage/releases/download/1.0/OCLP-Install.pkg.zip"
|
||||
if not utilities.validate_link(link):
|
||||
print("- Manual backup is missing on Github, no more fallbacks remaining. Quitting")
|
||||
return
|
||||
|
||||
if utilities.download_file(link, self.constants.installer_pkg_zip_path):
|
||||
subprocess.run(["unzip", "-o", self.constants.installer_pkg_zip_path, "-d", self.constants.installer_pkg_path])
|
||||
|
||||
def install_installer_pkg(self, disk):
|
||||
|
||||
@@ -24,6 +24,7 @@ class Constants:
|
||||
self.repo_link_latest = f"{self.repo_link}/releases/tag/{self.patcher_version}"
|
||||
self.copyright_date = "Copyright © 2020-2022 Dortania"
|
||||
self.installer_pkg_url = f"{self.repo_link_latest}/OCLP-Install.pkg"
|
||||
self.installer_pkg_url_nightly = "https://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython-offline/main/OCLP-Install.pkg"
|
||||
|
||||
# OpenCore Versioning
|
||||
# https://github.com/acidanthera/OpenCorePkg
|
||||
|
||||
@@ -410,6 +410,16 @@ def monitor_disk_output(disk):
|
||||
output = output[-2]
|
||||
return output
|
||||
|
||||
def validate_link(link):
|
||||
# Check if link is 404
|
||||
try:
|
||||
response = requests.head(link, timeout=5)
|
||||
if response.status_code == 404:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
except (requests.exceptions.Timeout, requests.exceptions.TooManyRedirects, requests.exceptions.ConnectionError, requests.exceptions.HTTPError):
|
||||
return False
|
||||
|
||||
def block_os_updaters():
|
||||
# Disables any processes that would be likely to mess with
|
||||
|
||||
Reference in New Issue
Block a user