Switch to microg by inotia00

This commit is contained in:
Sayantan Santra 2023-03-20 12:19:02 -05:00
parent 238e10cc63
commit 82446b4b37

View file

@ -30,7 +30,7 @@ ver_less_than() {
} }
# Make sure to work in the script directory # Make sure to work in the script directory
SDIR="$(dirname -- "$( readlink -f -- "$0"; )";)" SDIR="$(dirname -- "$(readlink -f -- "$0")")"
cd "$SDIR" cd "$SDIR"
# Get line numbers where included & excluded patches start from. # Get line numbers where included & excluded patches start from.
@ -57,7 +57,7 @@ declare -a patches
# artifacts["apkeep"]="EFForg/apkeep apkeep-x86_64-unknown-linux-gnu" # artifacts["apkeep"]="EFForg/apkeep apkeep-x86_64-unknown-linux-gnu"
# Required artifacts in the format repository-name_filename # Required artifacts in the format repository-name_filename
artifacts="revanced/revanced-cli:revanced-cli.jar revanced/revanced-integrations:revanced-integrations.apk revanced/revanced-patches:revanced-patches.jar TeamVanced/VancedMicroG:microg.apk" artifacts="revanced/revanced-cli:revanced-cli.jar revanced/revanced-integrations:revanced-integrations.apk revanced/revanced-patches:revanced-patches.jar inotia00/VancedMicroG:microg.apk"
## Functions ## Functions
@ -117,7 +117,7 @@ for artifact in $artifacts; do
echo "Checking $basename" echo "Checking $basename"
version_present=$(jq -r ".\"$basename\"" versions.json) version_present=$(jq -r ".\"$basename\"" versions.json)
data="$(jq -r ".tools[] | select((.repository == \"$repo\") and (.content_type | contains(\"archive\")))" latest_versions.json)" data="$(jq -r ".tools[] | select((.repository == \"$repo\") and (.content_type | contains(\"archive\")))" latest_versions.json)"
version=$(echo "$data" | jq -r '.version') [[ $name == microg.apk ]] && version=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | jq -r '.tag_name') || version=$(echo "$data" | jq -r '.version')
if [[ $(ver_less_than $version_present $version) == true || ! -f $name || $2 == force ]]; then if [[ $(ver_less_than $version_present $version) == true || ! -f $name || $2 == force ]]; then
if [[ $2 == checkonly ]]; then if [[ $2 == checkonly ]]; then
echo "[checkonly] $basename has an update ($version_present -> $version)" echo "[checkonly] $basename has an update ($version_present -> $version)"
@ -127,7 +127,8 @@ for artifact in $artifacts; do
echo "Downloading $name" echo "Downloading $name"
[[ $name == microg.apk && -f $name && $2 != force ]] && microg_updated=true [[ $name == microg.apk && -f $name && $2 != force ]] && microg_updated=true
# shellcheck disable=SC2086,SC2046 # shellcheck disable=SC2086,SC2046
curl -sLo "$name" "$(echo "$data" | jq -r '.browser_download_url')" [[ $name == microg.apk ]] && download_link="https://github.com/$repo/releases/latest/download/$name" || download_link="$(echo "$data" | jq -r '.browser_download_url')"
curl -sLo "$name" "$download_link"
jq ".\"$basename\" = \"$version\"" versions.json >versions.json.tmp && mv versions.json.tmp versions.json jq ".\"$basename\" = \"$version\"" versions.json >versions.json.tmp && mv versions.json.tmp versions.json
echo "Upgraded $basename from $version_present to $version" echo "Upgraded $basename from $version_present to $version"
flag=true flag=true
@ -218,22 +219,22 @@ echo "Sending messages to telegram"
# /home/sintan/.local/bin/telegram-upload YouTube_ReVanced_nonroot_$timestamp.apk YouTube_Music_ReVanced_nonroot_$timestamp.apk --to "$channel_address" --caption "" && sent=true # /home/sintan/.local/bin/telegram-upload YouTube_ReVanced_nonroot_$timestamp.apk YouTube_Music_ReVanced_nonroot_$timestamp.apk --to "$channel_address" --caption "" && sent=true
# telegram.sh uses bot account, but it supports formatted messages # telegram.sh uses bot account, but it supports formatted messages
msg=$(cat versions.json | tail -n+2 | head -n-1 | cut -c3- | sed "s/\"//g" | sed "s/,//g" | sed "s/com.google.android.apps.youtube.music/YouTube Music/" \ msg=$(cat versions.json | tail -n+2 | head -n-1 | cut -c3- | sed "s/\"//g" | sed "s/,//g" | sed "s/com.google.android.apps.youtube.music/YouTube Music/" |
| sed "s/com.google.android.youtube/YouTube/" | sed "s/VancedMicroG/Vanced microG/" | sed "s/revanced-/ReVanced /g" | sed "s/patches/Patches/" \ sed "s/com.google.android.youtube/YouTube/" | sed "s/VancedMicroG/Vanced microG/" | sed "s/revanced-/ReVanced /g" | sed "s/patches/Patches/" |
| sed "s/cli/CLI/" | sed "s/integrations/Integrations/" | awk 1 ORS=$'\n') # I know, it's a hacky solution sed "s/cli/CLI/" | sed "s/integrations/Integrations/" | awk 1 ORS=$'\n') # I know, it's a hacky solution
# [ $sent ] && # [ $sent ] &&
./telegram.sh -T "⚙⚙⚙ Build Details ⚙⚙⚙" -M "$msg"$'\n'"Timestamp: $timestamp"$'\n'"⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯" ./telegram.sh -T "⚙⚙⚙ Build Details ⚙⚙⚙" -M "$msg"$'\n'"Timestamp: $timestamp"$'\n'"⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯"
[ $microg_updated ] && ./telegram.sh -M "_An update of microg was published. Please download it from the link in the pinned message._" [ $microg_updated ] && ./telegram.sh -M "_An update of microg was published._"
# Do some cleanup, keep only the last 3 build's worth of files and a week worth of logs # Do some cleanup, keep only the last 3 build's worth of files and a week worth of logs
mkdir -p archive mkdir -p archive
mv YouTube_ReVanced_nonroot_$timestamp.apk archive/ mv YouTube_ReVanced_nonroot_$timestamp.apk archive/
mv YouTube_Music_ReVanced_nonroot_$timestamp.apk archive/ mv YouTube_Music_ReVanced_nonroot_$timestamp.apk archive/
find ./archive -maxdepth 1 -type f -printf '%Ts\t%P\n' \ find ./archive -maxdepth 1 -type f -printf '%Ts\t%P\n' |
| sort -rn \ sort -rn |
| tail -n +7 \ tail -n +7 |
| cut -f2- \ cut -f2- |
| xargs -r -I {} rm "./archive/{}" xargs -r -I {} rm "./archive/{}"
find ./logs -mtime +7 -exec rm {} \; find ./logs -mtime +7 -exec rm {} \;
# Run a custom post script, if available # Run a custom post script, if available