Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NoName-exe authored Apr 11, 2024
2 parents 70a7711 + a0c9538 commit 440c558
Show file tree
Hide file tree
Showing 17 changed files with 215 additions and 244 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ assignees: ''

---

**DO NOT REPORT REVANCED BUGS IN THIS REPO**
**DO NOT REPORT REVANCED STUFF IN THIS REPO**

**Describe the bug of the rvmm builder or the modules**
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
*.jar
*.apk
*.zip
/revanced-cache
/temp
/build
test*
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ Get the [latest CI release](https://github.com/NoName-exe/revanced-extended/rele
* Support Magisk and KernelSU.

## Notes
* Use [mindetach](https://github.com/j-hc/mindetach-magisk) or [zygisk-detach](https://github.com/j-hc/zygisk-detach) to block Play Store from updating YouTube and YouTube-Music.
* Non-root versions of YouTube and YouTube-Music require [Vanced MicroG](https://github.com/inotia00/VancedMicroG/releases/latest) or [mMicroG](https://github.com/inotia00/mMicroG/releases/latest) to work.
* Use [zygisk-detach](https://github.com/j-hc/zygisk-detach) to block Play Store from updating YouTube and YouTube-Music.
* Non-root versions of YouTube and YouTube-Music require [MicroG](https://github.com/ReVanced/GmsCore/releases) to work.

## Credits
[j-hc](https://github.com/j-hc) for [mindetach](https://github.com/j-hc/mindetach-magisk), [zygisk-detach](https://github.com/j-hc/zygisk-detach) and the [script on which this is based on](https://github.com/j-hc/revanced-magisk-module).

[inotia00](https://github.com/inotia00) for [revanced-extended patches](https://github.com/inotia00/revanced-patches),[Vanced MicroG](https://github.com/inotia00/VancedMicroG) and [mMicroG](https://github.com/inotia00/mMicroG).
[ReVanced Team](https://github.com/revanced) for [MicroG](https://github.com/ReVanced/GmsCore/releases).

[inotia00](https://github.com/inotia00) for [revanced-extended patches](https://github.com/inotia00/revanced-patches).

[Gnad Gnaoh](https://github.com/gnadgnaoh) for helping me figure some stuff out.
Binary file added bin/aapt2/aapt2-arm
Binary file not shown.
Binary file added bin/aapt2/aapt2-arm64
Binary file not shown.
Binary file added bin/apksigner.jar
Binary file not shown.
Binary file added bin/htmlq/htmlq-arm
Binary file not shown.
Binary file added bin/htmlq/htmlq-arm64
Binary file not shown.
Binary file added bin/htmlq/htmlq-x86_64
Binary file not shown.
22 changes: 11 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env bash

set -euo pipefail
shopt -s nullglob
trap "rm -rf temp/*tmp.* temp/*/*tmp.*; exit 130" INT

if [ "${1:-}" = "clean" ]; then
if [ "${1-}" = "clean" ]; then
rm -rf temp build logs build.md
exit 0
fi
Expand All @@ -28,14 +29,14 @@ DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="inotia00/rev
DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced eXtended"
mkdir -p $TEMP_DIR $BUILD_DIR

if [ "${2:-}" = "--config-update" ]; then
if [ "${2-}" = "--config-update" ]; then
config_update
exit 0
fi

: >build.md
ENABLE_MAGISK_UPDATE=$(toml_get "$main_config_t" enable-magisk-update) || ENABLE_MAGISK_UPDATE=true
if [ "$ENABLE_MAGISK_UPDATE" = true ] && [ -z "${GITHUB_REPOSITORY:-}" ]; then
if [ "$ENABLE_MAGISK_UPDATE" = true ] && [ -z "${GITHUB_REPOSITORY-}" ]; then
pr "You are building locally. Magisk updates will not be enabled."
ENABLE_MAGISK_UPDATE=false
fi
Expand Down Expand Up @@ -82,7 +83,7 @@ for table_name in $(toml_get_table_names); do
cli_ver=$(toml_get "$t" cli-version) || cli_ver=$DEF_CLI_VER

if ! set_prebuilts "$integrations_src" "$patches_src" "$cli_src" "$integrations_ver" "$patches_ver" "$cli_ver"; then
if ! RVP="$(get_rv_prebuilts "$integrations_src" "$patches_src" "$integrations_ver" "$patches_ver" "$cli_src" "$cli_ver")"; then
if ! RVP="$(get_rv_prebuilts "$cli_src" "$cli_ver" "$integrations_src" "$integrations_ver" "$patches_src" "$patches_ver")"; then
abort "could not download rv prebuilts"
fi
read -r rv_cli_jar rv_integrations_apk rv_patches_jar rv_patches_json <<<"$RVP"
Expand All @@ -104,9 +105,9 @@ for table_name in $(toml_get_table_names); do
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]=""
if [ -n "${app_args[excluded_patches]}" ] && [[ "${app_args[excluded_patches]}" != *'"'* ]]; then abort "patch names inside excluded-patches must be quoted"; fi
if [ -n "${app_args[excluded_patches]}" ] && [[ ${app_args[excluded_patches]} != *'"'* ]]; then abort "patch names inside excluded-patches must be quoted"; fi
app_args[included_patches]=$(toml_get "$t" included-patches) || app_args[included_patches]=""
if [ -n "${app_args[included_patches]}" ] && [[ "${app_args[included_patches]}" != *'"'* ]]; then abort "patch names inside included-patches must be quoted"; fi
if [ -n "${app_args[included_patches]}" ] && [[ ${app_args[included_patches]} != *'"'* ]]; then abort "patch names inside included-patches must be quoted"; fi
app_args[exclusive_patches]=$(toml_get "$t" exclusive-patches) && vtf "${app_args[exclusive_patches]}" "exclusive-patches" || app_args[exclusive_patches]=false
app_args[version]=$(toml_get "$t" version) || app_args[version]="auto"
app_args[app_name]=$(toml_get "$t" app-name) || app_args[app_name]=$table_name
Expand Down Expand Up @@ -134,9 +135,9 @@ for table_name in $(toml_get_table_names); do
app_args[archive_dlurl]=${app_args[archive_dlurl]%/}
app_args[dl_from]=archive
} || app_args[archive_dlurl]=""
if [ -z "${app_args[dl_from]:-}" ]; then abort "ERROR: no 'apkmirror_dlurl', 'uptodown_dlurl' or 'apkmonk_dlurl' option was set for '$table_name'."; fi
if [ -z "${app_args[dl_from]-}" ]; then abort "ERROR: no 'apkmirror_dlurl', 'uptodown_dlurl' or 'apkmonk_dlurl' option was set for '$table_name'."; fi
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 [ "${app_args[arch]}" != "both" ] && [ "${app_args[arch]}" != "all" ] && [[ ${app_args[arch]} != "arm64-v8a"* ]] && [[ ${app_args[arch]} != "arm-v7a"* ]]; then
abort "wrong arch '${app_args[arch]}' for '$table_name'"
fi

Expand Down Expand Up @@ -167,10 +168,9 @@ wait
rm -rf temp/tmp.*
if [ -z "$(ls -A1 ${BUILD_DIR})" ]; then abort "All builds failed."; fi

log "\nInstall [Vanced Microg](https://github.com/inotia00/VancedMicroG/releases) or [mMicroG](https://github.com/inotia00/mMicroG/releases) to be able to use non-root YouTube or YouTube-Music."
log "Use [mindetach](https://github.com/j-hc/mindetach-magisk) or [zygisk-detach](https://github.com/j-hc/zygisk-detach) to block Play Store from updating YouTube and YouTube-Music."
log "\nInstall [MicroG](https://github.com/ReVanced/GmsCore/releases) to be able to use non-root YouTube or YouTube-Music."
log "Use [zygisk-detach](https://github.com/j-hc/zygisk-detach) to block Play Store from updating YouTube and YouTube-Music."
log "\n[Main Repo](https://github.com/NoName-exe/revanced-extended)"
log "\nChangelog:"
log "$(cat $TEMP_DIR/*-rv/changelog.md)"

SKIPPED=$(cat $TEMP_DIR/skipped 2>/dev/null || :)
Expand Down
89 changes: 57 additions & 32 deletions scripts/customize.sh → revanced-magisk/customize.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# shellcheck disable=SC2148,SC2086
# shellcheck disable=SC2148,SC2086,SC1091
. $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
#arm
ARCH_LIB=armeabi-v7a
alias cmpr='$MODPATH/bin/arm/cmpr'
elif [ $ARCH = "arm64" ]; then
#arm64
ARCH_LIB=arm64-v8a
alias cmpr='$MODPATH/bin/arm64/cmpr'
elif [ $ARCH = "x86" ]; then
Expand All @@ -20,76 +25,96 @@ else
fi
set_perm_recursive $MODPATH/bin 0 0 0755 0777

su -M -c "grep __PKGNAME /proc/mounts" | while read -r line; do
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 $PKG_NAME /proc/mounts | while read -r line; do
ui_print "- Un-mount"
mp=${line#* }
mp=${mp%% *}
su -M -c "umount -l ${mp%%\\*}"
mm umount -l ${mp%%\\*}
done
am force-stop __PKGNAME
am force-stop $PKG_NAME

INS=true
if BASEPATH=$(pm path __PKGNAME); then
if BASEPATH=$(pm path $PKG_NAME); then
BASEPATH=${BASEPATH##*:}
BASEPATH=${BASEPATH%/*}
if [ ${BASEPATH:1:6} = system ]; then
ui_print "- __PKGNAME is a system app"
ui_print "- $PKG_NAME is a system app"
elif [ ! -d ${BASEPATH}/lib ]; then
ui_print "- Invalid installation found. Uninstalling..."
pm uninstall -k --user 0 __PKGNAME
elif [ ! -f $MODPATH/__PKGNAME.apk ]; then
ui_print "- Stock __PKGNAME APK was not found"
VERSION=$(dumpsys package __PKGNAME | grep -m1 versionName)
pm uninstall -k --user 0 $PKG_NAME
elif [ ! -f $MODPATH/$PKG_NAME.apk ]; then
ui_print "- Stock $PKG_NAME APK was not found"
VERSION=$(dumpsys package $PKG_NAME | grep -m1 versionName)
VERSION="${VERSION#*=}"
if [ "$VERSION" = __PKGVER ] || [ -z "$VERSION" ]; then
if [ "$VERSION" = $PKG_VER ] || [ -z "$VERSION" ]; then
ui_print "- Skipping stock installation"
INS=false
else
abort "ERROR: Version mismatch
installed: $VERSION
module: __PKGVER
module: $PKG_VER
"
fi
elif cmpr $BASEPATH/base.apk $MODPATH/__PKGNAME.apk; then
ui_print "- __PKGNAME is up-to-date"
elif cmpr $BASEPATH/base.apk $MODPATH/$PKG_NAME.apk; then
ui_print "- $PKG_NAME is up-to-date"
INS=false
fi
fi
if [ $INS = true ]; then
if [ ! -f $MODPATH/__PKGNAME.apk ]; then
abort "ERROR: Stock __PKGNAME apk was not found"

install() {
if [ ! -f $MODPATH/$PKG_NAME.apk ]; then
abort "ERROR: Stock $PKG_NAME apk was not found"
fi
ui_print "- Updating __PKGNAME to __PKGVER"
ui_print "- Updating $PKG_NAME to $PKG_VER"
settings put global verifier_verify_adb_installs 0
SZ=$(stat -c "%s" $MODPATH/__PKGNAME.apk)
SZ=$(stat -c "%s" $MODPATH/$PKG_NAME.apk)
if ! SES=$(pm install-create --user 0 -i com.android.vending -r -d -S "$SZ" 2>&1); then
ui_print "ERROR: install-create failed"
abort "$SES"
fi
SES=${SES#*[}
SES=${SES%]*}
set_perm "$MODPATH/__PKGNAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0
if ! op=$(pm install-write -S "$SZ" "$SES" "__PKGNAME.apk" "$MODPATH/__PKGNAME.apk" 2>&1); then
set_perm "$MODPATH/$PKG_NAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0
if ! op=$(pm install-write -S "$SZ" "$SES" "$PKG_NAME.apk" "$MODPATH/$PKG_NAME.apk" 2>&1); then
ui_print "ERROR: install-write failed"
abort "$op"
fi
if ! op=$(pm install-commit "$SES" 2>&1); then
if echo "$op" | grep -q INSTALL_FAILED_VERSION_DOWNGRADE; then
ui_print "- INSTALL_FAILED_VERSION_DOWNGRADE. Uninstalling..."
pm uninstall -k --user 0 $PKG_NAME
return 1
fi
ui_print "ERROR: install-commit failed"
abort "$op"
fi
settings put global verifier_verify_adb_installs 1
if BASEPATH=$(pm path __PKGNAME); then
if BASEPATH=$(pm path $PKG_NAME); then
BASEPATH=${BASEPATH##*:}
BASEPATH=${BASEPATH%/*}
else
abort "ERROR: install __PKGNAME manually and reflash the module"
abort "ERROR: install $PKG_NAME manually and reflash the module"
fi
}
if [ $INS = true ]; then
if ! install; then
if ! install; then
abort
fi
fi
fi

BASEPATHLIB=${BASEPATH}/lib/${ARCH}
if [ -z "$(ls -A1 ${BASEPATHLIB})" ]; then
ui_print "- Extracting native libs"
mkdir -p $BASEPATHLIB
if ! op=$(unzip -j $MODPATH/__EXTRCT lib/${ARCH_LIB}/* -d ${BASEPATHLIB} 2>&1); then
if ! op=$(unzip -j $MODPATH/$PKG_NAME.apk lib/${ARCH_LIB}/* -d ${BASEPATHLIB} 2>&1); then
ui_print "ERROR: extracting native libs failed"
abort "$op"
fi
Expand All @@ -98,21 +123,21 @@ fi
ui_print "- Setting Permissions"
set_perm $MODPATH/base.apk 1000 1000 644 u:object_r:apk_data_file:s0

ui_print "- Mounting __PKGNAME"
ui_print "- Mounting $PKG_NAME"
mkdir -p $NVBASE/rvhc
RVPATH=$NVBASE/rvhc/${MODPATH##*/}.apk
mv -f $MODPATH/base.apk $RVPATH

if ! op=$(su -M -c "mount -o bind $RVPATH $BASEPATH/base.apk" 2>&1); then
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 __PKGNAME
ui_print "- Optimizing __PKGNAME"
nohup cmd package compile --reset __PKGNAME >/dev/null 2>&1 &
am force-stop $PKG_NAME
ui_print "- Optimizing $PKG_NAME"
nohup cmd package compile --reset $PKG_NAME >/dev/null 2>&1 &

ui_print "- Cleanup"
rm -rf $MODPATH/bin $MODPATH/__PKGNAME.apk
rm -rf ${MODPATH:?}/bin $MODPATH/$PKG_NAME.apk

for s in "uninstall.sh" "service.sh"; do
sed -i "2 i\NVBASE=${NVBASE}" $MODPATH/$s
Expand Down
19 changes: 10 additions & 9 deletions scripts/service.sh → revanced-magisk/service.sh
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
#!/system/bin/sh
# shellcheck disable=SC2086
# shellcheck disable=SC2086,SC1091
MODDIR=${0%/*}
RVPATH=$NVBASE/rvhc/${MODDIR##*/}.apk
. $MODDIR/config

until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done
until [ -d "/sdcard/Android" ]; do sleep 1; done
while
BASEPATH=$(pm path __PKGNAME)
BASEPATH=$(pm path $PKG_NAME)
svcl=$?
[ $svcl = 20 ]
do sleep 2; done
sleep 5

err() {
[ ! -f $MODDIR/err ] && cp $MODDIR/module.prop $MODDIR/err
sed -i "s/^des.*/description=⚠️ Module is inactive: '${1}'/g" $MODDIR/module.prop
sed -i "s/^des.*/description=⚠️ Needs reflash: '${1}'/g" $MODDIR/module.prop
}

if [ $svcl = 0 ]; then
BASEPATH=${BASEPATH##*:}
BASEPATH=${BASEPATH%/*}
if [ -d $BASEPATH/lib ]; then
VERSION=$(dumpsys package __PKGNAME | grep -m1 versionName)
VERSION=$(dumpsys package $PKG_NAME | grep -m1 versionName)
VERSION="${VERSION#*=}"
if [ "$VERSION" = __PKGVER ] || [ -z "$VERSION" ]; then
grep __PKGNAME /proc/mounts | while read -r line; do
if [ "$VERSION" = $PKG_VER ] || [ -z "$VERSION" ]; then
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
mount -o bind $RVPATH $BASEPATH/base.apk
am force-stop __PKGNAME
am force-stop $PKG_NAME
[ -f $MODDIR/err ] && mv -f $MODDIR/err $MODDIR/module.prop
else
err "mount failed"
fi
else
err "version mismatch (installed:${VERSION}, module:__PKGVER)"
err "version mismatch (installed:${VERSION}, module:$PKG_VER)"
fi
else
err "invalid installation"
err "zygote crashed"
fi
else
err "app not installed"
Expand Down
6 changes: 6 additions & 0 deletions revanced-magisk/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/system/bin/sh
{
MODDIR=${0%/*}
rm "$NVBASE/rvhc/${MODDIR##*/}".apk
rmdir "$NVBASE/rvhc"
} &
11 changes: 0 additions & 11 deletions scripts/uninstall.sh

This file was deleted.

6 changes: 6 additions & 0 deletions sig.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
a2a1ad7ba7f41dfca4514e2afeb90691719af6d0fdbed4b09bbf0ed897701ceb com.google.android.apps.youtube.music
3d7a1223019aa39d9ea0e3436ab7c0896bfb4fb679f4de5fe7c23f326c8f994a com.google.android.youtube
970b91143813b4c9d5f3634f672c9fcaa5621b4efaaedafd6c235cbbb869736f com.reddit.frontpage
0fd9a0cfb07b65950997b4eaebdc53931392391aa406538a3b04073bc2ce2fe9 com.twitter.android
9041803e91bcb814b4b4399fb5c85a91640b755e5e8ba76813814bf4cf2ab5ba com.zhiliaoapp.musically
1338f9b049893cc70b78432a177582f90bd4bc6296ea4ed35bcc7df59687ac53 tv.twitch.android.app
Loading

0 comments on commit 440c558

Please sign in to comment.