mirror of
https://github.com/j-hc/revanced-magisk-module.git
synced 2025-05-23 18:16:26 +02:00
log the build
Former-commit-id: bfa3d8d49b9f64aec4de66878eb129d37406c26c
This commit is contained in:
parent
09c8d51e9d
commit
2ba4494d74
@ -1,56 +1,78 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -xe
|
set -e
|
||||||
|
|
||||||
echo "All necessary files (revanced cli, patches and integrations, stock YouTube apk) will be downloaded, Youtube apk will be patched and zipped into a Magisk module"
|
if [ "$1" == "clean" ]; then
|
||||||
|
rm -r revanced-cache *.jar *.apk *.zip *.keystore build.log
|
||||||
|
fi
|
||||||
|
|
||||||
WGET_HEADER='User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0'
|
PATCHER_ARGS="-e microg-support -e premium-heading"
|
||||||
|
|
||||||
|
WGET_HEADER="User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0"
|
||||||
|
PATCHED_APK="revanced-base.apk"
|
||||||
|
|
||||||
function req() {
|
function req() {
|
||||||
wget -nv --show-progress -O $2 --header="$WGET_HEADER" $1
|
wget -nv -O "$2" --header="$WGET_HEADER" $1
|
||||||
}
|
}
|
||||||
|
|
||||||
# yes this is how i download the stock yt apk from apkmirror
|
# yes this is how i download the stock yt apk from apkmirror
|
||||||
function dl_yt() {
|
function dl_yt() {
|
||||||
URL="https://www.apkmirror.com$(req $1 - | tr '\n' ' ' | sed -n 's/href="/@/g; s;.*BUNDLE</span>[^@]*@\([^#]*\).*;\1;p')"
|
URL="https://www.apkmirror.com$(req $1 - | tr '\n' ' ' | sed -n 's/href="/@/g; s;.*BUNDLE</span>[^@]*@\([^#]*\).*;\1;p')"
|
||||||
|
log "downloaded from: $URL"
|
||||||
URL="https://www.apkmirror.com$(req $URL - | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
|
URL="https://www.apkmirror.com$(req $URL - | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
|
||||||
URL="https://www.apkmirror.com$(req $URL - | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
|
URL="https://www.apkmirror.com$(req $URL - | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
|
||||||
req $URL $2
|
req $URL "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dl_if_dne() {
|
||||||
|
if [ ! -f "$1" ]; then
|
||||||
|
echo -e "\nGetting '$1' from '$2'"
|
||||||
|
req "$2" "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
echo -e "$1" >>build.log
|
||||||
|
}
|
||||||
|
|
||||||
|
>build.log
|
||||||
|
|
||||||
|
log "$(date +'%Y-%m-%d')\n"
|
||||||
|
|
||||||
|
echo "All necessary files (revanced cli, patches and integrations, stock YouTube apk) will be downloaded, Youtube apk will be patched and zipped into a Magisk module"
|
||||||
|
|
||||||
RV_CLI_URL=$(req https://api.github.com/repos/revanced/revanced-cli/releases/latest - | sed -n 's/.*"browser_download_url": "\(.*jar\)".*/\1/p')
|
RV_CLI_URL=$(req https://api.github.com/repos/revanced/revanced-cli/releases/latest - | sed -n 's/.*"browser_download_url": "\(.*jar\)".*/\1/p')
|
||||||
RV_CLI_JAR=$(echo $RV_CLI_URL | awk -F/ '{ print $NF }')
|
RV_CLI_JAR=$(echo $RV_CLI_URL | awk -F/ '{ print $NF }')
|
||||||
|
log $RV_CLI_JAR
|
||||||
|
|
||||||
RV_INTEGRATIONS_URL=$(req https://api.github.com/repos/revanced/revanced-integrations/releases/latest - | sed -n 's/.*"browser_download_url": "\(.*apk\)".*/\1/p')
|
RV_INTEGRATIONS_URL=$(req https://api.github.com/repos/revanced/revanced-integrations/releases/latest - | sed -n 's/.*"browser_download_url": "\(.*apk\)".*/\1/p')
|
||||||
RV_INTEGRATIONS_APK=$(echo $RV_INTEGRATIONS_URL | awk '{n=split($0, arr, "/"); printf "%s-%s.apk", substr(arr[n], 0, length(arr[n]) - 4), arr[n-1]}')
|
RV_INTEGRATIONS_APK=$(echo $RV_INTEGRATIONS_URL | awk '{n=split($0, arr, "/"); printf "%s-%s.apk", substr(arr[n], 0, length(arr[n]) - 4), arr[n-1]}')
|
||||||
|
log $RV_INTEGRATIONS_APK
|
||||||
|
|
||||||
RV_PATCHES_URL=$(req https://api.github.com/repos/revanced/revanced-patches/releases/latest - | sed -n 's/.*"browser_download_url": "\(.*jar\)".*/\1/p')
|
RV_PATCHES_URL=$(req https://api.github.com/repos/revanced/revanced-patches/releases/latest - | sed -n 's/.*"browser_download_url": "\(.*jar\)".*/\1/p')
|
||||||
RV_PATCHES_JAR=$(echo $RV_PATCHES_URL | awk -F/ '{ print $NF }')
|
RV_PATCHES_JAR=$(echo $RV_PATCHES_URL | awk -F/ '{ print $NF }')
|
||||||
|
log $RV_PATCHES_JAR
|
||||||
|
|
||||||
if [ ! -f $RV_CLI_JAR ]; then
|
dl_if_dne $RV_CLI_JAR $RV_CLI_URL
|
||||||
req $RV_CLI_URL $RV_CLI_JAR
|
dl_if_dne $RV_INTEGRATIONS_APK $RV_INTEGRATIONS_URL
|
||||||
fi
|
dl_if_dne $RV_PATCHES_JAR $RV_PATCHES_URL
|
||||||
if [ ! -f $RV_INTEGRATIONS_APK ]; then
|
|
||||||
req $RV_INTEGRATIONS_URL $RV_INTEGRATIONS_APK
|
|
||||||
fi
|
|
||||||
if [ ! -f $RV_PATCHES_JAR ]; then
|
|
||||||
req $RV_PATCHES_URL $RV_PATCHES_JAR
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
# This only finds the supported versions of some random patch wrt the first occurance of the string but that's fine
|
||||||
SUPPORTED_VERSIONS=$(unzip -p $RV_PATCHES_JAR | strings -n 8 -s , | sed -rn 's/.*youtube,versions,(([0-9.]*,*)*),Lk.*/\1/p')
|
SUPPORTED_VERSIONS=$(unzip -p $RV_PATCHES_JAR | strings -n 8 -s , | sed -rn 's/.*youtube,versions,(([0-9.]*,*)*),Lk.*/\1/p')
|
||||||
echo "Supported versions of the patch: $SUPPORTED_VERSIONS"
|
echo "Supported versions of the patch: $SUPPORTED_VERSIONS"
|
||||||
LAST_VER=$(echo $SUPPORTED_VERSIONS | awk -F, '{ print $NF }')
|
LAST_VER=$(echo $SUPPORTED_VERSIONS | awk -F, '{ print $NF }')
|
||||||
echo "Choosing $LAST_VER"
|
echo "Choosing '${LAST_VER}'"
|
||||||
|
log "\nYouTube version: ${LAST_VER}"
|
||||||
BASE_APK="base-v${LAST_VER}.apk"
|
BASE_APK="base-v${LAST_VER}.apk"
|
||||||
|
|
||||||
if [ ! -f $BASE_APK ]; then
|
if [ ! -f "$BASE_APK" ]; then
|
||||||
echo "$BASE_APK could not be found, will be downloaded from apkmirror.."
|
DL_OUTPUT="yt-stock-v${LAST_VER}.zip"
|
||||||
dl_yt "https://www.apkmirror.com/apk/google-inc/youtube/youtube-${LAST_VER//./-}-release/" yt-stock-v$LAST_VER.zip
|
dl_yt "https://www.apkmirror.com/apk/google-inc/youtube/youtube-${LAST_VER//./-}-release/" $DL_OUTPUT
|
||||||
unzip -p yt-stock-v$LAST_VER.zip base.apk >$BASE_APK
|
unzip -p $DL_OUTPUT base.apk >$BASE_APK
|
||||||
fi
|
fi
|
||||||
|
|
||||||
java -jar $RV_CLI_JAR -a $BASE_APK -c -o revanced-base.apk -b $RV_PATCHES_JAR -e microg-support -e premium-heading -m $RV_INTEGRATIONS_APK
|
java -jar $RV_CLI_JAR -a $BASE_APK -c -o $PATCHED_APK -b $RV_PATCHES_JAR -m $RV_INTEGRATIONS_APK $PATCHER_ARGS
|
||||||
mv -f revanced-base.apk ./revanced-magisk/revanced-base.apk
|
mv -f $PATCHED_APK ./revanced-magisk/${PATCHED_APK}
|
||||||
|
|
||||||
echo "Creating the magisk module..."
|
echo "Creating the magisk module..."
|
||||||
OUTPUT="revanced-magisk-v${LAST_VER}.zip"
|
OUTPUT="revanced-magisk-v${LAST_VER}.zip"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user