Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstreamfixtest #1

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/merge_upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ jobs:
git config --global user.email ${{ github.repository_owner_id }}+${{ github.repository_owner }}@users.noreply.github.com
git config --global user.name ${{ github.repository_owner }}
git config --global pull.rebase false

- name: Merge changes from main
run: |
git pull https://github.com/LSPosed/MagiskOnWSALocal main --no-edit

- name: Compare changes
id: compare
run: |
git diff --name-only HEAD origin/main
echo "changes=$(git diff --name-only HEAD origin/main)" >> $GITHUB_OUTPUT
git diff --name-only HEAD origin/merge_upstreamfixtest
echo "changes=$(git diff --name-only HEAD origin/main | tr '\n' ' ' )" >> "$GITHUB_OUTPUT"

- name: Push all changes
if: ${{ steps.compare.outputs.changes != '' }}
run: |
git push origin main
git push origin merge_upstreamfixtest

- name: Trigger build
uses: peter-evans/[email protected]
if: ${{ steps.compare.outputs.changes != '' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: build

4 changes: 0 additions & 4 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Shell checker

on:
push:
branches:
- main
paths:
- '**.sh'
workflow_dispatch:
Expand All @@ -21,7 +19,5 @@ jobs:
- name: Run ShellCheck
id: check
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -e SC2086
with:
scandir: './scripts'
264 changes: 153 additions & 111 deletions scripts/build.sh

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/generateGappsLink.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
if res.status_code == 200:
assets = json_data["assets"]
for asset in assets:
if re.match(f'.*{release}.*{abi_map[arch]}.*\.zip$', asset["name"]) and asset["content_type"] == "application/x-zip-compressed":
if re.match(f'.*{release}.*{abi_map[arch]}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip":
link = asset["browser_download_url"]
break
elif res.status_code == 403 and x_ratelimit_remaining == '0':
Expand Down
64 changes: 64 additions & 0 deletions scripts/generateKernelSULink.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/python3
#
# This file is part of MagiskOnWSALocal.
#
# MagiskOnWSALocal is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# MagiskOnWSALocal is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with MagiskOnWSALocal. If not, see <https://www.gnu.org/licenses/>.
#
# Copyright (C) 2023 LSPosed Contributors
#

from datetime import datetime
import sys
import os

import requests
import json
import re
from pathlib import Path

arch = sys.argv[1]
download_dir = Path.cwd().parent / \
"download" if sys.argv[2] == "" else Path(sys.argv[2]).resolve()
tempScript = sys.argv[3]
kernelVersion = sys.argv[4]
file_name = sys.argv[5]
abi_map = {"x64": "x86_64", "arm64": "arm64"}
print(f"Generating KernelSU download link: arch={abi_map[arch]}, kernel version={kernelVersion}", flush=True)
res = requests.get(f"https://api.github.com/repos/tiann/KernelSU/releases/latest")
json_data = json.loads(res.content)
headers = res.headers
x_ratelimit_remaining = headers["x-ratelimit-remaining"]
if res.status_code == 200:
assets = json_data["assets"]
for asset in assets:
if re.match(f'kernel-WSA-{abi_map[arch]}-{kernelVersion}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip":
link = asset["browser_download_url"]
break
release_name = json_data["name"]
with open(os.environ['WSA_WORK_ENV'], 'a') as environ_file:
environ_file.write(f'KERNELSU_VER={release_name}\n')
elif res.status_code == 403 and x_ratelimit_remaining == '0':
message = json_data["message"]
print(f"Github API Error: {message}", flush=True)
ratelimit_reset = headers["x-ratelimit-reset"]
ratelimit_reset = datetime.fromtimestamp(int(ratelimit_reset))
print(f"The current rate limit window resets in {ratelimit_reset}", flush=True)
exit(1)

print(f"download link: {link}", flush=True)

with open(download_dir/tempScript, 'a') as f:
f.writelines(f'{link}\n')
f.writelines(f' dir={download_dir}\n')
f.writelines(f' out={file_name}\n')
11 changes: 6 additions & 5 deletions scripts/getWSAMainVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
for f in zip.filelist:
if arch in f.filename.lower():
zip_name = f.filename
ver_no = zip_name.split("_")
long_ver = ver_no[1]
ver = long_ver.split(".")
main_ver = ver[0]
print(main_ver)
break
ver_no = zip_name.split("_")
long_ver = ver_no[1]
ver = long_ver.split(".")
main_ver = ver[0]
print(main_ver)
4 changes: 2 additions & 2 deletions scripts/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ check_dependencies() {
command -v whiptail >/dev/null 2>&1 || command -v dialog >/dev/null 2>&1 || NEED_INSTALL+=("whiptail")
command -v seinfo >/dev/null 2>&1 || NEED_INSTALL+=("setools")
command -v lzip >/dev/null 2>&1 || NEED_INSTALL+=("lzip")
if [ ! -f /proc/sys/fs/binfmt_misc/WSLInterop ]; then
if [ ! -f /proc/sys/fs/binfmt_misc/WSLInterop ] || [ "$(id -u)" == "0" ]; then
command -v wine64 >/dev/null 2>&1 || NEED_INSTALL+=("wine")
command -v winetricks >/dev/null 2>&1 || NEED_INSTALL+=("winetricks")
fi
Expand Down Expand Up @@ -121,7 +121,7 @@ if [ -n "${NEED_INSTALL[*]}" ]; then
fi
pip list --disable-pip-version-check | grep -E "^requests " >/dev/null 2>&1 || python3 -m pip install requests

if [ ! -f /proc/sys/fs/binfmt_misc/WSLInterop ] && which wine64 > /dev/null; then
if [ ! -f /proc/sys/fs/binfmt_misc/WSLInterop ] || [ "$(id -u)" == "0" ] && which wine64 > /dev/null; then
winetricks list-installed | grep -E "^msxml6" >/dev/null 2>&1 || {
cp -r ../wine/.cache/* ~/.cache
winetricks msxml6 || abort
Expand Down
5 changes: 3 additions & 2 deletions scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ ROOT_SOL=$(
Radiolist '([title]="Root solution"
[default]="magisk")' \
\
'magisk' "" 'on' \
'none' "" 'off'
'magisk' "Magisk" 'on' \
'kernelsu' "KernelSU" 'on' \
'none' "Without root" 'off'
)

if (YesNoBox '([title]="Compress output" [text]="Do you want to compress the output?")'); then
Expand Down