mirror of
https://github.com/Nezumi-2711/revanced-apk-build.git
synced 2026-09-22 20:02:00 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c48c4abc17 | ||
|
|
10f7aaf56f | ||
|
|
5785b1594a | ||
|
|
03625a35d5 | ||
|
|
bc51731aeb | ||
|
|
f0b44a12a1 | ||
|
|
ffa6e7a357 | ||
|
|
e8297c8d9a | ||
|
|
bb1398a32f | ||
|
|
34d34bc878 | ||
|
|
d24f8939d0 | ||
|
|
3becfad4f7 | ||
|
|
0e85707946 | ||
|
|
117a2fde1b | ||
|
|
8d9c8d40aa | ||
|
|
bbde99482c | ||
|
|
9a7d8890aa | ||
|
|
57d950f57f | ||
|
|
e0a5116d13 | ||
|
|
6e4565bc1b | ||
|
|
f6d783c176 | ||
|
|
2da4a7c7cd | ||
|
|
11af439fd5 | ||
|
|
1adcc80512 | ||
|
|
596241c5d7 | ||
|
|
26540719e9 | ||
|
|
fbf816533d | ||
|
|
d6582d2d63 | ||
|
|
1a2af75601 | ||
|
|
6b33d5841d | ||
|
|
9f6f043d9a | ||
|
|
88ea74d38f | ||
|
|
ea7dd1d777 | ||
|
|
39e551c73c | ||
|
|
b5aac3781a | ||
|
|
9ff2c72375 | ||
|
|
e65dfdaa1b |
+209
-14
@@ -14,13 +14,13 @@ jobs:
|
|||||||
permissions: write-all
|
permissions: write-all
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-java@v4
|
- uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
distribution: "zulu"
|
distribution: "zulu"
|
||||||
java-version: "17"
|
java-version: "21"
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
submodules: true
|
submodules: true
|
||||||
@@ -71,7 +71,7 @@ jobs:
|
|||||||
file_glob: true
|
file_glob: true
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
- name: Update changelog and Magisk update json
|
- name: Update changelog and update json
|
||||||
id: update_config
|
id: update_config
|
||||||
run: |
|
run: |
|
||||||
git checkout -f update || git switch --discard-changes --orphan update
|
git checkout -f update || git switch --discard-changes --orphan update
|
||||||
@@ -86,8 +86,8 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
cd build || { echo "build folder not found"; exit 1; }
|
cd build || { echo "build folder not found"; exit 1; }
|
||||||
for OUTPUT in *magisk*.zip; do
|
for OUTPUT in *module*.zip; do
|
||||||
[ "$OUTPUT" = "*magisk*.zip" ] && continue
|
[ "$OUTPUT" = "*module*.zip" ] && continue
|
||||||
ZIP_S=$(unzip -p "$OUTPUT" module.prop)
|
ZIP_S=$(unzip -p "$OUTPUT" module.prop)
|
||||||
if ! UPDATE_JSON=$(echo "$ZIP_S" | grep updateJson); then continue; fi
|
if ! UPDATE_JSON=$(echo "$ZIP_S" | grep updateJson); then continue; fi
|
||||||
UPDATE_JSON="${UPDATE_JSON##*/}"
|
UPDATE_JSON="${UPDATE_JSON##*/}"
|
||||||
@@ -100,7 +100,7 @@ jobs:
|
|||||||
|
|
||||||
find . -name "*-update.json" | grep . || : >dummy-update.json
|
find . -name "*-update.json" | grep . || : >dummy-update.json
|
||||||
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
- uses: stefanzweifel/git-auto-commit-action@v7
|
||||||
with:
|
with:
|
||||||
branch: update
|
branch: update
|
||||||
skip_checkout: true
|
skip_checkout: true
|
||||||
@@ -114,7 +114,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd build || { echo "build folder not found"; exit 1; }
|
cd build || { echo "build folder not found"; exit 1; }
|
||||||
|
|
||||||
TG_CHAT="-1002417137882"
|
TG_CHAT="@rvc_magisk"
|
||||||
NL=$'\n'
|
NL=$'\n'
|
||||||
APKS=""
|
APKS=""
|
||||||
MODULES=""
|
MODULES=""
|
||||||
@@ -175,7 +175,7 @@ jobs:
|
|||||||
|
|
||||||
**Download Links:**
|
**Download Links:**
|
||||||
"
|
"
|
||||||
|
|
||||||
MODULES_MSG="
|
MODULES_MSG="
|
||||||
**Modules:**
|
**Modules:**
|
||||||
${MODULES}
|
${MODULES}
|
||||||
@@ -189,11 +189,206 @@ jobs:
|
|||||||
curl -X POST -H "Content-Type: application/json" \
|
curl -X POST -H "Content-Type: application/json" \
|
||||||
-d "$(jq -n --arg content "$MSG" '{content: $content}')" \
|
-d "$(jq -n --arg content "$MSG" '{content: $content}')" \
|
||||||
"$DISCORD_WEBHOOK_URL"
|
"$DISCORD_WEBHOOK_URL"
|
||||||
|
|
||||||
curl -X POST -H "Content-Type: application/json" \
|
# curl -X POST -H "Content-Type: application/json" \
|
||||||
-d "$(jq -n --arg content "$MODULES_MSG" '{content: $content}')" \
|
# -d "$(jq -n --arg content "$MODULES_MSG" '{content: $content}')" \
|
||||||
"$DISCORD_WEBHOOK_URL"
|
# "$DISCORD_WEBHOOK_URL"
|
||||||
|
|
||||||
curl -X POST -H "Content-Type: application/json" \
|
curl -X POST -H "Content-Type: application/json" \
|
||||||
-d "$(jq -n --arg content "$APKS_MSG" '{content: $content}')" \
|
-d "$(jq -n --arg content "$APKS_MSG" '{content: $content}')" \
|
||||||
"$DISCORD_WEBHOOK_URL"
|
"$DISCORD_WEBHOOK_URL"
|
||||||
|
|
||||||
|
- name: Report to Noob Discord
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_NOOB_URL: ${{ secrets.DISCORD_WEBHOOK_NOOB_URL }}
|
||||||
|
if: env.DISCORD_WEBHOOK_NOOB_URL != null
|
||||||
|
run: |
|
||||||
|
cd build || { echo "build folder not found"; exit 1; }
|
||||||
|
|
||||||
|
NL=$'\n'
|
||||||
|
APKS=""
|
||||||
|
MODULES=""
|
||||||
|
for OUTPUT in *; do
|
||||||
|
DL_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}/${OUTPUT}"
|
||||||
|
if [[ $OUTPUT = *.apk ]]; then
|
||||||
|
APKS+="${NL}- [${OUTPUT}](${DL_URL})"
|
||||||
|
elif [[ $OUTPUT = *.zip ]]; then
|
||||||
|
MODULES+="${NL}- [${OUTPUT}](${DL_URL})"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
MODULES=${MODULES#"$NL"}
|
||||||
|
APKS=${APKS#"$NL"}
|
||||||
|
|
||||||
|
BODY="$(sed 's/^\* \*\*/- \*\*/g; s/^\* `/- \*\*/g; s/`/\*/g; s/^\* /\-/g; s/\*\*/\*/g; s/###//g; s/^- /- /g; /^==/d;' ../build.md)"
|
||||||
|
MSG="**New build is ready!**
|
||||||
|
|
||||||
|
${BODY}
|
||||||
|
|
||||||
|
**Download Links:**
|
||||||
|
"
|
||||||
|
|
||||||
|
MODULES_MSG="
|
||||||
|
**Modules:**
|
||||||
|
${MODULES}
|
||||||
|
"
|
||||||
|
|
||||||
|
APKS_MSG="
|
||||||
|
**APKs:**
|
||||||
|
${APKS}
|
||||||
|
"
|
||||||
|
|
||||||
|
curl -X POST -H "Content-Type: application/json" \
|
||||||
|
-d "$(jq -n --arg content "$MSG" '{content: $content}')" \
|
||||||
|
"$DISCORD_WEBHOOK_NOOB_URL"
|
||||||
|
|
||||||
|
# curl -X POST -H "Content-Type: application/json" \
|
||||||
|
# -d "$(jq -n --arg content "$MODULES_MSG" '{content: $content}')" \
|
||||||
|
# "$DISCORD_WEBHOOK_NOOB_URL"
|
||||||
|
|
||||||
|
curl -X POST -H "Content-Type: application/json" \
|
||||||
|
-d "$(jq -n --arg content "$APKS_MSG" '{content: $content}')" \
|
||||||
|
"$DISCORD_WEBHOOK_NOOB_URL"
|
||||||
|
|
||||||
|
- name: Send Email Notification (Resend)
|
||||||
|
env:
|
||||||
|
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
|
||||||
|
MAIL_TO: ${{ secrets.MAIL_TO }}
|
||||||
|
MAIL_CC: ${{ secrets.MAIL_CC }}
|
||||||
|
MAIL_BCC: ${{ secrets.MAIL_BCC }}
|
||||||
|
MAIL_FROM: ${{ secrets.MAIL_FROM }}
|
||||||
|
if: env.RESEND_API_KEY != null && env.MAIL_TO != null
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}"
|
||||||
|
RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases/tag/${VERSION}"
|
||||||
|
REPO="${{ github.repository }}"
|
||||||
|
|
||||||
|
# Set default FROM address if not provided
|
||||||
|
FROM_ADDRESS="${MAIL_FROM:-ReVanced Build Bot <onboarding@resend.dev>}"
|
||||||
|
|
||||||
|
# Build download links from build folder (separate APKs and Modules)
|
||||||
|
cd build || { echo "build folder not found"; exit 1; }
|
||||||
|
|
||||||
|
APK_LINKS=""
|
||||||
|
MODULE_LINKS=""
|
||||||
|
for OUTPUT in *; do
|
||||||
|
DL_URL="${{ github.server_url }}/${{ github.repository }}/releases/download/${VERSION}/${OUTPUT}"
|
||||||
|
if [[ $OUTPUT = *.apk ]]; then
|
||||||
|
APK_LINKS+="<li style=\"margin: 8px 0;\">📦 <a href=\"${DL_URL}\" style=\"color: #667eea; text-decoration: none;\">${OUTPUT}</a></li>"
|
||||||
|
elif [[ $OUTPUT = *.zip ]]; then
|
||||||
|
MODULE_LINKS+="<li style=\"margin: 8px 0;\">📁 <a href=\"${DL_URL}\" style=\"color: #667eea; text-decoration: none;\">${OUTPUT}</a></li>"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# Get current time in Vietnam timezone (UTC+7)
|
||||||
|
BUILD_TIME=$(TZ='Asia/Ho_Chi_Minh' date '+%Y-%m-%d %H:%M:%S (UTC+7)')
|
||||||
|
|
||||||
|
# Get changelog from build.md and convert to HTML
|
||||||
|
if [ -f "build.md" ]; then
|
||||||
|
# Convert markdown to simple HTML
|
||||||
|
CHANGELOG_HTML=$(sed 's/^### \(.*\)/<h3 style="color: #667eea; font-size: 16px; margin: 15px 0 8px 0;">\1<\/h3>/g;
|
||||||
|
s/^\* \*\*\(.*\)\*\*/<li style="margin: 5px 0;"><strong>\1<\/strong><\/li>/g;
|
||||||
|
s/^\* \(.*\)/<li style="margin: 5px 0;">\1<\/li>/g;
|
||||||
|
s/^- \(.*\)/<li style="margin: 5px 0;">\1<\/li>/g;
|
||||||
|
s/`\([^`]*\)`/<code style="background: #e9ecef; padding: 2px 6px; border-radius: 3px; font-size: 13px;">\1<\/code>/g;
|
||||||
|
/^==/d;
|
||||||
|
/^$/d' build.md | tr '\n' ' ')
|
||||||
|
else
|
||||||
|
CHANGELOG_HTML="<p>No changelog available.</p>"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create HTML email body (similar structure to Telegram)
|
||||||
|
HTML_BODY=$(cat <<EOF
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 0;">
|
||||||
|
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; text-align: center;">
|
||||||
|
<h1 style="margin: 0;">🎉 New ReVanced Build!</h1>
|
||||||
|
<p style="margin: 10px 0 0 0; font-size: 18px;">Version: v${VERSION}</p>
|
||||||
|
<p style="margin: 5px 0 0 0; font-size: 14px; opacity: 0.9;">🕐 ${BUILD_TIME}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="padding: 25px; background: #f9f9f9;">
|
||||||
|
<!-- Changelog Section -->
|
||||||
|
<div style="margin-bottom: 25px; background: white; padding: 20px; border-radius: 8px; border-left: 4px solid #667eea;">
|
||||||
|
<h2 style="color: #667eea; font-size: 18px; margin: 0 0 15px 0;">📋 Changelog</h2>
|
||||||
|
<div style="font-size: 14px;">
|
||||||
|
${CHANGELOG_HTML}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Download Links Section -->
|
||||||
|
<div style="margin-bottom: 25px; background: white; padding: 20px; border-radius: 8px;">
|
||||||
|
<h2 style="color: #667eea; font-size: 18px; margin: 0 0 15px 0;">� Download Links</h2>
|
||||||
|
|
||||||
|
<!-- Modules -->
|
||||||
|
$(if [ -n "$MODULE_LINKS" ]; then echo "
|
||||||
|
<div style=\"margin-bottom: 15px;\">
|
||||||
|
<h3 style=\"color: #555; font-size: 15px; margin: 0 0 10px 0;\">� Modules:</h3>
|
||||||
|
<ul style=\"list-style: none; padding: 0; margin: 0;\">
|
||||||
|
${MODULE_LINKS}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
"; fi)
|
||||||
|
|
||||||
|
<!-- APKs -->
|
||||||
|
$(if [ -n "$APK_LINKS" ]; then echo "
|
||||||
|
<div>
|
||||||
|
<h3 style=\"color: #555; font-size: 15px; margin: 0 0 10px 0;\">📱 APKs:</h3>
|
||||||
|
<ul style=\"list-style: none; padding: 0; margin: 0;\">
|
||||||
|
${APK_LINKS}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
"; fi)
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- GitHub Button -->
|
||||||
|
<div style="text-align: center;">
|
||||||
|
<a href="${RELEASE_URL}" style="display: inline-block; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 12px 30px; text-decoration: none; border-radius: 25px; font-weight: bold;">
|
||||||
|
View Release on GitHub
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="text-align: center; padding: 20px; background: #333; color: #999; font-size: 12px;">
|
||||||
|
<p style="margin: 0;">This is an automated message from ReVanced Build Bot</p>
|
||||||
|
<p style="margin: 5px 0 0 0;">Repository: ${REPO}</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
# Build JSON payload with TO, CC and BCC recipients
|
||||||
|
# Resend allows up to 50 recipients per field (to, cc, bcc)
|
||||||
|
JSON_PAYLOAD=$(jq -n \
|
||||||
|
--arg from "$FROM_ADDRESS" \
|
||||||
|
--arg to "$MAIL_TO" \
|
||||||
|
--arg cc "$MAIL_CC" \
|
||||||
|
--arg bcc "$MAIL_BCC" \
|
||||||
|
--arg subject "🚀 New ReVanced Build Available - v${VERSION}" \
|
||||||
|
--arg html "$HTML_BODY" \
|
||||||
|
'{
|
||||||
|
from: $from,
|
||||||
|
to: ($to | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; ""))),
|
||||||
|
subject: $subject,
|
||||||
|
html: $html
|
||||||
|
}
|
||||||
|
+ (if $cc != "" then {cc: ($cc | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; "")))} else {} end)
|
||||||
|
+ (if $bcc != "" then {bcc: ($bcc | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; "")))} else {} end)'
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "📧 Sending email notification..."
|
||||||
|
|
||||||
|
# Send email via Resend API
|
||||||
|
RESPONSE=$(curl -s -X POST "https://api.resend.com/emails" \
|
||||||
|
-H "Authorization: Bearer ${RESEND_API_KEY}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$JSON_PAYLOAD")
|
||||||
|
|
||||||
|
echo "Response: $RESPONSE"
|
||||||
|
echo "✅ Email sent successfully!"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
echo "'$UPDATE_CFG'"
|
echo "'$UPDATE_CFG'"
|
||||||
echo "SHOULD_BUILD=1" >> $GITHUB_OUTPUT
|
echo "SHOULD_BUILD=1" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "SHOULD_BUILD=1" >> $GITHUB_OUTPUT
|
echo "SHOULD_BUILD=0" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -47,4 +47,4 @@ jobs:
|
|||||||
needs: check
|
needs: check
|
||||||
uses: ./.github/workflows/build.yml
|
uses: ./.github/workflows/build.yml
|
||||||
if: ${{ needs.check.outputs.SHOULD_BUILD == 1 }}
|
if: ${{ needs.check.outputs.SHOULD_BUILD == 1 }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
name: Email Notification Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
recipient_email:
|
||||||
|
description: 'Email address to send test to (leave empty to use MAIL_TO secret)'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
send-test-email:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Send Test Email (Resend)
|
||||||
|
env:
|
||||||
|
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
|
||||||
|
MAIL_TO: ${{ inputs.recipient_email || secrets.MAIL_TO }}
|
||||||
|
MAIL_CC: ${{ secrets.MAIL_CC }}
|
||||||
|
MAIL_BCC: ${{ secrets.MAIL_BCC }}
|
||||||
|
MAIL_FROM: ${{ secrets.MAIL_FROM }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$RESEND_API_KEY" ]; then
|
||||||
|
echo "❌ Error: RESEND_API_KEY secret is not set!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$MAIL_TO" ]; then
|
||||||
|
echo "❌ Error: No email recipient specified!"
|
||||||
|
echo "Either provide recipient_email input or set MAIL_TO secret."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set default FROM address if not provided
|
||||||
|
FROM_ADDRESS="${MAIL_FROM:-ReVanced Build Bot <onboarding@resend.dev>}"
|
||||||
|
|
||||||
|
# Use Vietnam timezone (UTC+7)
|
||||||
|
VERSION="TEST-$(TZ='Asia/Ho_Chi_Minh' date +%Y%m%d-%H%M%S)"
|
||||||
|
SENT_TIME=$(TZ='Asia/Ho_Chi_Minh' date '+%Y-%m-%d %H:%M:%S (UTC+7)')
|
||||||
|
RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases"
|
||||||
|
REPO="${{ github.repository }}"
|
||||||
|
|
||||||
|
# Create test HTML email body
|
||||||
|
HTML_BODY=$(cat <<EOF
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
<body style="font-family: Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 0;">
|
||||||
|
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; text-align: center;">
|
||||||
|
<h1 style="margin: 0;">🧪 Test Email</h1>
|
||||||
|
<p style="margin: 10px 0 0 0; font-size: 18px;">Version: ${VERSION}</p>
|
||||||
|
</div>
|
||||||
|
<div style="padding: 25px; background: #f9f9f9;">
|
||||||
|
<div style="margin-bottom: 25px;">
|
||||||
|
<h2 style="color: #667eea; font-size: 18px; margin: 0 0 10px 0;">✅ Email Configuration Working!</h2>
|
||||||
|
<p style="margin: 0;">If you received this email, it means your Resend configuration is working correctly!</p>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 25px;">
|
||||||
|
<h2 style="color: #667eea; font-size: 18px; margin: 0 0 10px 0;">📋 Configuration Details</h2>
|
||||||
|
<ul style="list-style: none; padding: 0; margin: 0;">
|
||||||
|
<li>📧 From: ${FROM_ADDRESS}</li>
|
||||||
|
<li>📬 To: ${MAIL_TO}</li>
|
||||||
|
<li>🕐 Sent at: ${SENT_TIME}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div style="margin-bottom: 25px; text-align: center;">
|
||||||
|
<a href="${RELEASE_URL}" style="display: inline-block; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 12px 30px; text-decoration: none; border-radius: 25px; font-weight: bold;">
|
||||||
|
View Releases
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: center; padding: 20px; background: #333; color: #999; font-size: 12px;">
|
||||||
|
<p style="margin: 0;">This is a TEST email from ReVanced Build Bot</p>
|
||||||
|
<p style="margin: 5px 0 0 0;">Repository: ${REPO}</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
# Build JSON payload
|
||||||
|
JSON_PAYLOAD=$(jq -n \
|
||||||
|
--arg from "$FROM_ADDRESS" \
|
||||||
|
--arg to "$MAIL_TO" \
|
||||||
|
--arg cc "$MAIL_CC" \
|
||||||
|
--arg bcc "$MAIL_BCC" \
|
||||||
|
--arg subject "🧪 [TEST] ReVanced Build Email - ${VERSION}" \
|
||||||
|
--arg html "$HTML_BODY" \
|
||||||
|
'{
|
||||||
|
from: $from,
|
||||||
|
to: ($to | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; ""))),
|
||||||
|
subject: $subject,
|
||||||
|
html: $html
|
||||||
|
}
|
||||||
|
+ (if $cc != "" then {cc: ($cc | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; "")))} else {} end)
|
||||||
|
+ (if $bcc != "" then {bcc: ($bcc | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; "")))} else {} end)'
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "📧 Sending test email to: $MAIL_TO"
|
||||||
|
if [ -n "$MAIL_CC" ]; then echo "📋 CC: $MAIL_CC"; fi
|
||||||
|
if [ -n "$MAIL_BCC" ]; then echo "🔒 BCC: $MAIL_BCC"; fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Send email via Resend API
|
||||||
|
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "https://api.resend.com/emails" \
|
||||||
|
-H "Authorization: Bearer ${RESEND_API_KEY}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$JSON_PAYLOAD")
|
||||||
|
|
||||||
|
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
|
||||||
|
BODY=$(echo "$RESPONSE" | sed '$d')
|
||||||
|
|
||||||
|
echo "Response: $BODY"
|
||||||
|
echo "HTTP Code: $HTTP_CODE"
|
||||||
|
|
||||||
|
if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "✅ Test email sent successfully!"
|
||||||
|
echo "📬 Check your inbox at: $MAIL_TO"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "❌ Failed to send email!"
|
||||||
|
echo "Please check your RESEND_API_KEY and email addresses."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -7,6 +7,9 @@ apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app"
|
|||||||
# or uptodown-dlurl = "https://app.en.uptodown.com/android"
|
# or uptodown-dlurl = "https://app.en.uptodown.com/android"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> When a patch name itself contains a single quote, double it inside the string (e.g. 'Hide ''Get Music Premium''').
|
||||||
|
|
||||||
## More about other options:
|
## More about other options:
|
||||||
|
|
||||||
There exists an example below with all defaults shown and all the keys explicitly set.
|
There exists an example below with all defaults shown and all the keys explicitly set.
|
||||||
@@ -16,9 +19,10 @@ There exists an example below with all defaults shown and all the keys explicitl
|
|||||||
parallel-jobs = 1 # amount of cores to use for parallel patching, if not set $(nproc) is used
|
parallel-jobs = 1 # amount of cores to use for parallel patching, if not set $(nproc) is used
|
||||||
compression-level = 9 # module zip compression level
|
compression-level = 9 # module zip compression level
|
||||||
remove-rv-integrations-checks = true # remove checks from the revanced integrations
|
remove-rv-integrations-checks = true # remove checks from the revanced integrations
|
||||||
|
dpi = "nodpi anydpi 120-640dpi" # dpi packages to be searched in order. default: "nodpi anydpi"
|
||||||
|
|
||||||
patches-source = "revanced/revanced-patches" # where to fetch patches bundle from. default: "revanced/revanced-patches"
|
patches-source = "revanced/revanced-patches" # where to fetch patches bundle from. default: "revanced/revanced-patches"
|
||||||
cli-source = "j-hc/revanced-cli" # where to fetch cli from. default: "j-hc/revanced-cli"
|
cli-source = "ReVanced/revanced-cli" # where to fetch cli from. default: "ReVanced/revanced-cli"
|
||||||
# options like cli-source can also set per app
|
# options like cli-source can also set per app
|
||||||
rv-brand = "ReVanced Extended" # rebrand from 'ReVanced' to something different. default: "ReVanced"
|
rv-brand = "ReVanced Extended" # rebrand from 'ReVanced' to something different. default: "ReVanced"
|
||||||
|
|
||||||
@@ -50,11 +54,13 @@ excluded-patches = """\
|
|||||||
included-patches = "'Some Patch'" # whitespace seperated list of non-default patches to include. default: ""
|
included-patches = "'Some Patch'" # whitespace seperated list of non-default patches to include. default: ""
|
||||||
include-stock = true # includes stock apk in the module. default: true
|
include-stock = true # includes stock apk in the module. default: true
|
||||||
exclusive-patches = false # exclude all patches by default. default: false
|
exclusive-patches = false # exclude all patches by default. default: false
|
||||||
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app"
|
||||||
uptodown-dlurl = "https://spotify.en.uptodown.com/android"
|
uptodown-dlurl = "https://spotify.en.uptodown.com/android"
|
||||||
module-prop-name = "some-app-magisk" # magisk module prop name.
|
# direct download url. the url must have point to an apk file with name format shown in this example
|
||||||
apkmirror-dpi = "360-480dpi" # used to select apk variant from apkmirror. default: nodpi
|
direct-dlurl = "https://website/com.google.android.youtube-20.40.45-all.apk"
|
||||||
arch = "arm64-v8a" # 'arm64-v8a', 'arm-v7a', 'all', 'both'. 'both' downloads both arm64-v8a and arm-v7a. default: all
|
|
||||||
riplib = true # enables ripping x86 and x86_64 libs from apks with j-hc revanced cli. default: true
|
|
||||||
|
|
||||||
|
module-prop-name = "some-app-module" # module prop name.
|
||||||
|
dpi = "360-480dpi" # used to select apk variant from apkmirror. default: nodpi
|
||||||
|
arch = "arm64-v8a" # 'arm64-v8a', 'arm-v7a', 'all', 'both'. 'both' downloads both arm64-v8a and arm-v7a. default: all
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# ReVanced Magisk Module
|
# ReVanced Magisk Module
|
||||||
[](https://t.me/rvc_magisk)
|
[](https://t.me/rvc_magisk)
|
||||||
[](https://github.com/Nez27/revanced-apk-build/actions/workflows/ci.yml)
|
[](https://github.com/j-hc/revanced-magisk-module/actions/workflows/ci.yml)
|
||||||
|
|
||||||
Extensive ReVanced builder
|
Extensive ReVanced builder
|
||||||
|
|
||||||
@@ -10,10 +10,10 @@ Use [**zygisk-detach**](https://github.com/j-hc/zygisk-detach) to detach YouTube
|
|||||||
|
|
||||||
<details><summary><big>Features</big></summary>
|
<details><summary><big>Features</big></summary>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Support all present and future ReVanced and <a href="https://github.com/inotia00/revanced-patches">ReVanced Extended</a> apps</li>
|
<li> Supports all present and future ReVanced apps (including projects implementing the same API)</li>
|
||||||
<li> Can build Magisk modules and non-root APKs</li>
|
<li> Can build Magisk modules and non-root APKs</li>
|
||||||
<li> Updated daily with the latest versions of apps and patches</li>
|
<li> Updated daily with the latest versions of apps and patches</li>
|
||||||
<li> Optimize APKs and modules for size</li>
|
<li> Optimizes APKs and modules for size</li>
|
||||||
<li> Modules</li>
|
<li> Modules</li>
|
||||||
<ul>
|
<ul>
|
||||||
<li> recompile invalidated odex for faster usage</li>
|
<li> recompile invalidated odex for faster usage</li>
|
||||||
@@ -23,7 +23,6 @@ Use [**zygisk-detach**](https://github.com/j-hc/zygisk-detach) to detach YouTube
|
|||||||
<li> support Magisk and KernelSU</li>
|
<li> support Magisk and KernelSU</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
Note that the <a href="../../actions/workflows/ci.yml">CI workflow</a> is scheduled to build the modules and APKs everyday using GitHub Actions if there is a change in ReVanced patches. You may want to disable it.
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## To include/exclude patches or patch other apps
|
## To include/exclude patches or patch other apps
|
||||||
@@ -36,15 +35,22 @@ Note that the <a href="../../actions/workflows/ci.yml">CI workflow</a> is schedu
|
|||||||
|
|
||||||
also see here [`CONFIG.md`](./CONFIG.md)
|
also see here [`CONFIG.md`](./CONFIG.md)
|
||||||
|
|
||||||
|
## If you are having trouble with the classic mount method of the modules
|
||||||
|
such as,
|
||||||
|
- **"Reflash needed"** error after reboots
|
||||||
|
- **"Suspicious mount detected"** warnings from root detector apps
|
||||||
|
|
||||||
|
You can consider using [rvmm-zygisk-mount](https://github.com/j-hc/rvmm-zygisk-mount)
|
||||||
|
|
||||||
## Building Locally
|
## Building Locally
|
||||||
### On Termux
|
### On Termux
|
||||||
```console
|
```console
|
||||||
bash <(curl -sSf https://raw.githubusercontent.com/j-hc/revanced-magisk-module/main/build-termux.sh)
|
bash <(curl -sSf https://raw.githubusercontent.com/j-hc/revanced-magisk-module/main/build-termux.sh)
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Desktop
|
### On Linux
|
||||||
```console
|
```console
|
||||||
$ git clone https://github.com/j-hc/revanced-magisk-module
|
$ git clone https://github.com/j-hc/revanced-magisk-module --depth 1
|
||||||
$ cd revanced-magisk-module
|
$ cd revanced-magisk-module
|
||||||
$ ./build.sh
|
$ ./build.sh
|
||||||
```
|
```
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+1
-1
@@ -26,7 +26,7 @@ until
|
|||||||
do sleep 1; done
|
do sleep 1; done
|
||||||
if [ ! -f ~/.rvmm_"$(date '+%Y%m')" ]; then
|
if [ ! -f ~/.rvmm_"$(date '+%Y%m')" ]; then
|
||||||
pr "Setting up environment..."
|
pr "Setting up environment..."
|
||||||
yes "" | pkg update -y && pkg install -y git curl jq openjdk-17 zip
|
yes "" | pkg update -y && pkg upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" && pkg install -y git curl jq openjdk-17 zip
|
||||||
: >~/.rvmm_"$(date '+%Y%m')"
|
: >~/.rvmm_"$(date '+%Y%m')"
|
||||||
fi
|
fi
|
||||||
mkdir -p /sdcard/Download/revanced-magisk-module/
|
mkdir -p /sdcard/Download/revanced-magisk-module/
|
||||||
|
|||||||
@@ -2,14 +2,20 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
trap "rm -rf temp/*tmp.* temp/*/*tmp.* temp/*-temporary-files; exit 130" INT
|
|
||||||
|
source utils.sh
|
||||||
|
|
||||||
|
trap "abort" INT
|
||||||
|
|
||||||
if [ "${1-}" = "clean" ]; then
|
if [ "${1-}" = "clean" ]; then
|
||||||
rm -rf temp build logs build.md
|
rm -r "$TEMP_DIR" "$BUILD_DIR" build.md
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source utils.sh
|
jq --version >/dev/null || abort "\`jq\` is not installed. install it with 'apt install jq' or equivalent"
|
||||||
|
java --version >/dev/null || abort "\`openjdk 17\` is not installed. install it with 'apt install openjdk-17-jre' or equivalent"
|
||||||
|
zip --version >/dev/null || abort "\`zip\` is not installed. install it with 'apt install zip' or equivalent"
|
||||||
|
|
||||||
set_prebuilts
|
set_prebuilts
|
||||||
|
|
||||||
vtf() { if ! isoneof "${1}" "true" "false"; then abort "ERROR: '${1}' is not a valid option for '${2}': only true or false is allowed"; fi; }
|
vtf() { if ! isoneof "${1}" "true" "false"; then abort "ERROR: '${1}' is not a valid option for '${2}': only true or false is allowed"; fi; }
|
||||||
@@ -25,8 +31,9 @@ REMOVE_RV_INTEGRATIONS_CHECKS=$(toml_get "$main_config_t" remove-rv-integrations
|
|||||||
DEF_PATCHES_VER=$(toml_get "$main_config_t" patches-version) || DEF_PATCHES_VER="latest"
|
DEF_PATCHES_VER=$(toml_get "$main_config_t" patches-version) || DEF_PATCHES_VER="latest"
|
||||||
DEF_CLI_VER=$(toml_get "$main_config_t" cli-version) || DEF_CLI_VER="latest"
|
DEF_CLI_VER=$(toml_get "$main_config_t" cli-version) || DEF_CLI_VER="latest"
|
||||||
DEF_PATCHES_SRC=$(toml_get "$main_config_t" patches-source) || DEF_PATCHES_SRC="ReVanced/revanced-patches"
|
DEF_PATCHES_SRC=$(toml_get "$main_config_t" patches-source) || DEF_PATCHES_SRC="ReVanced/revanced-patches"
|
||||||
DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="j-hc/revanced-cli"
|
DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="ReVanced/revanced-cli"
|
||||||
DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced"
|
DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced"
|
||||||
|
DEF_DPI_LIST=$(toml_get "$main_config_t" dpi) || DEF_DPI_LIST="nodpi anydpi"
|
||||||
mkdir -p "$TEMP_DIR" "$BUILD_DIR"
|
mkdir -p "$TEMP_DIR" "$BUILD_DIR"
|
||||||
|
|
||||||
if [ "${2-}" = "--config-update" ]; then
|
if [ "${2-}" = "--config-update" ]; then
|
||||||
@@ -35,21 +42,17 @@ if [ "${2-}" = "--config-update" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
: >build.md
|
: >build.md
|
||||||
ENABLE_MAGISK_UPDATE=$(toml_get "$main_config_t" enable-magisk-update) || ENABLE_MAGISK_UPDATE=true
|
ENABLE_MODULE_UPDATE=$(toml_get "$main_config_t" enable-module-update) || ENABLE_MODULE_UPDATE=true
|
||||||
if [ "$ENABLE_MAGISK_UPDATE" = true ] && [ -z "${GITHUB_REPOSITORY-}" ]; then
|
if [ "$ENABLE_MODULE_UPDATE" = true ] && [ -z "${GITHUB_REPOSITORY-}" ]; then
|
||||||
pr "You are building locally. Magisk updates will not be enabled."
|
pr "You are building locally. Module updates will not be enabled."
|
||||||
ENABLE_MAGISK_UPDATE=false
|
ENABLE_MODULE_UPDATE=false
|
||||||
fi
|
fi
|
||||||
if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 0)); then abort "compression-level must be within 0-9"; fi
|
if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 0)); then abort "compression-level must be within 0-9"; fi
|
||||||
|
|
||||||
jq --version >/dev/null || abort "\`jq\` is not installed. install it with 'apt install jq' or equivalent"
|
rm -rf module/bin/*/tmp.*
|
||||||
java --version >/dev/null || abort "\`openjdk 17\` is not installed. install it with 'apt install openjdk-17-jre' or equivalent"
|
for file in "$TEMP_DIR"/*/changelog.md; do
|
||||||
zip --version >/dev/null || abort "\`zip\` is not installed. install it with 'apt install zip' or equivalent"
|
[ -f "$file" ] && : >"$file"
|
||||||
|
done
|
||||||
rm -rf revanced-magisk/bin/*/tmp.*
|
|
||||||
if [ "$(echo "$TEMP_DIR"/*-rv/changelog.md)" ]; then
|
|
||||||
: >"$TEMP_DIR"/*-rv/changelog.md || :
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm64 ${MODULE_TEMPLATE_DIR}/bin/arm ${MODULE_TEMPLATE_DIR}/bin/x86 ${MODULE_TEMPLATE_DIR}/bin/x64
|
mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm64 ${MODULE_TEMPLATE_DIR}/bin/arm ${MODULE_TEMPLATE_DIR}/bin/x86 ${MODULE_TEMPLATE_DIR}/bin/x64
|
||||||
gh_dl "${MODULE_TEMPLATE_DIR}/bin/arm64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-arm64-v8a"
|
gh_dl "${MODULE_TEMPLATE_DIR}/bin/arm64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-arm64-v8a"
|
||||||
@@ -57,7 +60,6 @@ gh_dl "${MODULE_TEMPLATE_DIR}/bin/arm/cmpr" "https://github.com/j-hc/cmpr/releas
|
|||||||
gh_dl "${MODULE_TEMPLATE_DIR}/bin/x86/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-x86"
|
gh_dl "${MODULE_TEMPLATE_DIR}/bin/x86/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-x86"
|
||||||
gh_dl "${MODULE_TEMPLATE_DIR}/bin/x64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-x86_64"
|
gh_dl "${MODULE_TEMPLATE_DIR}/bin/x64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-x86_64"
|
||||||
|
|
||||||
declare -A cliriplib
|
|
||||||
idx=0
|
idx=0
|
||||||
for table_name in $(toml_get_table_names); do
|
for table_name in $(toml_get_table_names); do
|
||||||
if [ -z "$table_name" ]; then continue; fi
|
if [ -z "$table_name" ]; then continue; fi
|
||||||
@@ -76,22 +78,13 @@ for table_name in $(toml_get_table_names); do
|
|||||||
cli_src=$(toml_get "$t" cli-source) || cli_src=$DEF_CLI_SRC
|
cli_src=$(toml_get "$t" cli-source) || cli_src=$DEF_CLI_SRC
|
||||||
cli_ver=$(toml_get "$t" cli-version) || cli_ver=$DEF_CLI_VER
|
cli_ver=$(toml_get "$t" cli-version) || cli_ver=$DEF_CLI_VER
|
||||||
|
|
||||||
if ! RVP="$(get_rv_prebuilts "$cli_src" "$cli_ver" "$patches_src" "$patches_ver")"; then
|
if ! PREBUILTS="$(get_prebuilts "$cli_src" "$cli_ver" "$patches_src" "$patches_ver")"; then
|
||||||
abort "could not download rv prebuilts"
|
epr "Could not get prebuilts"
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
read -r rv_cli_jar rv_patches_jar <<<"$RVP"
|
read -r cli_jar patches_jar <<<"$PREBUILTS"
|
||||||
app_args[cli]=$rv_cli_jar
|
app_args[cli]=$cli_jar
|
||||||
app_args[ptjar]=$rv_patches_jar
|
app_args[ptjar]=$patches_jar
|
||||||
if [[ -v cliriplib[${app_args[cli]}] ]]; then app_args[riplib]=${cliriplib[${app_args[cli]}]}; else
|
|
||||||
if [[ $(java -jar "${app_args[cli]}" patch 2>&1) == *rip-lib* ]]; then
|
|
||||||
cliriplib[${app_args[cli]}]=true
|
|
||||||
app_args[riplib]=true
|
|
||||||
else
|
|
||||||
cliriplib[${app_args[cli]}]=false
|
|
||||||
app_args[riplib]=false
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ "${app_args[riplib]}" = "true" ] && [ "$(toml_get "$t" riplib)" = "false" ]; then app_args[riplib]=false; fi
|
|
||||||
app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]=$DEF_RV_BRAND
|
app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]=$DEF_RV_BRAND
|
||||||
|
|
||||||
app_args[excluded_patches]=$(toml_get "$t" excluded-patches) || app_args[excluded_patches]=""
|
app_args[excluded_patches]=$(toml_get "$t" excluded-patches) || app_args[excluded_patches]=""
|
||||||
@@ -108,48 +101,39 @@ for table_name in $(toml_get_table_names); do
|
|||||||
abort "ERROR: build-mode '${app_args[build_mode]}' is not a valid option for '${table_name}': only 'both', 'apk' or 'module' is allowed"
|
abort "ERROR: build-mode '${app_args[build_mode]}' is not a valid option for '${table_name}': only 'both', 'apk' or 'module' is allowed"
|
||||||
fi
|
fi
|
||||||
} || app_args[build_mode]=apk
|
} || app_args[build_mode]=apk
|
||||||
app_args[uptodown_dlurl]=$(toml_get "$t" uptodown-dlurl) && {
|
|
||||||
app_args[uptodown_dlurl]=${app_args[uptodown_dlurl]%/}
|
for dl_from in "${DL_SRCS[@]}"; do
|
||||||
app_args[uptodown_dlurl]=${app_args[uptodown_dlurl]%download}
|
if app_args[${dl_from}_dlurl]=$(toml_get "$t" "${dl_from}-dlurl"); then
|
||||||
app_args[uptodown_dlurl]=${app_args[uptodown_dlurl]%/}
|
app_args[${dl_from}_dlurl]=${app_args[${dl_from}_dlurl]%/}
|
||||||
app_args[dl_from]=uptodown
|
app_args[${dl_from}_dlurl]=${app_args[${dl_from}_dlurl]%download}
|
||||||
} || app_args[uptodown_dlurl]=""
|
app_args[${dl_from}_dlurl]=${app_args[${dl_from}_dlurl]%/}
|
||||||
app_args[apkmirror_dlurl]=$(toml_get "$t" apkmirror-dlurl) && {
|
app_args[dl_from]=${dl_from}
|
||||||
app_args[apkmirror_dlurl]=${app_args[apkmirror_dlurl]%/}
|
else
|
||||||
app_args[dl_from]=apkmirror
|
app_args[${dl_from}_dlurl]=""
|
||||||
} || app_args[apkmirror_dlurl]=""
|
fi
|
||||||
app_args[archive_dlurl]=$(toml_get "$t" archive-dlurl) && {
|
done
|
||||||
app_args[archive_dlurl]=${app_args[archive_dlurl]%/}
|
if [ -z "${app_args[dl_from]-}" ]; then abort "ERROR: no 'dlurl' option was set for '$table_name'. (${DL_SRCS[*]})"; fi
|
||||||
app_args[dl_from]=archive
|
|
||||||
} || app_args[archive_dlurl]=""
|
|
||||||
if [ -z "${app_args[dl_from]-}" ]; then abort "ERROR: no 'apkmirror_dlurl', 'uptodown_dlurl' or 'archive_dlurl' option was set for '$table_name'."; fi
|
|
||||||
app_args[arch]=$(toml_get "$t" arch) || app_args[arch]="all"
|
app_args[arch]=$(toml_get "$t" arch) || app_args[arch]="all"
|
||||||
if [ "${app_args[arch]}" != "both" ] && [ "${app_args[arch]}" != "all" ] && [[ ${app_args[arch]} != "arm64-v8a"* ]] && [[ ${app_args[arch]} != "arm-v7a"* ]]; then
|
if ! isoneof "${app_args[arch]}" "both" "all" "arm64-v8a" "arm-v7a" "x86_64" "x86"; then
|
||||||
abort "wrong arch '${app_args[arch]}' for '$table_name'"
|
abort "wrong arch '${app_args[arch]}' for '$table_name'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
app_args[include_stock]=$(toml_get "$t" include-stock) || app_args[include_stock]=true && vtf "${app_args[include_stock]}" "include-stock"
|
app_args[include_stock]=$(toml_get "$t" include-stock) || app_args[include_stock]=true && vtf "${app_args[include_stock]}" "include-stock"
|
||||||
app_args[dpi]=$(toml_get "$t" apkmirror-dpi) || app_args[dpi]="nodpi"
|
app_args[dpi]=$(toml_get "$t" dpi) || app_args[dpi]="$DEF_DPI_LIST"
|
||||||
table_name_f=${table_name,,}
|
table_name_f=${table_name,,}
|
||||||
table_name_f=${table_name_f// /-}
|
table_name_f=${table_name_f// /-}
|
||||||
app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || {
|
app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || app_args[module_prop_name]="${table_name_f}-jhc"
|
||||||
app_args[module_prop_name]="${table_name_f}-jhc"
|
|
||||||
if [ "${app_args[arch]}" = "arm64-v8a" ]; then
|
|
||||||
app_args[module_prop_name]="${app_args[module_prop_name]}-arm64"
|
|
||||||
elif [ "${app_args[arch]}" = "arm-v7a" ]; then
|
|
||||||
app_args[module_prop_name]="${app_args[module_prop_name]}-arm"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "${app_args[arch]}" = both ]; then
|
if [ "${app_args[arch]}" = both ]; then
|
||||||
app_args[table]="$table_name (arm64-v8a)"
|
app_args[table]="$table_name (arm64-v8a)"
|
||||||
app_args[arch]="arm64-v8a"
|
app_args[arch]="arm64-v8a"
|
||||||
app_args[module_prop_name]="${app_args[module_prop_name]}-arm64"
|
module_prop_name_b=${app_args[module_prop_name]}
|
||||||
|
app_args[module_prop_name]="${module_prop_name_b}-arm64"
|
||||||
idx=$((idx + 1))
|
idx=$((idx + 1))
|
||||||
build_rv "$(declare -p app_args)" &
|
build_rv "$(declare -p app_args)" &
|
||||||
app_args[table]="$table_name (arm-v7a)"
|
app_args[table]="$table_name (arm-v7a)"
|
||||||
app_args[arch]="arm-v7a"
|
app_args[arch]="arm-v7a"
|
||||||
app_args[module_prop_name]="${app_args[module_prop_name]}-arm"
|
app_args[module_prop_name]="${module_prop_name_b}-arm"
|
||||||
if ((idx >= PARALLEL_JOBS)); then
|
if ((idx >= PARALLEL_JOBS)); then
|
||||||
wait -n
|
wait -n
|
||||||
idx=$((idx - 1))
|
idx=$((idx - 1))
|
||||||
@@ -157,6 +141,11 @@ for table_name in $(toml_get_table_names); do
|
|||||||
idx=$((idx + 1))
|
idx=$((idx + 1))
|
||||||
build_rv "$(declare -p app_args)" &
|
build_rv "$(declare -p app_args)" &
|
||||||
else
|
else
|
||||||
|
if [ "${app_args[arch]}" = "arm64-v8a" ]; then
|
||||||
|
app_args[module_prop_name]="${app_args[module_prop_name]}-arm64"
|
||||||
|
elif [ "${app_args[arch]}" = "arm-v7a" ]; then
|
||||||
|
app_args[module_prop_name]="${app_args[module_prop_name]}-arm"
|
||||||
|
fi
|
||||||
idx=$((idx + 1))
|
idx=$((idx + 1))
|
||||||
build_rv "$(declare -p app_args)" &
|
build_rv "$(declare -p app_args)" &
|
||||||
fi
|
fi
|
||||||
@@ -165,10 +154,9 @@ wait
|
|||||||
rm -rf temp/tmp.*
|
rm -rf temp/tmp.*
|
||||||
if [ -z "$(ls -A1 "${BUILD_DIR}")" ]; then abort "All builds failed."; fi
|
if [ -z "$(ls -A1 "${BUILD_DIR}")" ]; then abort "All builds failed."; fi
|
||||||
|
|
||||||
log "\nInstall [Microg](https://github.com/ReVanced/GmsCore/releases) for non-root YouTube and YT Music APKs"
|
log "\nInstall [MicroG-RE](https://github.com/MorpheApp/MicroG-RE/releases) for non-root YouTube and YT Music APKs"
|
||||||
log "Use [zygisk-detach](https://github.com/j-hc/zygisk-detach) to detach root ReVanced YouTube and YT Music from Play Store"
|
log "Use [zygisk-detach](https://github.com/j-hc/zygisk-detach) to detach YouTube and YT Music modules from Play Store"
|
||||||
log "\n[revanced-magisk-module](https://github.com/j-hc/revanced-magisk-module)\n"
|
log "$(cat "$TEMP_DIR"/*/changelog.md)"
|
||||||
log "$(cat "$TEMP_DIR"/*-rv/changelog.md)"
|
|
||||||
|
|
||||||
SKIPPED=$(cat "$TEMP_DIR"/skipped 2>/dev/null || :)
|
SKIPPED=$(cat "$TEMP_DIR"/skipped 2>/dev/null || :)
|
||||||
if [ -n "$SKIPPED" ]; then
|
if [ -n "$SKIPPED" ]; then
|
||||||
|
|||||||
+44
-63
@@ -1,4 +1,4 @@
|
|||||||
enable-magisk-update = false # set this to false if you do not want to receive updates for the module in magisk app
|
enable-module-update = true # set this to false if you do not want to receive updates for the module
|
||||||
parallel-jobs = 1
|
parallel-jobs = 1
|
||||||
|
|
||||||
# add 'enabled = false' for not patching a specific app or remove it from the config
|
# add 'enabled = false' for not patching a specific app or remove it from the config
|
||||||
@@ -7,78 +7,59 @@ parallel-jobs = 1
|
|||||||
# you can use rvmm-config-gen to generate a config
|
# you can use rvmm-config-gen to generate a config
|
||||||
|
|
||||||
[YouTube]
|
[YouTube]
|
||||||
build-mode = "apk"
|
build-mode = "both"
|
||||||
excluded-patches = "'Hide timestamp'"
|
|
||||||
included-patches = ""
|
|
||||||
version = "auto"
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
||||||
uptodown-dlurl = "https://youtube.en.uptodown.com/android"
|
uptodown-dlurl = "https://youtube.en.uptodown.com/android"
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
|
||||||
|
|
||||||
|
[YouTube-Morphe]
|
||||||
|
app-name = "YouTube"
|
||||||
|
patches-source = "MorpheApp/morphe-patches"
|
||||||
|
cli-source = "MorpheApp/morphe-cli"
|
||||||
|
rv-brand = "Morphe"
|
||||||
|
build-mode = "both"
|
||||||
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
||||||
|
uptodown-dlurl = "https://youtube.en.uptodown.com/android"
|
||||||
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
|
||||||
|
|
||||||
[Music]
|
[Music]
|
||||||
build-mode = "apk"
|
build-mode = "both"
|
||||||
arch = "both"
|
arch = "both"
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
||||||
uptodown-dlurl = "https://youtube-music.en.uptodown.com/android"
|
uptodown-dlurl = "https://youtube-music.en.uptodown.com/android"
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
||||||
|
|
||||||
[GooglePhotos]
|
[Music-Morphe]
|
||||||
build-mode = "apk"
|
|
||||||
arch = "both"
|
|
||||||
version = "auto"
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/photos/"
|
|
||||||
uptodown-dlurl = "https://google-photos.en.uptodown.com/android"
|
|
||||||
|
|
||||||
[Music-Extended]
|
|
||||||
app-name = "Music"
|
app-name = "Music"
|
||||||
patches-source = "inotia00/revanced-patches"
|
patches-source = "MorpheApp/morphe-patches"
|
||||||
cli-source = "inotia00/revanced-cli"
|
cli-source = "MorpheApp/morphe-cli"
|
||||||
rv-brand = "ReVanced Extended"
|
rv-brand = "Morphe"
|
||||||
build-mode = "apk"
|
build-mode = "both"
|
||||||
arch = "both"
|
arch = "both"
|
||||||
included-patches = "'Custom header for YouTube Music' 'Spoof client'"
|
|
||||||
excluded-patches = "'Custom branding icon for YouTube Music' 'Custom branding name for YouTube Music'"
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
||||||
|
uptodown-dlurl = "https://youtube-music.en.uptodown.com/android"
|
||||||
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
||||||
|
|
||||||
[YouTube-Extended]
|
[Reddit-Morphe]
|
||||||
app-name = "YouTube"
|
app-name = "Reddit"
|
||||||
patches-source = "inotia00/revanced-patches"
|
rv-brand = "Morphe"
|
||||||
cli-source = "inotia00/revanced-cli"
|
build-mode = "both"
|
||||||
rv-brand = "ReVanced Extended"
|
patches-source = "MorpheApp/morphe-patches"
|
||||||
|
cli-source = "MorpheApp/morphe-cli"
|
||||||
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit/"
|
||||||
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.reddit.frontpage"
|
||||||
|
uptodown-dlurl = "https://reddit-official-app.en.uptodown.com/android"
|
||||||
|
dpi = "120-640dpi"
|
||||||
|
|
||||||
|
[Twitch]
|
||||||
|
enabled = false
|
||||||
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/twitch-interactive-inc/twitch/"
|
||||||
|
uptodown-dlurl = "https://twitch.en.uptodown.com/android"
|
||||||
|
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/tv.twitch.android.app"
|
||||||
|
|
||||||
|
[Twitter]
|
||||||
|
enabled = false
|
||||||
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/x-corp/twitter"
|
||||||
build-mode = "apk"
|
build-mode = "apk"
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
dpi = "120-640dpi"
|
||||||
included-patches = "'Custom header for YouTube' 'MaterialYou' 'Hide Shorts dimming'"
|
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.twitter.android"
|
||||||
excluded-patches = "'Custom branding icon for YouTube' 'Custom branding name for YouTube' 'Disable splash animation'"
|
|
||||||
|
|
||||||
[YouTube-Extended-Beta]
|
|
||||||
app-name = "YouTube"
|
|
||||||
patches-source = "inotia00/revanced-patches"
|
|
||||||
patches-version = "dev"
|
|
||||||
cli-source = "inotia00/revanced-cli"
|
|
||||||
rv-brand = "ReVanced Extended"
|
|
||||||
build-mode = "apk"
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
|
||||||
included-patches = "'Custom header for YouTube' 'MaterialYou'"
|
|
||||||
excluded-patches = "'Custom branding icon for YouTube' 'Custom branding name for YouTube' 'Disable splash animation'"
|
|
||||||
|
|
||||||
[Reddit-Extended]
|
|
||||||
patches-source = "inotia00/revanced-patches"
|
|
||||||
cli-source = "inotia00/revanced-cli"
|
|
||||||
rv-brand = "ReVanced Extended"
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit"
|
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.reddit.frontpage"
|
|
||||||
|
|
||||||
|
|
||||||
[TikTok]
|
|
||||||
enabled = false
|
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.zhiliaoapp.musically"
|
|
||||||
included-patches = "'SIM spoof'"
|
|
||||||
|
|
||||||
[Messenger]
|
|
||||||
enabled = false
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/facebook-2/messenger/"
|
|
||||||
arch = "arm64-v8a"
|
|
||||||
|
|
||||||
[Spotify]
|
|
||||||
enabled = false
|
|
||||||
uptodown-dlurl = "https://spotify.en.uptodown.com/android"
|
|
||||||
Binary file not shown.
@@ -0,0 +1,3 @@
|
|||||||
|
libs
|
||||||
|
obj
|
||||||
|
*.mk
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
#include <errno.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define KSU_INSTALL_MAGIC1 0xDEADBEEF
|
||||||
|
#define KSU_INSTALL_MAGIC2 0xCAFEBABE
|
||||||
|
|
||||||
|
#define KSU_APP_PROFILE_VER 2
|
||||||
|
#define KSU_MAX_PACKAGE_NAME 256
|
||||||
|
#define KSU_MAX_GROUPS 32
|
||||||
|
#define KSU_SELINUX_DOMAIN 64
|
||||||
|
|
||||||
|
#define KSU_IOCTL_MAGIC 'K'
|
||||||
|
#define KSU_IOCTL_UID_SHOULD_UMOUNT _IOC(_IOC_READ | _IOC_WRITE, KSU_IOCTL_MAGIC, 9, 0)
|
||||||
|
#define KSU_IOCTL_GET_MANAGER_APPID _IOC(_IOC_READ, KSU_IOCTL_MAGIC, 10, 0)
|
||||||
|
#define KSU_IOCTL_GET_APP_PROFILE _IOC(_IOC_READ | _IOC_WRITE, KSU_IOCTL_MAGIC, 11, 0)
|
||||||
|
#define KSU_IOCTL_SET_APP_PROFILE _IOC(_IOC_WRITE, KSU_IOCTL_MAGIC, 12, 0)
|
||||||
|
|
||||||
|
struct root_profile {
|
||||||
|
int32_t uid;
|
||||||
|
int32_t gid;
|
||||||
|
int32_t groups_count;
|
||||||
|
int32_t groups[KSU_MAX_GROUPS];
|
||||||
|
|
||||||
|
struct {
|
||||||
|
uint64_t effective;
|
||||||
|
uint64_t permitted;
|
||||||
|
uint64_t inheritable;
|
||||||
|
} capabilities;
|
||||||
|
|
||||||
|
char selinux_domain[KSU_SELINUX_DOMAIN];
|
||||||
|
int32_t namespaces;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct non_root_profile {
|
||||||
|
bool umount_modules;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct app_profile {
|
||||||
|
uint32_t version;
|
||||||
|
char key[KSU_MAX_PACKAGE_NAME];
|
||||||
|
int32_t current_uid;
|
||||||
|
bool allow_su;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
bool use_default;
|
||||||
|
char template_name[KSU_MAX_PACKAGE_NAME];
|
||||||
|
struct root_profile profile;
|
||||||
|
} rp_config;
|
||||||
|
struct {
|
||||||
|
bool use_default;
|
||||||
|
struct non_root_profile profile;
|
||||||
|
} nrp_config;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ksu_uid_should_umount_cmd {
|
||||||
|
uint32_t uid;
|
||||||
|
uint8_t should_umount;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ksu_get_manager_appid_cmd {
|
||||||
|
uint32_t appid;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int _fd = -1;
|
||||||
|
#define ksuctl(op, ...) (ioctl(_fd, op, __VA_ARGS__) >= 0)
|
||||||
|
|
||||||
|
#define REPORT_ERR() fprintf(stderr, "%s:%d ERROR: %s\n", __FILE__, __LINE__, strerror(errno));
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
if (argc <= 2) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"ksu_profile (github.com/j-hc)\n"
|
||||||
|
"Disables \"Unmount modules\" for given package\n"
|
||||||
|
" Usage: %s <pkg uid> <pkg name>\n",
|
||||||
|
argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
syscall(SYS_reboot, KSU_INSTALL_MAGIC1, KSU_INSTALL_MAGIC2, 0, &_fd);
|
||||||
|
if (_fd == -1) {
|
||||||
|
REPORT_ERR();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
long uid = atol(argv[1]);
|
||||||
|
|
||||||
|
struct ksu_uid_should_umount_cmd umount_cmd = {0};
|
||||||
|
if (!ksuctl(KSU_IOCTL_UID_SHOULD_UMOUNT, &umount_cmd)) {
|
||||||
|
REPORT_ERR();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (!umount_cmd.should_umount) return 0;
|
||||||
|
|
||||||
|
struct ksu_get_manager_appid_cmd appid_cmd = {0};
|
||||||
|
if (!ksuctl(KSU_IOCTL_GET_MANAGER_APPID, &appid_cmd)) {
|
||||||
|
REPORT_ERR();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setuid(appid_cmd.appid) != 0) {
|
||||||
|
REPORT_ERR();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
struct app_profile profile = {0};
|
||||||
|
profile.current_uid = uid;
|
||||||
|
if (!ksuctl(KSU_IOCTL_GET_APP_PROFILE, &profile)) {
|
||||||
|
printf("Create profile for %s\n", argv[2]);
|
||||||
|
profile.version = KSU_APP_PROFILE_VER;
|
||||||
|
strncpy(profile.key, argv[2], sizeof(profile.key) / sizeof(profile.key[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
profile.nrp_config.use_default = false;
|
||||||
|
profile.nrp_config.profile.umount_modules = false;
|
||||||
|
|
||||||
|
if (!ksuctl(KSU_IOCTL_SET_APP_PROFILE, &profile)) {
|
||||||
|
REPORT_ERR();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#!/sbin/sh
|
||||||
|
|
||||||
|
#################
|
||||||
|
# Initialization
|
||||||
|
#################
|
||||||
|
|
||||||
|
umask 022
|
||||||
|
|
||||||
|
# echo before loading util_functions
|
||||||
|
ui_print() { echo "$1"; }
|
||||||
|
|
||||||
|
require_new_magisk() {
|
||||||
|
ui_print "*******************************"
|
||||||
|
ui_print " Please install Magisk v20.4+! "
|
||||||
|
ui_print "*******************************"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#########################
|
||||||
|
# Load util_functions.sh
|
||||||
|
#########################
|
||||||
|
|
||||||
|
OUTFD=$2
|
||||||
|
ZIPFILE=$3
|
||||||
|
|
||||||
|
mount /data 2>/dev/null
|
||||||
|
|
||||||
|
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
|
||||||
|
. /data/adb/magisk/util_functions.sh
|
||||||
|
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
|
||||||
|
|
||||||
|
install_module
|
||||||
|
exit 0
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#MAGISK
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,206 @@
|
|||||||
|
. "$MODPATH/config"
|
||||||
|
|
||||||
|
ui_print ""
|
||||||
|
if [ -n "$MODULE_ARCH" ] && [ "$MODULE_ARCH" != "$ARCH" ]; then
|
||||||
|
abort "ERROR: Wrong arch
|
||||||
|
Your device: $ARCH
|
||||||
|
Module: $MODULE_ARCH"
|
||||||
|
fi
|
||||||
|
if [ "$ARCH" = "arm" ]; then
|
||||||
|
ARCH_LIB=armeabi-v7a
|
||||||
|
elif [ "$ARCH" = "arm64" ]; then
|
||||||
|
ARCH_LIB=arm64-v8a
|
||||||
|
elif [ "$ARCH" = "x86" ]; then
|
||||||
|
ARCH_LIB=x86
|
||||||
|
elif [ "$ARCH" = "x64" ]; then
|
||||||
|
ARCH_LIB=x86_64
|
||||||
|
else abort "ERROR: unreachable: ${ARCH}"; fi
|
||||||
|
RVPATH=/data/adb/rvhc/${MODPATH##*/}.apk
|
||||||
|
|
||||||
|
set_perm_recursive "$MODPATH/bin" 0 0 0755 0777
|
||||||
|
|
||||||
|
if su -M -c true >/dev/null 2>/dev/null; then
|
||||||
|
alias mm='su -M -c'
|
||||||
|
else alias mm='nsenter -t1 -m'; fi
|
||||||
|
|
||||||
|
mm grep -F "$PKG_NAME" /proc/mounts | while read -r line; do
|
||||||
|
ui_print "* Un-mount"
|
||||||
|
mp=${line#* } mp=${mp%% *}
|
||||||
|
mm umount -l "${mp%%\\*}"
|
||||||
|
done
|
||||||
|
am force-stop "$PKG_NAME"
|
||||||
|
|
||||||
|
pmex() {
|
||||||
|
OP=$(pm "$@" 2>&1 </dev/null)
|
||||||
|
RET=$?
|
||||||
|
echo "$OP"
|
||||||
|
return $RET
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! pmex path "$PKG_NAME" >&2; then
|
||||||
|
if pmex install-existing "$PKG_NAME" >&2; then
|
||||||
|
pmex uninstall-system-updates "$PKG_NAME"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
IS_SYS=false
|
||||||
|
INS=true
|
||||||
|
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
||||||
|
echo >&2 "'$BASEPATH'"
|
||||||
|
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||||
|
if [ "${BASEPATH:1:4}" != data ]; then
|
||||||
|
ui_print "* $PKG_NAME is a system app."
|
||||||
|
IS_SYS=true
|
||||||
|
elif [ ! -f "$MODPATH/$PKG_NAME.apk" ]; then
|
||||||
|
ui_print "* Stock $PKG_NAME APK was not found"
|
||||||
|
VERSION=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 versionName) VERSION="${VERSION#*=}"
|
||||||
|
if [ "$VERSION" = "$PKG_VER" ] || [ -z "$VERSION" ]; then
|
||||||
|
ui_print "* Skipping stock installation"
|
||||||
|
INS=false
|
||||||
|
else
|
||||||
|
abort "ERROR: Version mismatch
|
||||||
|
installed: $VERSION
|
||||||
|
module: $PKG_VER
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
elif "${MODPATH:?}/bin/$ARCH/cmpr" "$BASEPATH/base.apk" "$MODPATH/$PKG_NAME.apk"; then
|
||||||
|
ui_print "* $PKG_NAME is up-to-date"
|
||||||
|
INS=false
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
install() {
|
||||||
|
if [ ! -f "$MODPATH/$PKG_NAME.apk" ]; then
|
||||||
|
abort "ERROR: Stock $PKG_NAME apk was not found"
|
||||||
|
fi
|
||||||
|
ui_print "* Updating $PKG_NAME to $PKG_VER"
|
||||||
|
install_err=""
|
||||||
|
VERIF1=$(settings get global verifier_verify_adb_installs)
|
||||||
|
VERIF2=$(settings get global package_verifier_enable)
|
||||||
|
settings put global verifier_verify_adb_installs 0
|
||||||
|
settings put global package_verifier_enable 0
|
||||||
|
SZ=$(stat -c "%s" "$MODPATH/$PKG_NAME.apk")
|
||||||
|
for IT in 1 2; do
|
||||||
|
if ! SES=$(pmex install-create --user 0 -i com.android.vending -r -d -S "$SZ"); then
|
||||||
|
ui_print "ERROR: install-create failed"
|
||||||
|
install_err="$SES"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
SES=${SES#*[} SES=${SES%]*}
|
||||||
|
set_perm "$MODPATH/$PKG_NAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0
|
||||||
|
if ! op=$(pmex install-write -S "$SZ" "$SES" "$PKG_NAME.apk" "$MODPATH/$PKG_NAME.apk"); then
|
||||||
|
ui_print "ERROR: install-write failed"
|
||||||
|
install_err="$op"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if ! op=$(pmex install-commit "$SES"); then
|
||||||
|
ui_print "$op"
|
||||||
|
if echo "$op" | grep -q -e INSTALL_FAILED_VERSION_DOWNGRADE -e INSTALL_FAILED_UPDATE_INCOMPATIBLE; then
|
||||||
|
ui_print "* Handling install error"
|
||||||
|
pmex uninstall-system-updates "$PKG_NAME"
|
||||||
|
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
||||||
|
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||||
|
if [ "${BASEPATH:1:4}" != data ]; then IS_SYS=true; fi
|
||||||
|
fi
|
||||||
|
if [ "$IS_SYS" = true ]; then
|
||||||
|
SCNM="/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
|
||||||
|
if [ -f "$SCNM" ]; then
|
||||||
|
ui_print "* Remove the old module. Reboot and reflash!"
|
||||||
|
ui_print ""
|
||||||
|
install_err=" "
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
mkdir -p /data/adb/rvhc/empty /data/adb/post-fs-data.d
|
||||||
|
echo "mount -o bind /data/adb/rvhc/empty $BASEPATH" >"$SCNM"
|
||||||
|
chmod +x "$SCNM"
|
||||||
|
ui_print "* Created the uninstall script."
|
||||||
|
ui_print ""
|
||||||
|
ui_print "* Reboot and reflash the module!"
|
||||||
|
install_err=" "
|
||||||
|
break
|
||||||
|
else
|
||||||
|
ui_print "* Uninstalling..."
|
||||||
|
if ! op=$(pmex uninstall -k --user 0 "$PKG_NAME"); then
|
||||||
|
ui_print "$op"
|
||||||
|
if [ $IT = 2 ]; then
|
||||||
|
install_err="ERROR: pm uninstall failed."
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
ui_print "ERROR: install-commit failed"
|
||||||
|
install_err="$op"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
||||||
|
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||||
|
else
|
||||||
|
install_err=" "
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
break
|
||||||
|
done
|
||||||
|
settings put global verifier_verify_adb_installs "$VERIF1"
|
||||||
|
settings put global package_verifier_enable "$VERIF2"
|
||||||
|
if [ "$install_err" ]; then
|
||||||
|
ui_print "$install_err"
|
||||||
|
abort "ERROR: disable the module, reboot, install $PKG_NAME manually and reflash again"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
if [ $INS = true ] && ! install; then abort; fi
|
||||||
|
BASEPATHLIB=${BASEPATH}/lib/${ARCH}
|
||||||
|
if [ $INS = true ] || [ -z "$(ls -A1 "$BASEPATHLIB")" ]; then
|
||||||
|
ui_print "* Extracting native libs"
|
||||||
|
if [ ! -d "$BASEPATHLIB" ]; then mkdir -p "$BASEPATHLIB"; else rm -f "$BASEPATHLIB"/* >/dev/null 2>&1 || :; fi
|
||||||
|
if ! op=$(unzip -o -j "$MODPATH/$PKG_NAME.apk" "lib/${ARCH_LIB}/*" -d "$BASEPATHLIB" 2>&1); then
|
||||||
|
ui_print "ERROR: extracting native libs failed"
|
||||||
|
abort "$op"
|
||||||
|
fi
|
||||||
|
set_perm_recursive "${BASEPATH}/lib" 1000 1000 755 755 u:object_r:apk_data_file:s0
|
||||||
|
fi
|
||||||
|
|
||||||
|
ui_print "* Setting Permissions"
|
||||||
|
set_perm "$MODPATH/base.apk" 1000 1000 644 u:object_r:apk_data_file:s0
|
||||||
|
|
||||||
|
ui_print "* Mounting $PKG_NAME"
|
||||||
|
mkdir -p "/data/adb/rvhc"
|
||||||
|
RVPATH=/data/adb/rvhc/${MODPATH##*/}.apk
|
||||||
|
mv -f "$MODPATH/base.apk" "$RVPATH"
|
||||||
|
|
||||||
|
if ! op=$(mm mount -o bind "$RVPATH" "$BASEPATH/base.apk" 2>&1); then
|
||||||
|
ui_print "ERROR: Mount failed!"
|
||||||
|
ui_print "$op"
|
||||||
|
fi
|
||||||
|
am force-stop "$PKG_NAME"
|
||||||
|
ui_print "* Optimizing $PKG_NAME"
|
||||||
|
|
||||||
|
cmd package compile -m speed-profile -f "$PKG_NAME"
|
||||||
|
# nohup cmd package compile -m speed-profile -f "$PKG_NAME" >/dev/null 2>&1
|
||||||
|
|
||||||
|
if [ "$KSU" ]; then
|
||||||
|
UID=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 uid)
|
||||||
|
UID=${UID#*=} UID=${UID%% *}
|
||||||
|
if [ -z "$UID" ]; then
|
||||||
|
UID=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 userId)
|
||||||
|
UID=${UID#*=} UID=${UID%% *}
|
||||||
|
fi
|
||||||
|
if [ "$UID" ]; then
|
||||||
|
if ! OP=$("${MODPATH:?}/bin/$ARCH/ksu_profile" "$UID" "$PKG_NAME" 2>&1); then
|
||||||
|
ui_print " $OP"
|
||||||
|
ui_print "* Because you are using a fork of KernelSU, "
|
||||||
|
ui_print " you need to go to your root manager app and"
|
||||||
|
ui_print " disable 'Unmount modules' option for $PKG_NAME"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
ui_print "ERROR: UID could not be found for $PKG_NAME"
|
||||||
|
dumpsys package "$PKG_NAME" >&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf "${MODPATH:?}/bin" "$MODPATH/$PKG_NAME.apk"
|
||||||
|
|
||||||
|
ui_print "* Done"
|
||||||
|
ui_print " by j-hc (github.com/j-hc)"
|
||||||
|
ui_print " "
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
#!/system/bin/sh
|
||||||
|
MODDIR=${0%/*}
|
||||||
|
RVPATH=/data/adb/rvhc/${MODDIR##*/}.apk
|
||||||
|
. "$MODDIR/config"
|
||||||
|
|
||||||
|
err() {
|
||||||
|
[ ! -f "$MODDIR/err" ] && cp "$MODDIR/module.prop" "$MODDIR/err"
|
||||||
|
sed -i "s/^des.*/description=⚠️ Needs reflash: '${1}'/g" "$MODDIR/module.prop"
|
||||||
|
}
|
||||||
|
|
||||||
|
until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done
|
||||||
|
until [ -d "/sdcard/Android" ]; do sleep 1; done
|
||||||
|
while
|
||||||
|
BASEPATH=$(pm path "$PKG_NAME" 2>&1 </dev/null)
|
||||||
|
SVCL=$?
|
||||||
|
[ $SVCL = 20 ]
|
||||||
|
do sleep 2; done
|
||||||
|
|
||||||
|
run() {
|
||||||
|
if [ $SVCL != 0 ]; then
|
||||||
|
err "app not installed"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
sleep 4
|
||||||
|
|
||||||
|
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||||
|
if [ ! -d "$BASEPATH/lib" ]; then
|
||||||
|
err "mount failed (ROM issue). Dont report this, consider using rvmm-zygisk-mount."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
VERSION=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 versionName) VERSION="${VERSION#*=}"
|
||||||
|
if [ "$VERSION" != "$PKG_VER" ] && [ "$VERSION" ]; then
|
||||||
|
err "version mismatch (installed:${VERSION}, module:$PKG_VER)"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
grep "$PKG_NAME" /proc/mounts | while read -r line; do
|
||||||
|
mp=${line#* } mp=${mp%% *}
|
||||||
|
umount -l "${mp%%\\*}"
|
||||||
|
done
|
||||||
|
if ! chcon u:object_r:apk_data_file:s0 "$RVPATH"; then
|
||||||
|
err "apk not found"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
mount -o bind "$RVPATH" "$BASEPATH/base.apk"
|
||||||
|
am force-stop "$PKG_NAME"
|
||||||
|
[ -f "$MODDIR/err" ] && mv -f "$MODDIR/err" "$MODDIR/module.prop"
|
||||||
|
}
|
||||||
|
|
||||||
|
run
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#!/system/bin/sh
|
||||||
|
{
|
||||||
|
|
||||||
|
until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done
|
||||||
|
until [ -d "/sdcard/Android" ]; do sleep 1; done
|
||||||
|
|
||||||
|
MODDIR=${0%/*}
|
||||||
|
. "$MODDIR/config"
|
||||||
|
|
||||||
|
rm "/data/adb/rvhc/${MODDIR##*/}.apk"
|
||||||
|
rmdir "/data/adb/rvhc"
|
||||||
|
rm "/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
|
||||||
|
} &
|
||||||
@@ -84,21 +84,24 @@ install() {
|
|||||||
abort "ERROR: Stock $PKG_NAME apk was not found"
|
abort "ERROR: Stock $PKG_NAME apk was not found"
|
||||||
fi
|
fi
|
||||||
ui_print "* Updating $PKG_NAME to $PKG_VER"
|
ui_print "* Updating $PKG_NAME to $PKG_VER"
|
||||||
VERIF_ADB=$(settings get global verifier_verify_adb_installs)
|
install_err=""
|
||||||
|
VERIF1=$(settings get global verifier_verify_adb_installs)
|
||||||
|
VERIF2=$(settings get global package_verifier_enable)
|
||||||
settings put global verifier_verify_adb_installs 0
|
settings put global verifier_verify_adb_installs 0
|
||||||
|
settings put global package_verifier_enable 0
|
||||||
SZ=$(stat -c "%s" "$MODPATH/$PKG_NAME.apk")
|
SZ=$(stat -c "%s" "$MODPATH/$PKG_NAME.apk")
|
||||||
for IT in 1 2; do
|
for IT in 1 2; do
|
||||||
if ! SES=$(pmex install-create --user 0 -i com.android.vending -r -d -S "$SZ"); then
|
if ! SES=$(pmex install-create --user 0 -i com.android.vending -r -d -S "$SZ"); then
|
||||||
ui_print "ERROR: install-create failed"
|
ui_print "ERROR: install-create failed"
|
||||||
settings put global verifier_verify_adb_installs "$VERIF_ADB"
|
install_err="$SES"
|
||||||
abort "$SES"
|
break
|
||||||
fi
|
fi
|
||||||
SES=${SES#*[} SES=${SES%]*}
|
SES=${SES#*[} SES=${SES%]*}
|
||||||
set_perm "$MODPATH/$PKG_NAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0
|
set_perm "$MODPATH/$PKG_NAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0
|
||||||
if ! op=$(pmex install-write -S "$SZ" "$SES" "$PKG_NAME.apk" "$MODPATH/$PKG_NAME.apk"); then
|
if ! op=$(pmex install-write -S "$SZ" "$SES" "$PKG_NAME.apk" "$MODPATH/$PKG_NAME.apk"); then
|
||||||
ui_print "ERROR: install-write failed"
|
ui_print "ERROR: install-write failed"
|
||||||
settings put global verifier_verify_adb_installs "$VERIF_ADB"
|
install_err="$op"
|
||||||
abort "$op"
|
break
|
||||||
fi
|
fi
|
||||||
if ! op=$(pmex install-commit "$SES"); then
|
if ! op=$(pmex install-commit "$SES"); then
|
||||||
if echo "$op" | grep -q INSTALL_FAILED_VERSION_DOWNGRADE; then
|
if echo "$op" | grep -q INSTALL_FAILED_VERSION_DOWNGRADE; then
|
||||||
@@ -111,29 +114,35 @@ install() {
|
|||||||
ui_print "* Created the uninstall script."
|
ui_print "* Created the uninstall script."
|
||||||
ui_print ""
|
ui_print ""
|
||||||
ui_print "* Reboot and reflash the module!"
|
ui_print "* Reboot and reflash the module!"
|
||||||
abort
|
install_err=" "
|
||||||
|
break
|
||||||
else
|
else
|
||||||
ui_print "* Uninstalling..."
|
ui_print "* Uninstalling..."
|
||||||
if ! op=$(pmex uninstall -k --user 0 "$PKG_NAME"); then
|
if ! op=$(pmex uninstall -k --user 0 "$PKG_NAME"); then
|
||||||
ui_print "$op"
|
ui_print "$op"
|
||||||
if [ $IT = 2 ]; then abort "ERROR: pm uninstall failed."; fi
|
if [ $IT = 2 ]; then
|
||||||
|
install_err="ERROR: pm uninstall failed."
|
||||||
|
break
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
ui_print "ERROR: install-commit failed"
|
ui_print "ERROR: install-commit failed"
|
||||||
settings put global verifier_verify_adb_installs "$VERIF_ADB"
|
install_err="$op"
|
||||||
abort "$op"
|
break
|
||||||
fi
|
fi
|
||||||
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
||||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||||
else
|
else
|
||||||
settings put global verifier_verify_adb_installs "$VERIF_ADB"
|
install_err="ERROR: install $PKG_NAME manually and reflash the module"
|
||||||
abort "ERROR: install $PKG_NAME manually and reflash the module"
|
break
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
settings put global verifier_verify_adb_installs "$VERIF_ADB"
|
settings put global verifier_verify_adb_installs "$VERIF1"
|
||||||
|
settings put global package_verifier_enable "$VERIF2"
|
||||||
|
if [ "$install_err" ]; then abort "$install_err"; fi
|
||||||
}
|
}
|
||||||
if [ $INS = true ] && ! install; then abort; fi
|
if [ $INS = true ] && ! install; then abort; fi
|
||||||
BASEPATHLIB=${BASEPATH}/lib/${ARCH}
|
BASEPATHLIB=${BASEPATH}/lib/${ARCH}
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ a2a1ad7ba7f41dfca4514e2afeb90691719af6d0fdbed4b09bbf0ed897701ceb com.google.andr
|
|||||||
3d7a1223019aa39d9ea0e3436ab7c0896bfb4fb679f4de5fe7c23f326c8f994a com.google.android.youtube
|
3d7a1223019aa39d9ea0e3436ab7c0896bfb4fb679f4de5fe7c23f326c8f994a com.google.android.youtube
|
||||||
970b91143813b4c9d5f3634f672c9fcaa5621b4efaaedafd6c235cbbb869736f com.reddit.frontpage
|
970b91143813b4c9d5f3634f672c9fcaa5621b4efaaedafd6c235cbbb869736f com.reddit.frontpage
|
||||||
9041803e91bcb814b4b4399fb5c85a91640b755e5e8ba76813814bf4cf2ab5ba com.zhiliaoapp.musically
|
9041803e91bcb814b4b4399fb5c85a91640b755e5e8ba76813814bf4cf2ab5ba com.zhiliaoapp.musically
|
||||||
1338f9b049893cc70b78432a177582f90bd4bc6296ea4ed35bcc7df59687ac53 tv.twitch.android.app
|
1338f9b049893cc70b78432a177582f90bd4bc6296ea4ed35bcc7df59687ac53 tv.twitch.android.app
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
MODULE_TEMPLATE_DIR="revanced-magisk"
|
MODULE_TEMPLATE_DIR="module"
|
||||||
CWD=$(pwd)
|
CWD=$(pwd)
|
||||||
TEMP_DIR="temp"
|
TEMP_DIR="temp"
|
||||||
BIN_DIR="bin"
|
BIN_DIR="bin"
|
||||||
BUILD_DIR="build"
|
BUILD_DIR="build"
|
||||||
|
DL_SRCS=("direct" "archive" "apkmirror" "uptodown")
|
||||||
|
|
||||||
if [ "${GITHUB_TOKEN-}" ]; then GH_HEADER="Authorization: token ${GITHUB_TOKEN}"; else GH_HEADER=; fi
|
if [ "${GITHUB_TOKEN-}" ]; then GH_HEADER="Authorization: token ${GITHUB_TOKEN}"; else GH_HEADER=; fi
|
||||||
NEXT_VER_CODE=${NEXT_VER_CODE:-$(date +'%Y%m%d')}
|
NEXT_VER_CODE=${NEXT_VER_CODE:-$(date +'%Y%m%d')}
|
||||||
@@ -22,12 +23,15 @@ toml_get_table_names() { jq -r -e 'to_entries[] | select(.value | type == "objec
|
|||||||
toml_get_table_main() { jq -r -e 'to_entries | map(select(.value | type != "object")) | from_entries' <<<"$__TOML__"; }
|
toml_get_table_main() { jq -r -e 'to_entries | map(select(.value | type != "object")) | from_entries' <<<"$__TOML__"; }
|
||||||
toml_get_table() { jq -r -e ".\"${1}\"" <<<"$__TOML__"; }
|
toml_get_table() { jq -r -e ".\"${1}\"" <<<"$__TOML__"; }
|
||||||
toml_get() {
|
toml_get() {
|
||||||
local op
|
local op quote_placeholder=$'\001'
|
||||||
op=$(jq -r ".\"${2}\" | values" <<<"$1")
|
op=$(jq -r ".\"${2}\" | values" <<<"$1")
|
||||||
if [ "$op" ]; then
|
if [ "$op" ]; then
|
||||||
op="${op#"${op%%[![:space:]]*}"}"
|
op="${op#"${op%%[![:space:]]*}"}"
|
||||||
op="${op%"${op##*[![:space:]]}"}"
|
op="${op%"${op##*[![:space:]]}"}"
|
||||||
|
op=${op//\\\'/$quote_placeholder}
|
||||||
|
op=${op//"''"/$quote_placeholder}
|
||||||
op=${op//"'"/'"'}
|
op=${op//"'"/'"'}
|
||||||
|
op=${op//$quote_placeholder/$'\''}
|
||||||
echo "$op"
|
echo "$op"
|
||||||
else return 1; fi
|
else return 1; fi
|
||||||
}
|
}
|
||||||
@@ -35,38 +39,47 @@ toml_get() {
|
|||||||
pr() { echo -e "\033[0;32m[+] ${1}\033[0m"; }
|
pr() { echo -e "\033[0;32m[+] ${1}\033[0m"; }
|
||||||
epr() {
|
epr() {
|
||||||
echo >&2 -e "\033[0;31m[-] ${1}\033[0m"
|
echo >&2 -e "\033[0;31m[-] ${1}\033[0m"
|
||||||
if [ "${GITHUB_REPOSITORY-}" ]; then echo -e "::error::utils.sh [-] ${1}\n"; fi
|
if [ "${GITHUB_REPOSITORY-}" ]; then echo >&2 -e "::error::utils.sh [-] ${1}\n"; fi
|
||||||
|
}
|
||||||
|
wpr() {
|
||||||
|
echo >&2 -e "\033[0;33m[!] ${1}\033[0m"
|
||||||
|
if [ "${GITHUB_REPOSITORY-}" ]; then echo >&2 -e "::warning::utils.sh [!] ${1}\n"; fi
|
||||||
}
|
}
|
||||||
abort() {
|
abort() {
|
||||||
epr "ABORT: ${1-}"
|
epr "ABORT: ${1-}"
|
||||||
exit 1
|
rm -rf ./${TEMP_DIR}/*tmp.* ./${TEMP_DIR}/*/*tmp.* ./${TEMP_DIR}/*-temporary-files
|
||||||
|
kill -n 9 0
|
||||||
}
|
}
|
||||||
|
java() { env -i java --enable-native-access=ALL-UNNAMED "$@"; }
|
||||||
|
|
||||||
get_rv_prebuilts() {
|
get_prebuilts() {
|
||||||
local cli_src=$1 cli_ver=$2 patches_src=$3 patches_ver=$4
|
local cli_src=$1 cli_ver=$2 patches_src=$3 patches_ver=$4
|
||||||
pr "Getting prebuilts (${patches_src%/*})" >&2
|
pr "Getting prebuilts (${patches_src%/*})" >&2
|
||||||
local cl_dir=${patches_src%/*}
|
local cl_dir=${patches_src%/*}
|
||||||
cl_dir=${TEMP_DIR}/${cl_dir,,}-rv
|
cl_dir=${TEMP_DIR}/${cl_dir,,}-rv
|
||||||
[ -d "$cl_dir" ] || mkdir "$cl_dir"
|
[ -d "$cl_dir" ] || mkdir "$cl_dir"
|
||||||
for src_ver in "$cli_src CLI $cli_ver revanced-cli" "$patches_src Patches $patches_ver patches"; do
|
|
||||||
|
for src_ver in "$cli_src CLI $cli_ver cli" "$patches_src Patches $patches_ver patches"; do
|
||||||
set -- $src_ver
|
set -- $src_ver
|
||||||
local src=$1 tag=$2 ver=${3-} fprefix=$4
|
local src=$1 tag=$2 ver=${3-} fprefix=$4
|
||||||
local ext
|
|
||||||
if [ "$tag" = "CLI" ]; then
|
if [ "$tag" = "CLI" ]; then
|
||||||
ext="jar"
|
|
||||||
local grab_cl=false
|
local grab_cl=false
|
||||||
elif [ "$tag" = "Patches" ]; then
|
elif [ "$tag" = "Patches" ]; then
|
||||||
ext="rvp"
|
|
||||||
local grab_cl=true
|
local grab_cl=true
|
||||||
else abort unreachable; fi
|
else abort unreachable; fi
|
||||||
|
|
||||||
local dir=${src%/*}
|
local dir=${src%/*}
|
||||||
dir=${TEMP_DIR}/${dir,,}-rv
|
dir=${TEMP_DIR}/${dir,,}-rv
|
||||||
[ -d "$dir" ] || mkdir "$dir"
|
[ -d "$dir" ] || mkdir "$dir"
|
||||||
|
|
||||||
local rv_rel="https://api.github.com/repos/${src}/releases" name_ver
|
local rv_rel="https://api.github.com/repos/${src}/releases" name_ver
|
||||||
if [ "$ver" = "dev" ]; then
|
if [ "$ver" = "dev" ]; then
|
||||||
name_ver="*-dev*"
|
local resp
|
||||||
elif [ "$ver" = "latest" ]; then
|
resp=$(gh_req "$rv_rel" -) || return 1
|
||||||
|
ver=$(jq -e -r '.[] | .tag_name' <<<"$resp" | get_highest_ver) || return 1
|
||||||
|
fi
|
||||||
|
if [ "$ver" = "latest" ]; then
|
||||||
rv_rel+="/latest"
|
rv_rel+="/latest"
|
||||||
name_ver="*"
|
name_ver="*"
|
||||||
else
|
else
|
||||||
@@ -74,14 +87,27 @@ get_rv_prebuilts() {
|
|||||||
name_ver="$ver"
|
name_ver="$ver"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local url file tag_name name
|
local url file tag_name matches
|
||||||
file=$(find "$dir" -name "${fprefix}-${name_ver#v}.${ext}" -type f 2>/dev/null)
|
file=$(find "$dir" -name "*${fprefix}-${name_ver#v}.*" -type f 2>/dev/null)
|
||||||
if [ -z "$file" ]; then
|
if [ -z "$file" ]; then
|
||||||
local resp asset name
|
local resp asset name
|
||||||
resp=$(gh_req "$rv_rel" -) || return 1
|
resp=$(gh_req "$rv_rel" -) || return 1
|
||||||
if [ "$ver" = "dev" ]; then resp=$(jq -r '.[0]' <<<"$resp"); fi
|
tag_name=$(jq -r '.tag_name' <<<"$resp") || return 1
|
||||||
tag_name=$(jq -r '.tag_name' <<<"$resp")
|
matches=$(jq -e '.assets | map(select(.name | (endswith("asc") or endswith("json")) | not))' <<<"$resp") || return 1
|
||||||
asset=$(jq -e -r ".assets[] | select(.name | endswith(\"$ext\"))" <<<"$resp") || return 1
|
if [ "$(jq 'length' <<<"$matches")" -gt 1 ]; then
|
||||||
|
local matches_new
|
||||||
|
matches_new=$(jq -e -r 'map(select(.name | contains("-dev") | not))' <<<"$matches")
|
||||||
|
if [ "$(jq 'length' <<<"$matches_new")" -eq 1 ]; then
|
||||||
|
matches=$matches_new
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$(jq 'length' <<<"$matches")" -eq 0 ]; then
|
||||||
|
epr "No asset was found"
|
||||||
|
return 1
|
||||||
|
elif [ "$(jq 'length' <<<"$matches")" -ne 1 ]; then
|
||||||
|
wpr "More than 1 asset was found for this release. Falling back to the first one found..."
|
||||||
|
fi
|
||||||
|
asset=$(jq -r ".[0]" <<<"$matches")
|
||||||
url=$(jq -r .url <<<"$asset")
|
url=$(jq -r .url <<<"$asset")
|
||||||
name=$(jq -r .name <<<"$asset")
|
name=$(jq -r .name <<<"$asset")
|
||||||
file="${dir}/${name}"
|
file="${dir}/${name}"
|
||||||
@@ -98,14 +124,17 @@ get_rv_prebuilts() {
|
|||||||
tag_name=$(cut -d'-' -f3- <<<"$name")
|
tag_name=$(cut -d'-' -f3- <<<"$name")
|
||||||
tag_name=v${tag_name%.*}
|
tag_name=v${tag_name%.*}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$tag" = "Patches" ]; then
|
if [ "$tag" = "Patches" ]; then
|
||||||
if [ $grab_cl = true ]; then echo -e "[Changelog](https://github.com/${src}/releases/tag/${tag_name})\n" >>"${cl_dir}/changelog.md"; fi
|
if [ "$grab_cl" = true ]; then echo -e "[Changelog](https://github.com/${src}/releases/tag/${tag_name})\n" >>"${cl_dir}/changelog.md"; fi
|
||||||
if [ "$REMOVE_RV_INTEGRATIONS_CHECKS" = true ]; then
|
if [ "$REMOVE_RV_INTEGRATIONS_CHECKS" = true ]; then
|
||||||
|
local extensions_ext
|
||||||
|
extensions_ext=$(unzip -l "${file}" "extensions/shared.*" | grep -o "shared\..*") extensions_ext="${extensions_ext#*.}"
|
||||||
if ! (
|
if ! (
|
||||||
mkdir -p "${file}-zip" || return 1
|
mkdir -p "${file}-zip" || return 1
|
||||||
unzip -qo "${file}" -d "${file}-zip" || return 1
|
unzip -qo "${file}" -d "${file}-zip" || return 1
|
||||||
java -cp "${BIN_DIR}/paccer.jar:${BIN_DIR}/dexlib2.jar" com.jhc.Main "${file}-zip/extensions/shared.rve" "${file}-zip/extensions/shared-patched.rve" || return 1
|
java -cp "${BIN_DIR}/paccer.jar:${BIN_DIR}/dexlib2.jar" com.jhc.Main "${file}-zip/extensions/shared.${extensions_ext}" "${file}-zip/extensions/shared-patched.${extensions_ext}" || return 1
|
||||||
mv -f "${file}-zip/extensions/shared-patched.rve" "${file}-zip/extensions/shared.rve" || return 1
|
mv -f "${file}-zip/extensions/shared-patched.${extensions_ext}" "${file}-zip/extensions/shared.${extensions_ext}" || return 1
|
||||||
rm "${file}" || return 1
|
rm "${file}" || return 1
|
||||||
cd "${file}-zip" || abort
|
cd "${file}-zip" || abort
|
||||||
zip -0rq "${CWD}/${file}" . || return 1
|
zip -0rq "${CWD}/${file}" . || return 1
|
||||||
@@ -122,16 +151,12 @@ get_rv_prebuilts() {
|
|||||||
|
|
||||||
set_prebuilts() {
|
set_prebuilts() {
|
||||||
APKSIGNER="${BIN_DIR}/apksigner.jar"
|
APKSIGNER="${BIN_DIR}/apksigner.jar"
|
||||||
if [ "$OS" = Android ]; then
|
local arch
|
||||||
local arch
|
arch=$(uname -m)
|
||||||
if [ "$(uname -m)" = aarch64 ]; then arch=arm64; else arch=arm; fi
|
if [ "$arch" = aarch64 ]; then arch=arm64; elif [ "${arch:0:5}" = "armv7" ]; then arch=arm; fi
|
||||||
HTMLQ="${BIN_DIR}/htmlq/htmlq-${arch}"
|
HTMLQ="${BIN_DIR}/htmlq/htmlq-${arch}"
|
||||||
AAPT2="${BIN_DIR}/aapt2/aapt2-${arch}"
|
AAPT2="${BIN_DIR}/aapt2/aapt2-${arch}"
|
||||||
TOML="${BIN_DIR}/toml/tq-${arch}"
|
TOML="${BIN_DIR}/toml/tq-${arch}"
|
||||||
else
|
|
||||||
HTMLQ="${BIN_DIR}/htmlq/htmlq-x86_64"
|
|
||||||
TOML="${BIN_DIR}/toml/tq-x86_64"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config_update() {
|
config_update() {
|
||||||
@@ -144,7 +169,7 @@ config_update() {
|
|||||||
if [ -z "$table_name" ]; then continue; fi
|
if [ -z "$table_name" ]; then continue; fi
|
||||||
t=$(toml_get_table "$table_name")
|
t=$(toml_get_table "$table_name")
|
||||||
enabled=$(toml_get "$t" enabled) || enabled=true
|
enabled=$(toml_get "$t" enabled) || enabled=true
|
||||||
if [ "$enabled" = false ]; then continue; fi
|
if [ "$enabled" = "false" ]; then continue; fi
|
||||||
PATCHES_SRC=$(toml_get "$t" patches-source) || PATCHES_SRC=$DEF_PATCHES_SRC
|
PATCHES_SRC=$(toml_get "$t" patches-source) || PATCHES_SRC=$DEF_PATCHES_SRC
|
||||||
PATCHES_VER=$(toml_get "$t" patches-version) || PATCHES_VER=$DEF_PATCHES_VER
|
PATCHES_VER=$(toml_get "$t" patches-version) || PATCHES_VER=$DEF_PATCHES_VER
|
||||||
if [[ -v sources["$PATCHES_SRC/$PATCHES_VER"] ]]; then
|
if [[ -v sources["$PATCHES_SRC/$PATCHES_VER"] ]]; then
|
||||||
@@ -153,17 +178,17 @@ config_update() {
|
|||||||
sources["$PATCHES_SRC/$PATCHES_VER"]=0
|
sources["$PATCHES_SRC/$PATCHES_VER"]=0
|
||||||
local rv_rel="https://api.github.com/repos/${PATCHES_SRC}/releases"
|
local rv_rel="https://api.github.com/repos/${PATCHES_SRC}/releases"
|
||||||
if [ "$PATCHES_VER" = "dev" ]; then
|
if [ "$PATCHES_VER" = "dev" ]; then
|
||||||
last_patches=$(gh_req "$rv_rel" - | jq -e -r '.[0]')
|
last_patches=$(gh_req "$rv_rel" - | jq -e -r '.[0]') || continue
|
||||||
elif [ "$PATCHES_VER" = "latest" ]; then
|
elif [ "$PATCHES_VER" = "latest" ]; then
|
||||||
last_patches=$(gh_req "$rv_rel/latest" -)
|
last_patches=$(gh_req "$rv_rel/latest" -) || continue
|
||||||
else
|
else
|
||||||
last_patches=$(gh_req "$rv_rel/tags/${ver}" -)
|
last_patches=$(gh_req "$rv_rel/tags/${ver}" -) || continue
|
||||||
fi
|
fi
|
||||||
if ! last_patches=$(jq -e -r '.assets[] | select(.name | endswith("rvp")) | .name' <<<"$last_patches"); then
|
if ! last_patches=$(jq -e -r '.assets[] | select(.name | (endswith("asc") or endswith("json")) | not) | .name' <<<"$last_patches"); then
|
||||||
abort oops
|
abort "config_update error: '$last_patches'"
|
||||||
fi
|
fi
|
||||||
if [ "$last_patches" ]; then
|
if [ "$last_patches" ]; then
|
||||||
if ! OP=$(grep "^Patches: ${PATCHES_SRC%%/*}/" build.md | grep "$last_patches"); then
|
if ! OP=$(grep "^Patches: ${PATCHES_SRC%%/*}/" build.md | grep -m1 "$last_patches"); then
|
||||||
sources["$PATCHES_SRC/$PATCHES_VER"]=1
|
sources["$PATCHES_SRC/$PATCHES_VER"]=1
|
||||||
prcfg=true
|
prcfg=true
|
||||||
upped+=("$table_name")
|
upped+=("$table_name")
|
||||||
@@ -186,17 +211,20 @@ config_update() {
|
|||||||
_req() {
|
_req() {
|
||||||
local ip="$1" op="$2"
|
local ip="$1" op="$2"
|
||||||
shift 2
|
shift 2
|
||||||
if [ "$op" = - ]; then
|
local dlp="$op"
|
||||||
curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 5 --retry 0 --fail -s -S "$@" "$ip"
|
if [ "$op" != - ]; then
|
||||||
else
|
|
||||||
if [ -f "$op" ]; then return; fi
|
if [ -f "$op" ]; then return; fi
|
||||||
local dlp
|
|
||||||
dlp="$(dirname "$op")/tmp.$(basename "$op")"
|
dlp="$(dirname "$op")/tmp.$(basename "$op")"
|
||||||
if [ -f "$dlp" ]; then
|
if [ -f "$dlp" ]; then
|
||||||
while [ -f "$dlp" ]; do sleep 1; done
|
while [ -f "$dlp" ]; do sleep 1; done
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 5 --retry 0 --fail -s -S "$@" "$ip" -o "$dlp" || return 1
|
fi
|
||||||
|
if ! curl -L -c "$TEMP_DIR/cookie.txt" -b "$TEMP_DIR/cookie.txt" --connect-timeout 10 --retry 1 --fail -s -S "$@" "$ip" -o "$dlp"; then
|
||||||
|
epr "Request failed: $ip"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ "$dlp" != - ]; then
|
||||||
mv -f "$dlp" "$op"
|
mv -f "$dlp" "$op"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -218,6 +246,7 @@ get_highest_ver() {
|
|||||||
}
|
}
|
||||||
semver_validate() {
|
semver_validate() {
|
||||||
local a="${1%-*}"
|
local a="${1%-*}"
|
||||||
|
local a="${a#v}"
|
||||||
local ac="${a//[.0-9]/}"
|
local ac="${a//[.0-9]/}"
|
||||||
[ ${#ac} = 0 ]
|
[ ${#ac} = 0 ]
|
||||||
}
|
}
|
||||||
@@ -241,16 +270,38 @@ get_patch_last_supported_ver() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if ! op=$(java -jar "$rv_cli_jar" list-versions "$rv_patches_jar" -f "$pkg_name" 2>&1 | tail -n +3 | awk '{$1=$1}1'); then
|
op=$(patches_list_versions "$cli_jar" "$patches_jar" "$pkg_name") || return 1
|
||||||
epr "list-versions: '$op'"
|
op=$(sed -n '/(.* patch.*/,$p' <<<"$op" | awk '{$1=$1}1')
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [ "$op" = "Any" ]; then return; fi
|
if [ "$op" = "Any" ]; then return; fi
|
||||||
pcount=$(head -1 <<<"$op") pcount=${pcount#*(} pcount=${pcount% *}
|
pcount=$(head -1 <<<"$op") pcount=${pcount#*(} pcount=${pcount% *}
|
||||||
if [ -z "$pcount" ]; then abort "unreachable: '$pcount'"; fi
|
if [ -z "$pcount" ]; then
|
||||||
|
abort "No patches found for '$pkg_name' in patches '$patches_jar'"
|
||||||
|
fi
|
||||||
grep -F "($pcount patch" <<<"$op" | sed 's/ (.* patch.*//' | get_highest_ver || return 1
|
grep -F "($pcount patch" <<<"$op" | sed 's/ (.* patch.*//' | get_highest_ver || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
patches_list_versions() {
|
||||||
|
local cli_jar=$1 patches_jar=$2 pkg_name=$3 op
|
||||||
|
if ! op=$(java -jar "$cli_jar" list-versions -p "$patches_jar" -f "$pkg_name" -b 2>&1); then
|
||||||
|
if ! op=$(java -jar "$cli_jar" list-versions "$patches_jar" -f "$pkg_name" 2>&1); then
|
||||||
|
epr "Could not list versions $cli_jar: '$op'"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "$op"
|
||||||
|
}
|
||||||
|
patches_list() {
|
||||||
|
local cli_jar=$1 patches_jar=$2 pkg_name=$3 op
|
||||||
|
if ! op=$(java -jar "$cli_jar" list-patches -p "$patches_jar" --filter-package-name "$pkg_name" --versions --packages -b 2>&1); then
|
||||||
|
if ! op=$(java -jar "$cli_jar" list-patches --patches "$patches_jar" -f "$pkg_name" --with-versions --with-packages 2>&1); then
|
||||||
|
epr "Could not get patches list $cli_jar: '$op'"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
echo "$op"
|
||||||
|
}
|
||||||
|
|
||||||
isoneof() {
|
isoneof() {
|
||||||
local i=$1 v
|
local i=$1 v
|
||||||
shift
|
shift
|
||||||
@@ -261,47 +312,48 @@ isoneof() {
|
|||||||
merge_splits() {
|
merge_splits() {
|
||||||
local bundle=$1 output=$2
|
local bundle=$1 output=$2
|
||||||
pr "Merging splits"
|
pr "Merging splits"
|
||||||
gh_dl "$TEMP_DIR/apkeditor.jar" "https://github.com/REAndroid/APKEditor/releases/download/V1.3.9/APKEditor-1.3.9.jar" >/dev/null || return 1
|
gh_dl "$TEMP_DIR/apkeditor.jar" "https://github.com/REAndroid/APKEditor/releases/download/V1.4.7/APKEditor-1.4.7.jar" >/dev/null || return 1
|
||||||
if ! OP=$(java -jar "$TEMP_DIR/apkeditor.jar" merge -i "${bundle}" -o "${bundle}.mzip" -clean-meta -f 2>&1); then
|
if ! OP=$(java -jar "$TEMP_DIR/apkeditor.jar" merge -i "$bundle" -o "${output}-unsigned" -clean-meta -f 2>&1); then
|
||||||
epr "$OP"
|
epr "APKEditor error: $OP"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
# this is required because of apksig
|
# sign the merged stock apk
|
||||||
mkdir "${bundle}-zip"
|
if ! OP=$(java -jar "$APKSIGNER" sign --ks ks-p12.keystore --ks-pass pass:123456789 --key-pass pass:123456789 --ks-key-alias jhc \
|
||||||
unzip -qo "${bundle}.mzip" -d "${bundle}-zip"
|
--out "${output}" "${output}-unsigned"); then
|
||||||
pushd "${bundle}-zip" || abort
|
epr "apksigner error: $OP"
|
||||||
zip -0rq "${CWD}/${bundle}.zip" .
|
return 1
|
||||||
popd || abort
|
|
||||||
# if building module, sign the merged apk properly
|
|
||||||
if isoneof "module" "${build_mode_arr[@]}"; then
|
|
||||||
patch_apk "${bundle}.zip" "${output}" "--exclusive" "${args[cli]}" "${args[ptjar]}"
|
|
||||||
local ret=$?
|
|
||||||
else
|
|
||||||
cp "${bundle}.zip" "${output}"
|
|
||||||
local ret=$?
|
|
||||||
fi
|
fi
|
||||||
rm -r "${bundle}-zip" "${bundle}.zip" "${bundle}.mzip" || :
|
rm "${output}.idsig" "${output}-unsigned" 2>/dev/null || :
|
||||||
return $ret
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# -------------------- apkmirror --------------------
|
# -------------------- apkmirror --------------------
|
||||||
apk_mirror_search() {
|
apkmirror_search() {
|
||||||
local resp="$1" dpi="$2" arch="$3" apk_bundle="$4"
|
local resp="$1" dpi="$2" arch="$3" apk_bundle="$4"
|
||||||
local apparch dlurl node app_table
|
local apparch dlurl="" node app_table emptyCheck
|
||||||
if [ "$arch" = all ]; then
|
if [ "$arch" = all ]; then
|
||||||
apparch=(universal noarch 'arm64-v8a + armeabi-v7a')
|
apparch=(universal noarch 'arm64-v8a + armeabi-v7a')
|
||||||
else apparch=("$arch" universal noarch 'arm64-v8a + armeabi-v7a'); fi
|
else apparch=("$arch" universal noarch 'arm64-v8a + armeabi-v7a'); fi
|
||||||
for ((n = 1; n < 40; n++)); do
|
for ((n = 1; n < 40; n++)); do
|
||||||
node=$($HTMLQ "div.table-row.headerFont:nth-last-child($n)" -r "span:nth-child(n+3)" <<<"$resp")
|
node=$($HTMLQ "div.table-row.headerFont:nth-last-child($n)" -r "span:nth-child(n+3)" <<<"$resp")
|
||||||
if [ -z "$node" ]; then break; fi
|
if [ -z "$node" ]; then break; fi
|
||||||
app_table=$($HTMLQ --text --ignore-whitespace <<<"$node")
|
emptyCheck=$($HTMLQ -t -w "div.table-cell:nth-child(1) > a:nth-child(1)" <<<"$node" | xargs)
|
||||||
if [ "$(sed -n 3p <<<"$app_table")" = "$apk_bundle" ] && [ "$(sed -n 6p <<<"$app_table")" = "$dpi" ] &&
|
if [ "$emptyCheck" ]; then
|
||||||
isoneof "$(sed -n 4p <<<"$app_table")" "${apparch[@]}"; then
|
|
||||||
dlurl=$($HTMLQ --base https://www.apkmirror.com --attribute href "div:nth-child(1) > a:nth-child(1)" <<<"$node")
|
dlurl=$($HTMLQ --base https://www.apkmirror.com --attribute href "div:nth-child(1) > a:nth-child(1)" <<<"$node")
|
||||||
|
else break; fi
|
||||||
|
app_table=$($HTMLQ --text --ignore-whitespace <<<"$node")
|
||||||
|
if [ "$(sed -n 3p <<<"$app_table")" = "$apk_bundle" ] &&
|
||||||
|
[ "$(sed -n 6p <<<"$app_table")" = "$dpi" ] &&
|
||||||
|
isoneof "$(sed -n 4p <<<"$app_table")" "${apparch[@]}"; then
|
||||||
echo "$dlurl"
|
echo "$dlurl"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [ "$n" -eq 2 ] && [ "$dlurl" ]; then
|
||||||
|
# only one apk exists, return it
|
||||||
|
echo "$dlurl"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
dl_apkmirror() {
|
dl_apkmirror() {
|
||||||
@@ -310,16 +362,21 @@ dl_apkmirror() {
|
|||||||
is_bundle=true
|
is_bundle=true
|
||||||
else
|
else
|
||||||
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
|
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
|
||||||
local resp node app_table dlurl=""
|
local resp node app_table apkmname dlurl=""
|
||||||
url="${url}/${url##*/}-${version//./-}-release/"
|
apkmname=$($HTMLQ "h1.marginZero" --text <<<"$__APKMIRROR_RESP__")
|
||||||
|
apkmname="${apkmname,,}" apkmname="${apkmname// /-}" apkmname="${apkmname//[^a-z0-9-]/}"
|
||||||
|
url="${url}/${apkmname}-${version//./-}-release/"
|
||||||
resp=$(req "$url" -) || return 1
|
resp=$(req "$url" -) || return 1
|
||||||
node=$($HTMLQ "div.table-row.headerFont:nth-last-child(1)" -r "span:nth-child(n+3)" <<<"$resp")
|
node=$($HTMLQ "div.table-row.headerFont:nth-last-child(1)" -r "span:nth-child(n+3)" <<<"$resp")
|
||||||
if [ "$node" ]; then
|
if [ "$node" ]; then
|
||||||
if ! dlurl=$(apk_mirror_search "$resp" "$dpi" "${arch}" "APK"); then
|
for current_dpi in $dpi; do
|
||||||
if ! dlurl=$(apk_mirror_search "$resp" "$dpi" "${arch}" "BUNDLE"); then
|
for type in APK BUNDLE; do
|
||||||
return 1
|
if dlurl=$(apkmirror_search "$resp" "$current_dpi" "${arch}" "$type"); then
|
||||||
else is_bundle=true; fi
|
[[ "$type" == "BUNDLE" ]] && is_bundle=true || is_bundle=false
|
||||||
fi
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
[ -z "$dlurl" ] && return 1
|
[ -z "$dlurl" ] && return 1
|
||||||
resp=$(req "$dlurl" -)
|
resp=$(req "$dlurl" -)
|
||||||
fi
|
fi
|
||||||
@@ -328,10 +385,10 @@ dl_apkmirror() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$is_bundle" = true ]; then
|
if [ "$is_bundle" = true ]; then
|
||||||
req "$url" "${output}.apkm"
|
req "$url" "${output}.apkm" || return 1
|
||||||
merge_splits "${output}.apkm" "${output}"
|
merge_splits "${output}.apkm" "${output}"
|
||||||
else
|
else
|
||||||
req "$url" "${output}"
|
req "$url" "${output}" || return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
get_apkmirror_vers() {
|
get_apkmirror_vers() {
|
||||||
@@ -352,47 +409,69 @@ get_apkmirror_vers() {
|
|||||||
}
|
}
|
||||||
get_apkmirror_pkg_name() { sed -n 's;.*id=\(.*\)" class="accent_color.*;\1;p' <<<"$__APKMIRROR_RESP__"; }
|
get_apkmirror_pkg_name() { sed -n 's;.*id=\(.*\)" class="accent_color.*;\1;p' <<<"$__APKMIRROR_RESP__"; }
|
||||||
get_apkmirror_resp() {
|
get_apkmirror_resp() {
|
||||||
__APKMIRROR_RESP__=$(req "${1}" -)
|
__APKMIRROR_RESP__=$(req "${1}" -) || return 1
|
||||||
__APKMIRROR_CAT__="${1##*/}"
|
__APKMIRROR_CAT__="${1##*/}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# -------------------- uptodown --------------------
|
# -------------------- uptodown --------------------
|
||||||
get_uptodown_resp() {
|
get_uptodown_resp() {
|
||||||
__UPTODOWN_RESP__=$(req "${1}/versions" -)
|
__UPTODOWN_RESP__=$(req "${1}/versions" -) || return 1
|
||||||
__UPTODOWN_RESP_PKG__=$(req "${1}/download" -)
|
__UPTODOWN_RESP_PKG__=$(req "${1}/download" -) || return 1
|
||||||
}
|
}
|
||||||
get_uptodown_vers() { $HTMLQ --text ".version" <<<"$__UPTODOWN_RESP__"; }
|
get_uptodown_vers() { $HTMLQ --text ".version" <<<"$__UPTODOWN_RESP__"; }
|
||||||
dl_uptodown() {
|
dl_uptodown() {
|
||||||
local uptodown_dlurl=$1 version=$2 output=$3 arch=$4 _dpi=$5
|
local uptodown_dlurl=$1 version=$2 output=$3 arch=$4 _dpi=$5
|
||||||
|
local apparch
|
||||||
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
|
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
|
||||||
|
if [ "$arch" = all ]; then
|
||||||
|
apparch=('arm64-v8a, armeabi-v7a, x86_64' 'arm64-v8a, armeabi-v7a, x86, x86_64' 'arm64-v8a, armeabi-v7a')
|
||||||
|
else apparch=("$arch" 'arm64-v8a, armeabi-v7a, x86_64' 'arm64-v8a, armeabi-v7a, x86, x86_64' 'arm64-v8a, armeabi-v7a'); fi
|
||||||
|
|
||||||
local op resp data_code
|
local op resp data_code
|
||||||
data_code=$($HTMLQ "#detail-app-name" --attribute data-code <<<"$__UPTODOWN_RESP__")
|
data_code=$($HTMLQ "#detail-app-name" --attribute data-code <<<"$__UPTODOWN_RESP__")
|
||||||
local versionURL=""
|
local versionURL=""
|
||||||
for i in {1..5}; do
|
local is_bundle=false
|
||||||
|
for i in {1..20}; do
|
||||||
resp=$(req "${uptodown_dlurl}/apps/${data_code}/versions/${i}" -)
|
resp=$(req "${uptodown_dlurl}/apps/${data_code}/versions/${i}" -)
|
||||||
if ! op=$(jq -e -r ".data | map(select(.version == \"${version}\" and .kindFile == \"apk\")) | .[0]" <<<"$resp"); then
|
if ! op=$(jq -e -r ".data | map(select(.version == \"${version}\")) | .[0]" <<<"$resp"); then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
if [ "$(jq -e -r ".kindFile" <<<"$op")" = "xapk" ]; then is_bundle=true; fi
|
||||||
if versionURL=$(jq -e -r '.versionURL' <<<"$op"); then break; else return 1; fi
|
if versionURL=$(jq -e -r '.versionURL' <<<"$op"); then break; else return 1; fi
|
||||||
done
|
done
|
||||||
if [ -z "$versionURL" ]; then return 1; fi
|
if [ -z "$versionURL" ]; then return 1; fi
|
||||||
|
versionURL=$(jq -e -r '.url + "/" + .extraURL + "/" + (.versionID | tostring)' <<<"$versionURL")
|
||||||
resp=$(req "$versionURL" -) || return 1
|
resp=$(req "$versionURL" -) || return 1
|
||||||
if [ "$arch" != all ]; then
|
|
||||||
local data_version files node_arch data_file_id
|
local data_version files node_arch="" data_file_id node_class
|
||||||
data_version=$($HTMLQ '.button.variants' --attribute data-version <<<"$resp") || return 1
|
data_version=$($HTMLQ '.button.variants' --attribute data-version <<<"$resp") || return 1
|
||||||
|
if [ "$data_version" ]; then
|
||||||
files=$(req "${uptodown_dlurl%/*}/app/${data_code}/version/${data_version}/files" - | jq -e -r .content) || return 1
|
files=$(req "${uptodown_dlurl%/*}/app/${data_code}/version/${data_version}/files" - | jq -e -r .content) || return 1
|
||||||
for ((n = 1; n < 12; n += 2)); do
|
for ((n = 1; n < 12; n += 1)); do
|
||||||
node_arch=$($HTMLQ ".content > p:nth-child($n)" --text <<<"$files" | xargs) || return 1
|
node_class=$($HTMLQ -w -t ".content > :nth-child($n)" --attribute class <<<"$files") || return 1
|
||||||
|
if [ "$node_class" != "variant" ]; then
|
||||||
|
node_arch=$($HTMLQ -w -t ".content > :nth-child($n)" <<<"$files" | xargs) || return 1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
if [ -z "$node_arch" ]; then return 1; fi
|
if [ -z "$node_arch" ]; then return 1; fi
|
||||||
if [ "$node_arch" != "$arch" ]; then continue; fi
|
if ! isoneof "$node_arch" "${apparch[@]}"; then continue; fi
|
||||||
data_file_id=$($HTMLQ "div.variant:nth-child($((n + 1))) > .v-report" --attribute data-file-id <<<"$files") || return 1
|
|
||||||
resp=$(req "${uptodown_dlurl}/download/${data_file_id}" -)
|
file_type=$($HTMLQ -w -t ".content > :nth-child($n) > .v-file > span" <<<"$files") || return 1
|
||||||
|
if [ "$file_type" = "xapk" ]; then is_bundle=true; else is_bundle=false; fi
|
||||||
|
data_file_id=$($HTMLQ ".content > :nth-child($n) > .v-report" --attribute data-file-id <<<"$files") || return 1
|
||||||
|
resp=$(req "${uptodown_dlurl}/download/${data_file_id}-x" -)
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
|
if [ $n -eq 12 ]; then return 1; fi
|
||||||
fi
|
fi
|
||||||
local data_url
|
local data_url
|
||||||
data_url=$($HTMLQ "#detail-download-button" --attribute data-url <<<"$resp") || return 1
|
data_url=$($HTMLQ "#detail-download-button" --attribute data-url <<<"$resp") || return 1
|
||||||
req "https://dw.uptodown.com/dwn/${data_url}" "$output"
|
if [ $is_bundle = true ]; then
|
||||||
|
req "https://dw.uptodown.com/dwn/${data_url}" "$output.apkm" || return 1
|
||||||
|
merge_splits "${output}.apkm" "${output}"
|
||||||
|
else
|
||||||
|
req "https://dw.uptodown.com/dwn/${data_url}" "$output"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
get_uptodown_pkg_name() { $HTMLQ --text "tr.full:nth-child(1) > td:nth-child(3)" <<<"$__UPTODOWN_RESP_PKG__"; }
|
get_uptodown_pkg_name() { $HTMLQ --text "tr.full:nth-child(1) > td:nth-child(3)" <<<"$__UPTODOWN_RESP_PKG__"; }
|
||||||
|
|
||||||
@@ -411,13 +490,28 @@ get_archive_resp() {
|
|||||||
}
|
}
|
||||||
get_archive_vers() { sed 's/^[^-]*-//;s/-\(all\|arm64-v8a\|arm-v7a\)\.apk//g' <<<"$__ARCHIVE_RESP__"; }
|
get_archive_vers() { sed 's/^[^-]*-//;s/-\(all\|arm64-v8a\|arm-v7a\)\.apk//g' <<<"$__ARCHIVE_RESP__"; }
|
||||||
get_archive_pkg_name() { echo "$__ARCHIVE_PKG_NAME__"; }
|
get_archive_pkg_name() { echo "$__ARCHIVE_PKG_NAME__"; }
|
||||||
|
|
||||||
|
# -------------------- direct --------------------
|
||||||
|
dl_direct() {
|
||||||
|
local url=$1 version=${2// /-} output=$3 arch=$4 dpi=$5
|
||||||
|
req "$url" "${output}" || return 1
|
||||||
|
}
|
||||||
|
get_direct_vers() { cut -d- -f2 <<<"$__DIRECT_APKNAME__"; }
|
||||||
|
get_direct_pkg_name() { cut -d- -f1 <<<"$__DIRECT_APKNAME__"; }
|
||||||
|
get_direct_resp() { __DIRECT_APKNAME__=$(awk -F/ '{print $NF}' <<<"$1"); }
|
||||||
# --------------------------------------------------
|
# --------------------------------------------------
|
||||||
|
|
||||||
patch_apk() {
|
patch_apk() {
|
||||||
local stock_input=$1 patched_apk=$2 patcher_args=$3 rv_cli_jar=$4 rv_patches_jar=$5
|
local stock_input=$1 patched_apk=$2 patcher_args=$3 cli_jar=$4 patches_jar=$5
|
||||||
local cmd="env -u GITHUB_REPOSITORY java -jar $rv_cli_jar patch $stock_input --purge -o $patched_apk -p $rv_patches_jar --keystore=ks.keystore \
|
local cmd="java -jar '$cli_jar' patch '$stock_input' --purge -o '$patched_apk' -p '$patches_jar' --keystore=ks.keystore \
|
||||||
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc $patcher_args"
|
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc $patcher_args"
|
||||||
if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary=${AAPT2}"; fi
|
|
||||||
|
# TODO: remove this later
|
||||||
|
local cli_name
|
||||||
|
cli_name=$(basename "$cli_jar")
|
||||||
|
if [ "${cli_name::8}" = revanced ]; then cmd+=" -b"; fi
|
||||||
|
|
||||||
|
if [ "$OS" = Android ]; then cmd+=" --custom-aapt2-binary='${AAPT2}'"; fi
|
||||||
pr "$cmd"
|
pr "$cmd"
|
||||||
if eval "$cmd"; then [ -f "$patched_apk" ]; else
|
if eval "$cmd"; then [ -f "$patched_apk" ]; else
|
||||||
rm "$patched_apk" 2>/dev/null || :
|
rm "$patched_apk" 2>/dev/null || :
|
||||||
@@ -430,6 +524,7 @@ check_sig() {
|
|||||||
local sig
|
local sig
|
||||||
if grep -q "$pkg_name" sig.txt; then
|
if grep -q "$pkg_name" sig.txt; then
|
||||||
sig=$(java -jar "$APKSIGNER" verify --print-certs "$file" | grep ^Signer | grep SHA-256 | tail -1 | awk '{print $NF}')
|
sig=$(java -jar "$APKSIGNER" verify --print-certs "$file" | grep ^Signer | grep SHA-256 | tail -1 | awk '{print $NF}')
|
||||||
|
echo "$pkg_name signature: ${sig}"
|
||||||
grep -qFx "$sig $pkg_name" sig.txt
|
grep -qFx "$sig $pkg_name" sig.txt
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -452,7 +547,7 @@ build_rv() {
|
|||||||
[ "${args[exclusive_patches]}" = true ] && p_patcher_args+=("--exclusive")
|
[ "${args[exclusive_patches]}" = true ] && p_patcher_args+=("--exclusive")
|
||||||
|
|
||||||
local tried_dl=()
|
local tried_dl=()
|
||||||
for dl_p in archive apkmirror uptodown; do
|
for dl_p in "${DL_SRCS[@]}"; do
|
||||||
if [ -z "${args[${dl_p}_dlurl]}" ]; then continue; fi
|
if [ -z "${args[${dl_p}_dlurl]}" ]; then continue; fi
|
||||||
if ! get_${dl_p}_resp "${args[${dl_p}_dlurl]}" || ! pkg_name=$(get_"${dl_p}"_pkg_name); then
|
if ! get_${dl_p}_resp "${args[${dl_p}_dlurl]}" || ! pkg_name=$(get_"${dl_p}"_pkg_name); then
|
||||||
args[${dl_p}_dlurl]=""
|
args[${dl_p}_dlurl]=""
|
||||||
@@ -467,14 +562,15 @@ build_rv() {
|
|||||||
epr "empty pkg name, not building ${table}."
|
epr "empty pkg name, not building ${table}."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
pr "Package name of '${table}' is '$pkg_name'"
|
||||||
local list_patches
|
local list_patches
|
||||||
list_patches=$(java -jar "$rv_cli_jar" list-patches "$rv_patches_jar" -f "$pkg_name" -v -p 2>&1)
|
list_patches=$(patches_list "$cli_jar" "$patches_jar" "$pkg_name") || return 1
|
||||||
|
|
||||||
local get_latest_ver=false
|
local get_latest_ver=false
|
||||||
if [ "$version_mode" = auto ]; then
|
if [ "$version_mode" = auto ]; then
|
||||||
if ! version=$(get_patch_last_supported_ver "$list_patches" "$pkg_name" \
|
if ! version=$(get_patch_last_supported_ver "$list_patches" "$pkg_name" \
|
||||||
"${args[included_patches]}" "${args[excluded_patches]}" "${args[exclusive_patches]}"); then
|
"${args[included_patches]}" "${args[excluded_patches]}" "${args[exclusive_patches]}"); then
|
||||||
exit 1
|
epr "get_patch_last_supported_ver failed '$list_patches'"
|
||||||
|
return
|
||||||
elif [ -z "$version" ]; then get_latest_ver=true; fi
|
elif [ -z "$version" ]; then get_latest_ver=true; fi
|
||||||
elif isoneof "$version_mode" latest beta; then
|
elif isoneof "$version_mode" latest beta; then
|
||||||
get_latest_ver=true
|
get_latest_ver=true
|
||||||
@@ -506,35 +602,38 @@ build_rv() {
|
|||||||
version_f=${version_f#v}
|
version_f=${version_f#v}
|
||||||
local stock_apk="${TEMP_DIR}/${pkg_name}-${version_f}-${arch_f}.apk"
|
local stock_apk="${TEMP_DIR}/${pkg_name}-${version_f}-${arch_f}.apk"
|
||||||
if [ ! -f "$stock_apk" ]; then
|
if [ ! -f "$stock_apk" ]; then
|
||||||
for dl_p in archive apkmirror uptodown; do
|
for dl_p in "${DL_SRCS[@]}"; do
|
||||||
if [ -z "${args[${dl_p}_dlurl]}" ]; then continue; fi
|
if [ -z "${args[${dl_p}_dlurl]}" ]; then continue; fi
|
||||||
pr "Downloading '${table}' from ${dl_p}"
|
pr "Downloading '${table}' from '${dl_p}'"
|
||||||
if ! isoneof $dl_p "${tried_dl[@]}"; then get_${dl_p}_resp "${args[${dl_p}_dlurl]}"; fi
|
if ! isoneof $dl_p "${tried_dl[@]}"; then
|
||||||
|
if ! get_${dl_p}_resp "${args[${dl_p}_dlurl]}"; then
|
||||||
|
epr "ERROR: Could not get '${table}' from '${dl_p}'"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
if ! dl_${dl_p} "${args[${dl_p}_dlurl]}" "$version" "$stock_apk" "$arch" "${args[dpi]}" "$get_latest_ver"; then
|
if ! dl_${dl_p} "${args[${dl_p}_dlurl]}" "$version" "$stock_apk" "$arch" "${args[dpi]}" "$get_latest_ver"; then
|
||||||
epr "ERROR: Could not download '${table}' from ${dl_p} with version '${version}', arch '${arch}', dpi '${args[dpi]}'"
|
epr "ERROR: Could not download '${table}' from '${dl_p}' with version '${version}', arch '${arch}', dpi '${args[dpi]}'"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
if [ ! -f "$stock_apk" ]; then return 0; fi
|
if [ ! -f "$stock_apk" ]; then
|
||||||
|
epr "Stock apk not found ($stock_apk)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if ! check_sig "$stock_apk" "$pkg_name"; then
|
if [ ! -f "${stock_apk}.apkm" ] && ! OP=$(check_sig "$stock_apk" "$pkg_name" 2>&1) && ! grep -qFx "ERROR: Missing META-INF/MANIFEST.MF" <<<"$OP"; then
|
||||||
abort "apk signature mismatch '$stock_apk'"
|
epr "Not building $table, apk signature mismatch '$stock_apk': $OP"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
log "${table}: ${version}"
|
log "${table}: ${version}"
|
||||||
|
|
||||||
local microg_patch
|
local microg_patch
|
||||||
microg_patch=$(grep "^Name: " <<<"$list_patches" | grep -i "gmscore\|microg" || :) microg_patch=${microg_patch#*: }
|
microg_patch=$(grep "^Name: " <<<"$list_patches" | grep -i "gmscore\|microg" || :) microg_patch=${microg_patch#*: }
|
||||||
if [ -n "$microg_patch" ] && [[ ${p_patcher_args[*]} =~ $microg_patch ]]; then
|
if [ -n "$microg_patch" ] && [[ ${p_patcher_args[*]} =~ $microg_patch ]]; then
|
||||||
epr "You cant include/exclude microg patch as that's done by rvmm builder automatically."
|
wpr "You cant include/exclude microg patch as that's done by rvmm builder automatically."
|
||||||
p_patcher_args=("${p_patcher_args[@]//-[ei] ${microg_patch}/}")
|
p_patcher_args=("${p_patcher_args[@]//-[ei] ${microg_patch}/}")
|
||||||
fi
|
fi
|
||||||
local spoof_streams_patch
|
|
||||||
spoof_streams_patch=$(grep "^Name: " <<<"$list_patches" | grep -i "spoof" | grep -i "streams" || :) spoof_streams_patch=${spoof_streams_patch#*: }
|
|
||||||
if [ -n "$spoof_streams_patch" ] && [[ ${p_patcher_args[*]} =~ $spoof_streams_patch ]]; then
|
|
||||||
epr "You cant include/exclude spoof stream patch as that's done by rvmm builder automatically."
|
|
||||||
p_patcher_args=("${p_patcher_args[@]//-[ei] ${spoof_streams_patch}/}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
local patcher_args patched_apk build_mode
|
local patcher_args patched_apk build_mode
|
||||||
local rv_brand_f=${args[rv_brand],,}
|
local rv_brand_f=${args[rv_brand],,}
|
||||||
@@ -543,7 +642,7 @@ build_rv() {
|
|||||||
for build_mode in "${build_mode_arr[@]}"; do
|
for build_mode in "${build_mode_arr[@]}"; do
|
||||||
patcher_args=("${p_patcher_args[@]}")
|
patcher_args=("${p_patcher_args[@]}")
|
||||||
pr "Building '${table}' in '$build_mode' mode"
|
pr "Building '${table}' in '$build_mode' mode"
|
||||||
if [ -n "$microg_patch" ] || [ -n "$spoof_streams_patch" ]; then
|
if [ -n "$microg_patch" ]; then
|
||||||
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}-${build_mode}.apk"
|
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}-${build_mode}.apk"
|
||||||
else
|
else
|
||||||
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk"
|
patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk"
|
||||||
@@ -555,31 +654,31 @@ build_rv() {
|
|||||||
patcher_args+=("-d \"${microg_patch}\"")
|
patcher_args+=("-d \"${microg_patch}\"")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -n "$spoof_streams_patch" ]; then
|
|
||||||
if [ "$build_mode" = apk ]; then
|
local stock_apk_to_patch="${stock_apk}.stripped.apk"
|
||||||
patcher_args+=("-e \"${spoof_streams_patch}\"")
|
cp -f "$stock_apk" "$stock_apk_to_patch"
|
||||||
elif [ "$build_mode" = module ]; then
|
if [ "$build_mode" = module ]; then
|
||||||
patcher_args+=("-d \"${spoof_streams_patch}\"")
|
zip -d "$stock_apk_to_patch" "lib/*" >/dev/null 2>&1 || :
|
||||||
fi
|
else
|
||||||
fi
|
if [ "$arch" = "arm64-v8a" ]; then
|
||||||
if [ "${args[riplib]}" = true ]; then
|
zip -d "$stock_apk_to_patch" "lib/armeabi-v7a/*" "lib/x86_64/*" "lib/x86/*" >/dev/null 2>&1 || :
|
||||||
patcher_args+=("--rip-lib x86_64 --rip-lib x86")
|
elif [ "$arch" = "arm-v7a" ]; then
|
||||||
if [ "$build_mode" = module ]; then
|
zip -d "$stock_apk_to_patch" "lib/arm64-v8a/*" "lib/x86_64/*" "lib/x86/*" >/dev/null 2>&1 || :
|
||||||
patcher_args+=("--rip-lib arm64-v8a --rip-lib armeabi-v7a --unsigned")
|
elif [ "$arch" = "x86" ]; then
|
||||||
|
zip -d "$stock_apk_to_patch" "lib/arm64-v8a/*" "lib/x86_64/*" "lib/armeabi-v7a/*" >/dev/null 2>&1 || :
|
||||||
|
elif [ "$arch" = "x86_64" ]; then
|
||||||
|
zip -d "$stock_apk_to_patch" "lib/arm64-v8a/*" "lib/armeabi-v7a/*" "lib/x86/*" >/dev/null 2>&1 || :
|
||||||
else
|
else
|
||||||
if [ "$arch" = "arm64-v8a" ]; then
|
zip -d "$stock_apk_to_patch" "lib/x86_64/*" "lib/x86/*" >/dev/null 2>&1 || :
|
||||||
patcher_args+=("--rip-lib armeabi-v7a")
|
|
||||||
elif [ "$arch" = "arm-v7a" ]; then
|
|
||||||
patcher_args+=("--rip-lib arm64-v8a")
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "${NORB:-}" != true ] || [ ! -f "$patched_apk" ]; then
|
if [ "${NORB:-}" != true ] || [ ! -f "$patched_apk" ]; then
|
||||||
if ! patch_apk "$stock_apk" "$patched_apk" "${patcher_args[*]}" "${args[cli]}" "${args[ptjar]}"; then
|
if ! patch_apk "$stock_apk_to_patch" "$patched_apk" "${patcher_args[*]}" "${args[cli]}" "${args[ptjar]}"; then
|
||||||
epr "Building '${table}' failed!"
|
epr "Building '${table}' failed!"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
rm "$stock_apk_to_patch"
|
||||||
if [ "$build_mode" = apk ]; then
|
if [ "$build_mode" = apk ]; then
|
||||||
local apk_output="${BUILD_DIR}/${app_name_l}-${rv_brand_f}-v${version_f}-${arch_f}.apk"
|
local apk_output="${BUILD_DIR}/${app_name_l}-${rv_brand_f}-v${version_f}-${arch_f}.apk"
|
||||||
mv -f "$patched_apk" "$apk_output"
|
mv -f "$patched_apk" "$apk_output"
|
||||||
@@ -592,15 +691,17 @@ build_rv() {
|
|||||||
local upj="${table,,}-update.json"
|
local upj="${table,,}-update.json"
|
||||||
|
|
||||||
module_config "$base_template" "$pkg_name" "$version" "$arch"
|
module_config "$base_template" "$pkg_name" "$version" "$arch"
|
||||||
|
|
||||||
|
local patches_ver="${patches_jar##*-}"
|
||||||
module_prop \
|
module_prop \
|
||||||
"${args[module_prop_name]}" \
|
"${args[module_prop_name]}" \
|
||||||
"${app_name} ${args[rv_brand]}" \
|
"${app_name} ${args[rv_brand]}" \
|
||||||
"$version" \
|
"${version} (patches ${patches_ver})" \
|
||||||
"${app_name} ${args[rv_brand]} Magisk module" \
|
"${app_name} ${args[rv_brand]} module" \
|
||||||
"https://raw.githubusercontent.com/${GITHUB_REPOSITORY-}/update/${upj}" \
|
"https://raw.githubusercontent.com/${GITHUB_REPOSITORY-}/update/${upj}" \
|
||||||
"$base_template"
|
"$base_template"
|
||||||
|
|
||||||
local module_output="${app_name_l}-${rv_brand_f}-magisk-v${version_f}-${arch_f}.zip"
|
local module_output="${app_name_l}-${rv_brand_f}-module-v${version_f}-${arch_f}.zip"
|
||||||
pr "Packing module ${table}"
|
pr "Packing module ${table}"
|
||||||
cp -f "$patched_apk" "${base_template}/base.apk"
|
cp -f "$patched_apk" "${base_template}/base.apk"
|
||||||
if [ "${args[include_stock]}" = true ]; then cp -f "$stock_apk" "${base_template}/${pkg_name}.apk"; fi
|
if [ "${args[include_stock]}" = true ]; then cp -f "$stock_apk" "${base_template}/${pkg_name}.apk"; fi
|
||||||
@@ -628,10 +729,10 @@ MODULE_ARCH=$ma" >"$1/config"
|
|||||||
module_prop() {
|
module_prop() {
|
||||||
echo "id=${1}
|
echo "id=${1}
|
||||||
name=${2}
|
name=${2}
|
||||||
version=v${3} (${NEXT_VER_CODE})
|
version=v${3}
|
||||||
versionCode=${NEXT_VER_CODE}
|
versionCode=${NEXT_VER_CODE}
|
||||||
author=j-hc
|
author=j-hc
|
||||||
description=${4}" >"${6}/module.prop"
|
description=${4}" >"${6}/module.prop"
|
||||||
|
|
||||||
if [ "$ENABLE_MAGISK_UPDATE" = true ]; then echo "updateJson=${5}" >>"${6}/module.prop"; fi
|
if [ "$ENABLE_MODULE_UPDATE" = true ]; then echo "updateJson=${5}" >>"${6}/module.prop"; fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user