update magisk module template

Former-commit-id: 4f4f7694b7725f0b2f5154be01324c8286237fe9
This commit is contained in:
j-hc 2022-06-30 19:25:37 +03:00
parent 15f2442fe3
commit 49abcfa2cd
10 changed files with 52 additions and 182 deletions

View File

@ -3,11 +3,11 @@
<sub>(unaffiliated what-so-ever)<sub> <sub>(unaffiliated what-so-ever)<sub>
This repo includes a simple script that This repo includes a simple script that
downloads all the latest version of necessary prebuilt revanced tools and the stock YouTube APK from APKMirror and creates a magisk module downloads all the latest version of necessary prebuilt revanced tools and the stock YouTube APK from APKMirror and creates a magisk module
1
You will need to install the stock YouTube app matching with the module version on your phone using [SAI](https://play.google.com/store/apps/details?id=com.aefyr.sai&hl=tr&gl=US) with the split APKs You will need to install the stock YouTube app matching with the module version on your phone using [SAI](https://play.google.com/store/apps/details?id=com.aefyr.sai&hl=tr&gl=US) with the split APKs
You can go grab the split APKs from APKMirror (the bundle, not the apk or it will crash) You can go grab the split APKs from APKMirror (the bundle, not the apk or it will crash)
1
You can get the [latest CI release](https://github.com/j-hc/revanced-magisk-module/releases/tag/main) if you do not want to build yourself. You can get the [latest CI release](https://github.com/j-hc/revanced-magisk-module/releases/tag/main) if you do not want to build yourself.

View File

@ -50,13 +50,13 @@ if [ ! -f $BASE_APK ]; then
fi fi
java -jar $RV_CLI_JAR -a $BASE_APK -c -o revanced-base.apk -b $RV_PATCHES_JAR -e microg-support -m $RV_INTEGRATIONS_APK java -jar $RV_CLI_JAR -a $BASE_APK -c -o revanced-base.apk -b $RV_PATCHES_JAR -e microg-support -m $RV_INTEGRATIONS_APK
mv -f revanced-base.apk ./MMT-Extended/revanced-base.apk mv -f revanced-base.apk ./revanced-magisk/revanced-base.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"
sed -i "s/version=v.*$/version=v$LAST_VER/g" ./MMT-Extended/module.prop sed -i "s/version=v.*$/version=v$LAST_VER/g" ./revanced-magisk/module.prop
cd MMT-Extended cd revanced-magisk
zip -r ../$OUTPUT . zip -r ../$OUTPUT .
echo "Created the magisk module '$OUTPUT'" echo "Created the magisk module '$OUTPUT'"

154
revanced-magisk/META-INF/com/google/android/update-binary Normal file → Executable file
View File

@ -6,168 +6,28 @@
umask 022 umask 022
# Global vars
TMPDIR=/dev/tmp
PERSISTDIR=/sbin/.magisk/mirror/persist
rm -rf $TMPDIR 2>/dev/null
mkdir -p $TMPDIR
# echo before loading util_functions # echo before loading util_functions
ui_print() { echo "$1"; } ui_print() { echo "$1"; }
require_new_magisk() { require_new_magisk() {
ui_print "*******************************" ui_print "*******************************"
ui_print " Please install Magisk v19.0+! " ui_print " Please install Magisk v20.4+! "
ui_print "*******************************" ui_print "*******************************"
exit 1 exit 1
} }
is_legacy_script() { #########################
unzip -l "$ZIPFILE" install.sh | grep -q install.sh # Load util_functions.sh
return $? #########################
}
print_modname() {
local len
len=`echo -n $MODNAME | wc -c`
len=$((len + 2))
local pounds=`printf "%${len}s" | tr ' ' '*'`
ui_print "$pounds"
ui_print " $MODNAME "
ui_print "$pounds"
ui_print "*******************"
ui_print " Powered by Magisk "
ui_print "*******************"
}
##############
# Environment
##############
OUTFD=$2 OUTFD=$2
ZIPFILE=$3 ZIPFILE=$3
mount /data 2>/dev/null mount /data 2>/dev/null
# Load utility functions
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
. /data/adb/magisk/util_functions.sh . /data/adb/magisk/util_functions.sh
[ $MAGISK_VER_CODE -gt 18100 ] || require_new_magisk [ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
# Preperation for flashable zips install_module
setup_flashable exit 0
# Mount partitions
mount_partitions
# Detect version and architecture
api_level_arch_detect
# Setup busybox and binaries
$BOOTMODE && boot_actions || recovery_actions
##############
# Preparation
##############
# Extract prop file
unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2
[ ! -f $TMPDIR/module.prop ] && abort "! Unable to extract zip file!"
$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
MODULEROOT=$NVBASE/$MODDIRNAME
MODID=`grep_prop id $TMPDIR/module.prop`
MODPATH=$MODULEROOT/$MODID
MODNAME=`grep_prop name $TMPDIR/module.prop`
# Create mod paths
rm -rf $MODPATH 2>/dev/null
mkdir -p $MODPATH
##########
# Install
##########
if is_legacy_script; then
unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2
# Load install script
. $TMPDIR/install.sh
# Callbacks
print_modname
on_install
# Custom uninstaller
[ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh
# Skip mount
$SKIPMOUNT && touch $MODPATH/skip_mount
# prop file
$PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop
# Module info
cp -af $TMPDIR/module.prop $MODPATH/module.prop
# post-fs-data scripts
$POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh
# service scripts
$LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh
ui_print "- Setting permissions"
set_permissions
else
print_modname
unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2
if ! grep -q '^SKIPUNZIP=1$' $MODPATH/customize.sh 2>/dev/null; then
ui_print "- Extracting module files"
unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2
# Default permissions
set_perm_recursive $MODPATH 0 0 0755 0644
fi
# Load customization script
[ -f $MODPATH/customize.sh ] && . $MODPATH/customize.sh
fi
# Handle replace folders
for TARGET in $REPLACE; do
ui_print "- Replace target: $TARGET"
mktouch $MODPATH$TARGET/.replace
done
if $BOOTMODE; then
# Update info for Magisk Manager
mktouch $NVBASE/modules/$MODID/update
cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop
fi
# Copy over custom sepolicy rules
if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then
ui_print "- Installing custom sepolicy patch"
PERSISTMOD=$PERSISTDIR/magisk/$MODID
mkdir -p $PERSISTMOD
cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule
fi
# Remove stuffs that don't belong to modules
rm -rf \
$MODPATH/system/placeholder $MODPATH/customize.sh \
$MODPATH/README.md $MODPATH/.git* 2>/dev/null
##############
# Finalizing
##############
cd /
$BOOTMODE || recovery_cleanup
rm -rf $TMPDIR
ui_print "- Done"
exit 0

View File

38
revanced-magisk/common/functions.sh Normal file → Executable file
View File

@ -4,6 +4,10 @@
# #
########################################################################################## ##########################################################################################
cleanup() {
rm -rf $MODPATH/common 2>/dev/null
}
abort() { abort() {
ui_print "$1" ui_print "$1"
rm -rf $MODPATH 2>/dev/null rm -rf $MODPATH 2>/dev/null
@ -12,31 +16,6 @@ abort() {
exit 1 exit 1
} }
cleanup() {
rm -rf $MODPATH/common 2>/dev/null
ui_print " "
ui_print " ***************************************"
ui_print " * MMT Extended by Zackptg5 @ XDA *"
ui_print " ***************************************"
ui_print ""
ui_print " ***************************************"
ui_print " * YouTube Vanced Magisk Installer *"
ui_print " ***************************************"
ui_print ""
ui_print "
YOU MAY NEED TO REMOVE THE PREVIOUS MODULE
AND REBOOT PRIOR TO INSTALLING ANY UPDATES.
For more installation and troubleshooting
info, please visit:
https://forum.xda-Developers.com/showpost.php?p=83741225&postcount=17198
Huge thanks to: 73sydney, ipdev, Eselter, majicmazo
and the YouTube Vanced team
"
}
device_check() { device_check() {
local opt=`getopt -o dm -- "$@"` type=device local opt=`getopt -o dm -- "$@"` type=device
eval set -- "$opt" eval set -- "$opt"
@ -54,6 +33,7 @@ device_check() {
for j in "ro.product.$type" "ro.build.$type" "ro.product.vendor.$type" "ro.vendor.product.$type"; do for j in "ro.product.$type" "ro.build.$type" "ro.product.vendor.$type" "ro.vendor.product.$type"; do
[ "$(sed -n "s/^$j=//p" $i/build.prop 2>/dev/null | head -n 1 | tr '[:upper:]' '[:lower:]')" == "$prop" ] && return 0 [ "$(sed -n "s/^$j=//p" $i/build.prop 2>/dev/null | head -n 1 | tr '[:upper:]' '[:lower:]')" == "$prop" ] && return 0
done done
[ "$type" == "device" ] && [ "$(sed -n "s/^"ro.build.product"=//p" $i/build.prop 2>/dev/null | head -n 1 | tr '[:upper:]' '[:lower:]')" == "$prop" ] && return 0
fi fi
done done
return 1 return 1
@ -125,15 +105,21 @@ prop_process() {
done < $1 done < $1
} }
# Credits
ui_print "**************************************"
ui_print "* MMT Extended by Zackptg5 @ XDA *"
ui_print "**************************************"
ui_print " "
# Check for min/max api version # Check for min/max api version
[ -z $MINAPI ] || { [ $API -lt $MINAPI ] && abort "! Your system API of $API is less than the minimum api of $MINAPI! Aborting!"; } [ -z $MINAPI ] || { [ $API -lt $MINAPI ] && abort "! Your system API of $API is less than the minimum api of $MINAPI! Aborting!"; }
[ -z $MAXAPI ] || { [ $API -gt $MAXAPI ] && abort "! Your system API of $API is greater than the maximum api of $MAXAPI! Aborting!"; } [ -z $MAXAPI ] || { [ $API -gt $MAXAPI ] && abort "! Your system API of $API is greater than the maximum api of $MAXAPI! Aborting!"; }
# Set variables # Set variables
[ -z $ARCH32 ] && ARCH32="$(echo $ABI32 | cut -c-3)"
[ $API -lt 26 ] && DYNLIB=false [ $API -lt 26 ] && DYNLIB=false
[ -z $DYNLIB ] && DYNLIB=false [ -z $DYNLIB ] && DYNLIB=false
[ -z $DEBUG ] && DEBUG=false [ -z $DEBUG ] && DEBUG=false
[ -e "$PERSISTDIR" ] && PERSISTMOD=$PERSISTDIR/magisk/$MODID
INFO=$NVBASE/modules/.$MODID-files INFO=$NVBASE/modules/.$MODID-files
ORIGDIR="$MAGISKTMP/mirror" ORIGDIR="$MAGISKTMP/mirror"
if $DYNLIB; then if $DYNLIB; then

0
revanced-magisk/common/install.sh Normal file → Executable file
View File

23
revanced-magisk/customize.sh Normal file → Executable file
View File

@ -16,6 +16,29 @@ MINAPI=21
#DYNLIB=true #DYNLIB=true
#DEBUG=true #DEBUG=true
##########################################################################################
# Permissions
##########################################################################################
set_permissions() {
: # Remove this if adding to this function
# Note that all files/folders in magisk module directory have the $MODPATH prefix - keep this prefix on all of your files/folders
# Some examples:
# For directories (includes files in them):
# set_perm_recursive <dirname> <owner> <group> <dirpermission> <filepermission> <contexts> (default: u:object_r:system_file:s0)
# set_perm_recursive $MODPATH/system/lib 0 0 0755 0644
# set_perm_recursive $MODPATH/system/vendor/lib/soundfx 0 0 0755 0644
# For files (not in directories taken care of above)
# set_perm <filename> <owner> <group> <permission> <contexts> (default: u:object_r:system_file:s0)
# set_perm $MODPATH/system/lib/libart.so 0 0 0644
# set_perm /data/local/tmp/file.txt 0 0 644
}
########################################################################################## ##########################################################################################
# MMT Extended Logic - Don't modify anything after this # MMT Extended Logic - Don't modify anything after this
########################################################################################## ##########################################################################################

4
revanced-magisk/module.prop Normal file → Executable file
View File

@ -1,6 +1,6 @@
id=ytrvi id=ytrvi
name=YouTube ReVanced v17.24.34 name=YouTube ReVanced
version=v17.24.34 version=v17.25.34
versionCode=1 versionCode=1
author=j-hc author=j-hc
description=mounts base.apk for YouTube ReVanced description=mounts base.apk for YouTube ReVanced

1
revanced-magisk/uninstall.sh Normal file → Executable file
View File

@ -1,3 +1,4 @@
# Don't modify anything after this
if [ -f $INFO ]; then if [ -f $INFO ]; then
while read LINE; do while read LINE; do
if [ "$(echo -n $LINE | tail -c 1)" == "~" ]; then if [ "$(echo -n $LINE | tail -c 1)" == "~" ]; then