mirror of
https://github.com/outbackdingo/OpCore-Simplify.git
synced 2026-01-27 10:19:49 +00:00
Update and add credits for code from SSDTTime
This commit is contained in:
7
OpCore-Simplify.bat
Executable file → Normal file
7
OpCore-Simplify.bat
Executable file → Normal file
@@ -1,3 +1,5 @@
|
||||
# Source: https://github.com/corpnewt/SSDTTime/blob/97a3963e40a153a8df5ae61a73e150cd7a119b3c/SSDTTime.bat
|
||||
|
||||
@echo off
|
||||
REM Get our local path before delayed expansion - allows ! in path
|
||||
set "thisDir=%~dp0"
|
||||
@@ -310,11 +312,12 @@ if "!args!"=="" (
|
||||
)
|
||||
if /i "!pause_on_error!" == "yes" (
|
||||
if not "%ERRORLEVEL%" == "0" (
|
||||
echo.
|
||||
echo Script exited with error code: %ERRORLEVEL%
|
||||
echo.
|
||||
echo Press [enter] to exit...
|
||||
pause > nul
|
||||
)
|
||||
echo Press Enter to exit...
|
||||
pause > nul
|
||||
)
|
||||
goto :EOF
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
# Source: https://github.com/corpnewt/SSDTTime/blob/97a3963e40a153a8df5ae61a73e150cd7a119b3c/SSDTTime.command
|
||||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Get the curent directory, the script name
|
||||
# and the script name with "py" substituted for the extension.
|
||||
args=( "$@" )
|
||||
dir="${0%/*}"
|
||||
dir="$(cd -- "$(dirname "$0")" >/dev/null 2>&1; pwd -P)"
|
||||
script="${0##*/}"
|
||||
target="${script%.*}.py"
|
||||
|
||||
@@ -13,6 +15,10 @@ target="${script%.*}.py"
|
||||
# FORCE = Use py3
|
||||
use_py3="TRUE"
|
||||
|
||||
# We'll parse if the first argument passed is
|
||||
# --install-python and if so, we'll just install
|
||||
just_installing="FALSE"
|
||||
|
||||
tempdir=""
|
||||
|
||||
compare_to_version () {
|
||||
@@ -55,7 +61,7 @@ set_use_py3_if () {
|
||||
get_remote_py_version () {
|
||||
local pyurl= py_html= py_vers= py_num="3"
|
||||
pyurl="https://www.python.org/downloads/macos/"
|
||||
py_html="$(curl -L $pyurl 2>&1)"
|
||||
py_html="$(curl -L $pyurl --compressed 2>&1)"
|
||||
if [ -z "$use_py3" ]; then
|
||||
use_py3="TRUE"
|
||||
fi
|
||||
@@ -84,7 +90,7 @@ download_py () {
|
||||
echo "Located Version: $vers"
|
||||
echo
|
||||
echo "Building download url..."
|
||||
url="$(curl -L https://www.python.org/downloads/release/python-${vers//./}/ 2>&1 | grep -iE "python-$vers-macos.*.pkg\"" | awk -F'"' '{ print $2 }')"
|
||||
url="$(curl -L https://www.python.org/downloads/release/python-${vers//./}/ --compressed 2>&1 | grep -iE "python-$vers-macos.*.pkg\"" | awk -F'"' '{ print $2 }')"
|
||||
if [ -z "$url" ]; then
|
||||
# Couldn't get the URL - bail
|
||||
print_error
|
||||
@@ -104,6 +110,7 @@ download_py () {
|
||||
fi
|
||||
echo
|
||||
echo "Running python install package..."
|
||||
echo
|
||||
sudo installer -pkg "$tempdir/python.pkg" -target /
|
||||
if [ "$?" != "0" ]; then
|
||||
echo
|
||||
@@ -111,23 +118,36 @@ download_py () {
|
||||
echo
|
||||
exit $?
|
||||
fi
|
||||
echo
|
||||
# Now we expand the package and look for a shell update script
|
||||
pkgutil --expand "$tempdir/python.pkg" "$tempdir/python"
|
||||
if [ -e "$tempdir/python/Python_Shell_Profile_Updater.pkg/Scripts/postinstall" ]; then
|
||||
# Run the script
|
||||
echo
|
||||
echo "Updating PATH..."
|
||||
echo
|
||||
"$tempdir/python/Python_Shell_Profile_Updater.pkg/Scripts/postinstall"
|
||||
fi
|
||||
vers_folder="Python $(echo "$vers" | cut -d'.' -f1 -f2)"
|
||||
if [ -f "/Applications/$vers_folder/Install Certificates.command" ]; then
|
||||
# Certs script exists - let's execute that to make sure our certificates are updated
|
||||
echo
|
||||
echo "Updating Certificates..."
|
||||
echo
|
||||
"/Applications/$vers_folder/Install Certificates.command"
|
||||
echo
|
||||
fi
|
||||
echo
|
||||
echo "Cleaning up..."
|
||||
cleanup
|
||||
echo
|
||||
# Now we check for py again
|
||||
echo "Rechecking py..."
|
||||
downloaded="TRUE"
|
||||
clear
|
||||
main
|
||||
if [ "$just_installing" == "TRUE" ]; then
|
||||
echo "Done."
|
||||
else
|
||||
# Now we check for py again
|
||||
echo "Rechecking py..."
|
||||
downloaded="TRUE"
|
||||
clear
|
||||
main
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup () {
|
||||
@@ -145,8 +165,13 @@ print_error() {
|
||||
echo
|
||||
echo "Python is not installed or not found in your PATH var."
|
||||
echo
|
||||
echo "Please go to https://www.python.org/downloads/macos/"
|
||||
echo "to download and install the latest version."
|
||||
if [ "$kernel" == "Darwin" ]; then
|
||||
echo "Please go to https://www.python.org/downloads/macos/ to"
|
||||
echo "download and install the latest version, then try again."
|
||||
else
|
||||
echo "Please install python through your package manager and"
|
||||
echo "try again."
|
||||
fi
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
@@ -228,8 +253,8 @@ get_python_version() {
|
||||
}
|
||||
|
||||
prompt_and_download() {
|
||||
if [ "$downloaded" != "FALSE" ]; then
|
||||
# We already tried to download - just bail
|
||||
if [ "$downloaded" != "FALSE" ] || [ "$kernel" != "Darwin" ]; then
|
||||
# We already tried to download, or we're not on macOS - just bail
|
||||
print_error
|
||||
fi
|
||||
clear
|
||||
@@ -289,6 +314,9 @@ main() {
|
||||
"$python" "$dir/$target" "${args[@]}"
|
||||
}
|
||||
|
||||
# Keep track of whether or not we're on macOS to determine if
|
||||
# we can download and install python for the user as needed.
|
||||
kernel="$(uname -s)"
|
||||
# Check to see if we need to force based on
|
||||
# macOS version. 10.15 has a dummy python3 version
|
||||
# that can trip up some py3 detection in other scripts.
|
||||
@@ -298,4 +326,9 @@ downloaded="FALSE"
|
||||
# our OS version is 10.15 or greater.
|
||||
check_py3_stub="$(compare_to_version "3" "10.15")"
|
||||
trap cleanup EXIT
|
||||
main
|
||||
if [ "$1" == "--install-python" ] && [ "$kernel" == "Darwin" ]; then
|
||||
just_installing="TRUE"
|
||||
download_py
|
||||
else
|
||||
main
|
||||
fi
|
||||
@@ -1,5 +1,4 @@
|
||||
# Original source:
|
||||
# https://github.com/corpnewt/SSDTTime/blob/b3863aff1b387585a54825f325f071f43e1970db/Scripts/dsdt.py
|
||||
# Original source: https://github.com/corpnewt/SSDTTime/blob/64446d553fcbc14a4e6ebf3d8d16e3357b5cbf50/Scripts/dsdt.py
|
||||
|
||||
import os, errno, tempfile, shutil, plistlib, sys, binascii, zipfile, getpass, re
|
||||
from Scripts import resource_fetcher
|
||||
@@ -254,8 +253,29 @@ class DSDT:
|
||||
#source = self.dl.get_string(self.acpi_binary_tools, headers=self.h)
|
||||
source = self.fetcher.fetch_and_parse_content(self.acpi_binary_tools)
|
||||
for line in source.split("\n"):
|
||||
if "href" in line and ">iasl compiler and windows acpi tools" in line.lower():
|
||||
return line.split('<a href="')[1].split('"')[0]
|
||||
if '<a href="' in line and ">iasl compiler and windows acpi tools" in line.lower():
|
||||
# Check if we have a direct download link - i.e. ends with .zip - or if we're
|
||||
# redirected to a different download page - i.e. ends with .html
|
||||
dl_link = line.split('<a href="')[1].split('"')[0]
|
||||
if dl_link.lower().endswith(".zip"):
|
||||
# Direct download - return as-is
|
||||
return dl_link
|
||||
elif dl_link.lower().endswith((".html",".htm")):
|
||||
# Redirect - try to scrape for a download link
|
||||
try:
|
||||
if dl_link.lower().startswith(("http:","https:")):
|
||||
# The existing link is likely complete - use it as-is
|
||||
dl_page_url = dl_link
|
||||
else:
|
||||
# <a href="/content/www/us/en/download/774881/acpi-component-architecture-downloads-windows-binary-tools.html">iASL Compiler and Windows ACPI Tools
|
||||
# Only a suffix - prepend to it
|
||||
dl_page_url = "https://www.intel.com" + line.split('<a href="')[1].split('"')[0]
|
||||
dl_page_source = self.dl.get_string(dl_page_url, progress=False, headers=self.h)
|
||||
for line in dl_page_source.split("\n"):
|
||||
if 'data-href="' in line and '"download-button"' in line:
|
||||
# Should have the right line
|
||||
return line.split('data-href="')[1].split('"')[0]
|
||||
except: pass
|
||||
except: pass
|
||||
return None
|
||||
|
||||
|
||||
3
Scripts/run.py
Executable file → Normal file
3
Scripts/run.py
Executable file → Normal file
@@ -1,5 +1,4 @@
|
||||
# Original source:
|
||||
# https://github.com/corpnewt/SSDTTime/blob/7b3fb78112bf320a1bc6a7e50dddb2b375cb70b0/Scripts/run.py
|
||||
# Source: https://github.com/corpnewt/SSDTTime/blob/7b3fb78112bf320a1bc6a7e50dddb2b375cb70b0/Scripts/run.py
|
||||
|
||||
import sys, subprocess, time, threading, shlex
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user