mirror of
https://github.com/LSPosed/MagiskOnWSALocal.git
synced 2025-09-03 19:20:44 +00:00
Fedora support + remove build warnings (#763)
This commit is contained in:
parent
bdfc507798
commit
3014fc99f4
5 changed files with 33 additions and 13 deletions
|
@ -104,7 +104,7 @@ with zipfile.ZipFile(wsa_zip_path) as zip:
|
||||||
elif g.filename == 'AppxManifest.xml':
|
elif g.filename == 'AppxManifest.xml':
|
||||||
g.filename = f'resources.{name}.xml'
|
g.filename = f'resources.{name}.xml'
|
||||||
l.extract(g, xmldir)
|
l.extract(g, xmldir)
|
||||||
elif re.search(u'Images/.+\.png', g.filename):
|
elif re.search(r'Images/.+\.png', g.filename):
|
||||||
l.extract(g, archdir)
|
l.extract(g, archdir)
|
||||||
with zipfile.ZipFile(zip_path) as zip:
|
with zipfile.ZipFile(zip_path) as zip:
|
||||||
stat = Path(zip_path).stat()
|
stat = Path(zip_path).stat()
|
||||||
|
|
|
@ -50,12 +50,12 @@ if brand == "OpenGApps":
|
||||||
print("Failed to fetch from OpenGApps API, fallbacking to SourceForge RSS...")
|
print("Failed to fetch from OpenGApps API, fallbacking to SourceForge RSS...")
|
||||||
res = requests.get(
|
res = requests.get(
|
||||||
f'https://sourceforge.net/projects/opengapps/rss?path=/{abi_map[arch]}&limit=100')
|
f'https://sourceforge.net/projects/opengapps/rss?path=/{abi_map[arch]}&limit=100')
|
||||||
link = re.search(f'https://.*{abi_map[arch]}/.*{release}.*{variant}.*\.zip/download', res.text).group().replace(
|
link = re.search(fr'https://.*{abi_map[arch]}/.*{release}.*{variant}.*\.zip/download', res.text).group().replace(
|
||||||
'.zip/download', '.zip').replace('sourceforge.net/projects/opengapps/files', 'downloads.sourceforge.net/project/opengapps')
|
'.zip/download', '.zip').replace('sourceforge.net/projects/opengapps/files', 'downloads.sourceforge.net/project/opengapps')
|
||||||
elif brand == "MindTheGapps":
|
elif brand == "MindTheGapps":
|
||||||
res = requests.get(
|
res = requests.get(
|
||||||
f'https://sourceforge.net/projects/wsa-mtg/rss?path=/{abi_map[arch]}&limit=100')
|
f'https://sourceforge.net/projects/wsa-mtg/rss?path=/{abi_map[arch]}&limit=100')
|
||||||
matched = re.search(f'https://.*{release}.*{abi_map[arch]}.*\.zip/download', res.text)
|
matched = re.search(fr'https://.*{release}.*{abi_map[arch]}.*\.zip/download', res.text)
|
||||||
if matched:
|
if matched:
|
||||||
link = matched.group().replace(
|
link = matched.group().replace(
|
||||||
'.zip/download', '.zip').replace('sourceforge.net/projects/wsa-mtg/files', 'downloads.sourceforge.net/project/wsa-mtg')
|
'.zip/download', '.zip').replace('sourceforge.net/projects/wsa-mtg/files', 'downloads.sourceforge.net/project/wsa-mtg')
|
||||||
|
@ -68,7 +68,7 @@ elif brand == "MindTheGapps":
|
||||||
if res.status_code == 200:
|
if res.status_code == 200:
|
||||||
assets = json_data["assets"]
|
assets = json_data["assets"]
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
if re.match(f'.*{release}.*{abi_map[arch]}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip":
|
if re.match(fr'.*{release}.*{abi_map[arch]}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip":
|
||||||
link = asset["browser_download_url"]
|
link = asset["browser_download_url"]
|
||||||
break
|
break
|
||||||
elif res.status_code == 403 and x_ratelimit_remaining == '0':
|
elif res.status_code == 403 and x_ratelimit_remaining == '0':
|
||||||
|
|
|
@ -62,7 +62,7 @@ if res.status_code == 200:
|
||||||
link = ""
|
link = ""
|
||||||
assets = json_data["assets"]
|
assets = json_data["assets"]
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
if re.match(f'kernel-WSA-{abi_map[arch]}-{kernelVersion}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip":
|
if re.match(fr'kernel-WSA-{abi_map[arch]}-{kernelVersion}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip":
|
||||||
link = asset["browser_download_url"]
|
link = asset["browser_download_url"]
|
||||||
break
|
break
|
||||||
if link == "":
|
if link == "":
|
||||||
|
|
|
@ -145,24 +145,24 @@ def send_req(i, v, out_file_name):
|
||||||
threads = []
|
threads = []
|
||||||
wsa_build_ver = 0
|
wsa_build_ver = 0
|
||||||
for filename, values in identities.items():
|
for filename, values in identities.items():
|
||||||
if re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
|
if re.match(fr"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
|
||||||
tmp_wsa_build_ver = re.search(u'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
|
tmp_wsa_build_ver = re.search(r'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
|
||||||
if(wsa_build_ver == 0):
|
if(wsa_build_ver == 0):
|
||||||
wsa_build_ver = tmp_wsa_build_ver
|
wsa_build_ver = tmp_wsa_build_ver
|
||||||
elif version.parse(wsa_build_ver) < version.parse(tmp_wsa_build_ver):
|
elif version.parse(wsa_build_ver) < version.parse(tmp_wsa_build_ver):
|
||||||
wsa_build_ver = tmp_wsa_build_ver
|
wsa_build_ver = tmp_wsa_build_ver
|
||||||
for filename, values in identities.items():
|
for filename, values in identities.items():
|
||||||
if re.match(f"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", filename):
|
if re.match(fr"rMicrosoft\.UI\.Xaml\..*_{arch}_.*\.appx", filename):
|
||||||
out_file_name = f"{values[1]}_{arch}.appx"
|
out_file_name = f"{values[1]}_{arch}.appx"
|
||||||
out_file = download_dir / out_file_name
|
out_file = download_dir / out_file_name
|
||||||
elif re.match(f"Microsoft\.VCLibs\..+\.UWPDesktop_.*_{arch}_.*\.appx", filename):
|
elif re.match(fr"Microsoft\.VCLibs\..+\.UWPDesktop_.*_{arch}_.*\.appx", filename):
|
||||||
out_file_name = f"{values[1]}_{arch}.appx"
|
out_file_name = f"{values[1]}_{arch}.appx"
|
||||||
out_file = download_dir / out_file_name
|
out_file = download_dir / out_file_name
|
||||||
elif re.match(f"Microsoft\.VCLibs\..+_.*_{arch}_.*\.appx", filename):
|
elif re.match(fr"Microsoft\.VCLibs\..+_.*_{arch}_.*\.appx", filename):
|
||||||
out_file_name = f"{values[1]}_{arch}.appx"
|
out_file_name = f"{values[1]}_{arch}.appx"
|
||||||
out_file = download_dir / out_file_name
|
out_file = download_dir / out_file_name
|
||||||
elif not skip_wsa_download and re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
|
elif not skip_wsa_download and re.match(fr"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
|
||||||
tmp_wsa_build_ver = re.search(u'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
|
tmp_wsa_build_ver = re.search(r'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
|
||||||
if(wsa_build_ver != tmp_wsa_build_ver):
|
if(wsa_build_ver != tmp_wsa_build_ver):
|
||||||
continue
|
continue
|
||||||
version_splitted = wsa_build_ver.split(".")
|
version_splitted = wsa_build_ver.split(".")
|
||||||
|
|
|
@ -54,6 +54,7 @@ check_dependencies
|
||||||
osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release)
|
osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release)
|
||||||
declare -A os_pm_install
|
declare -A os_pm_install
|
||||||
# os_pm_install["/etc/redhat-release"]=yum
|
# os_pm_install["/etc/redhat-release"]=yum
|
||||||
|
os_pm_install["/etc/fedora-release"]=dnf
|
||||||
os_pm_install["/etc/arch-release"]=pacman
|
os_pm_install["/etc/arch-release"]=pacman
|
||||||
os_pm_install["/etc/gentoo-release"]=emerge
|
os_pm_install["/etc/gentoo-release"]=emerge
|
||||||
os_pm_install["/etc/SuSE-release"]=zypper
|
os_pm_install["/etc/SuSE-release"]=zypper
|
||||||
|
@ -62,6 +63,7 @@ os_pm_install["/etc/debian_version"]=apt-get
|
||||||
|
|
||||||
declare -A PM_UPDATE_MAP
|
declare -A PM_UPDATE_MAP
|
||||||
PM_UPDATE_MAP["yum"]="check-update"
|
PM_UPDATE_MAP["yum"]="check-update"
|
||||||
|
PM_UPDATE_MAP["dnf"]="check-update"
|
||||||
PM_UPDATE_MAP["pacman"]="-Syu --noconfirm"
|
PM_UPDATE_MAP["pacman"]="-Syu --noconfirm"
|
||||||
PM_UPDATE_MAP["emerge"]="-auDU1 @world"
|
PM_UPDATE_MAP["emerge"]="-auDU1 @world"
|
||||||
PM_UPDATE_MAP["zypper"]="ref"
|
PM_UPDATE_MAP["zypper"]="ref"
|
||||||
|
@ -70,6 +72,7 @@ PM_UPDATE_MAP["apk"]="update"
|
||||||
|
|
||||||
declare -A PM_INSTALL_MAP
|
declare -A PM_INSTALL_MAP
|
||||||
PM_INSTALL_MAP["yum"]="install -y"
|
PM_INSTALL_MAP["yum"]="install -y"
|
||||||
|
PM_INSTALL_MAP["dnf"]="install -y"
|
||||||
PM_INSTALL_MAP["pacman"]="-S --noconfirm --needed"
|
PM_INSTALL_MAP["pacman"]="-S --noconfirm --needed"
|
||||||
PM_INSTALL_MAP["emerge"]="-a"
|
PM_INSTALL_MAP["emerge"]="-a"
|
||||||
PM_INSTALL_MAP["zypper"]="in -y"
|
PM_INSTALL_MAP["zypper"]="in -y"
|
||||||
|
@ -77,6 +80,7 @@ PM_INSTALL_MAP["apt-get"]="install -y"
|
||||||
PM_INSTALL_MAP["apk"]="add"
|
PM_INSTALL_MAP["apk"]="add"
|
||||||
|
|
||||||
declare -A PM_UPGRADE_MAP
|
declare -A PM_UPGRADE_MAP
|
||||||
|
PM_UPGRADE_MAP["dnf"]="update -y"
|
||||||
PM_UPGRADE_MAP["apt-get"]="upgrade -y"
|
PM_UPGRADE_MAP["apt-get"]="upgrade -y"
|
||||||
PM_UPGRADE_MAP["zypper"]="up -y"
|
PM_UPGRADE_MAP["zypper"]="up -y"
|
||||||
|
|
||||||
|
@ -122,12 +126,28 @@ elif [[ "$PM" =~ pacman|emerge ]]; then
|
||||||
abort "Operation cancelled by user"
|
abort "Operation cancelled by user"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
elif [ "$PM" = dnf ]; then
|
||||||
|
sudo "$PM" "${UPDATE_OPTION[@]}" >>/dev/null
|
||||||
|
if ! [[ $? =~ 0|100 ]]; then
|
||||||
|
abort
|
||||||
|
fi
|
||||||
|
sudo "$PM" "${UPGRADE_OPTION[@]}" ca-certificates
|
||||||
else
|
else
|
||||||
if ! (sudo "$PM" "${UPDATE_OPTION[@]}" && sudo "$PM" "${UPGRADE_OPTION[@]}" ca-certificates); then abort; fi
|
if ! (sudo "$PM" "${UPDATE_OPTION[@]}" && sudo "$PM" "${UPGRADE_OPTION[@]}" ca-certificates); then abort; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${NEED_INSTALL[*]}" ]; then
|
if [ -n "${NEED_INSTALL[*]}" ]; then
|
||||||
if [ "$PM" = "zypper" ]; then
|
if [ "$PM" = "dnf" ]; then
|
||||||
|
NEED_INSTALL_FIX=${NEED_INSTALL[*]}
|
||||||
|
{
|
||||||
|
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//whiptail/newt} 2>&1
|
||||||
|
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//qemu-utils/qemu-img} 2>&1
|
||||||
|
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//p7zip-full/p7zip-plugins} 2>&1
|
||||||
|
} >>/dev/null
|
||||||
|
|
||||||
|
readarray -td ' ' NEED_INSTALL <<<"$NEED_INSTALL_FIX "
|
||||||
|
unset 'NEED_INSTALL[-1]'
|
||||||
|
elif [ "$PM" = "zypper" ]; then
|
||||||
NEED_INSTALL_FIX=${NEED_INSTALL[*]}
|
NEED_INSTALL_FIX=${NEED_INSTALL[*]}
|
||||||
{
|
{
|
||||||
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//setools/setools-console} 2>&1
|
NEED_INSTALL_FIX=${NEED_INSTALL_FIX//setools/setools-console} 2>&1
|
||||||
|
|
Loading…
Add table
Reference in a new issue