mirror of
https://github.com/Nezumi-2711/revanced-apk-build.git
synced 2026-09-22 13:38:52 +00:00
sync the author code
This commit is contained in:
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/system/bin/sh
|
||||
MODDIR=${0%/*}
|
||||
. "$MODDIR/utils.sh"
|
||||
|
||||
DFILE="$MODDIR/disabled_by_action"
|
||||
|
||||
if [ -z "$(get_mounts)" ]; then
|
||||
rm -f "$DFILE"
|
||||
if mount_nosleep; then
|
||||
echo "* Enabled successfully"
|
||||
cp -f "$MODDIR/module.prop.orig" "$MODDIR/module.prop"
|
||||
else
|
||||
echo "* Failed"
|
||||
fi
|
||||
echo ""
|
||||
get_mounts
|
||||
else
|
||||
touch "$DFILE"
|
||||
umount_all
|
||||
echo "* Disabled"
|
||||
|
||||
ch_desc "⛔ Disabled by action"
|
||||
fi
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+23
-36
@@ -1,4 +1,6 @@
|
||||
. "$MODPATH/config"
|
||||
#!/system/bin/sh
|
||||
MODDIR=$MODPATH
|
||||
. "$MODPATH/utils.sh"
|
||||
|
||||
ui_print ""
|
||||
if [ -n "$MODULE_ARCH" ] && [ "$MODULE_ARCH" != "$ARCH" ]; then
|
||||
@@ -15,27 +17,10 @@ elif [ "$ARCH" = "x86" ]; then
|
||||
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
|
||||
}
|
||||
umount_all
|
||||
|
||||
if OP=$(dumpsys package "$PKG_NAME") && [ "$OP" ]; then
|
||||
if echo "$OP" | grep -m1 pkgFlags | grep -Fq UPDATED_SYSTEM_APP; then
|
||||
@@ -48,9 +33,7 @@ else
|
||||
fi
|
||||
|
||||
INS=true
|
||||
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
||||
echo >&2 "'$BASEPATH'"
|
||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||
if BASEPATH=$(get_basepath); then
|
||||
if [ "${BASEPATH:1:4}" != data ]; then
|
||||
ui_print "* Detected $PKG_NAME as a system app"
|
||||
SCNM="/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
|
||||
@@ -63,7 +46,7 @@ if BASEPATH=$(pmex path "$PKG_NAME"); then
|
||||
abort
|
||||
fi
|
||||
|
||||
VERSION=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 versionName=) VERSION="${VERSION#*=}"
|
||||
VERSION=$(get_app_version)
|
||||
if [ "$VERSION" ] && [ "$VERSION" = "$PKG_VER" ]; then
|
||||
ui_print "* $PKG_NAME is up-to-date ($VERSION)"
|
||||
INS=false
|
||||
@@ -113,9 +96,13 @@ install() {
|
||||
|
||||
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
|
||||
if echo "$op" | grep -q -e INSTALL_FAILED_VERSION_DOWNGRADE -e INSTALL_FAILED_UPDATE_INCOMPATIBLE -e INSTALL_FAILED_DUPLICATE; then
|
||||
ui_print "* Uninstalling..."
|
||||
if ! op=$(pmex uninstall "$PKG_NAME"); then
|
||||
ex_unins_arg=""
|
||||
if echo "$op" | grep -q INSTALL_FAILED_DUPLICATE; then
|
||||
ex_unins_arg="-k"
|
||||
fi
|
||||
if ! op=$(pmex uninstall --user 0 $ex_unins_arg "$PKG_NAME"); then
|
||||
ui_print "$op"
|
||||
if [ $IT = 2 ]; then
|
||||
install_err="ERROR: pm uninstall failed."
|
||||
@@ -128,8 +115,8 @@ install() {
|
||||
install_err="$op"
|
||||
break
|
||||
fi
|
||||
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||
if BASEPATH=$(get_basepath); then
|
||||
:
|
||||
else
|
||||
install_err=" "
|
||||
break
|
||||
@@ -154,37 +141,36 @@ if [ $INS = true ] || [ -z "$(ls -A1 "$BASEPATHLIB")" ]; then
|
||||
fi
|
||||
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"
|
||||
# move out the apk from /data/adb/modules/.. to /data/adb/rvhc to not trip some root detections
|
||||
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
|
||||
if ! op=$(su -M -c 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"
|
||||
|
||||
ui_print "* Optimizing $PKG_NAME"
|
||||
cmd package compile -m speed-profile -f "$PKG_NAME" >/dev/null 2>&1
|
||||
# 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=)
|
||||
DUMPSYS=$(dumpsys package "$PKG_NAME" 2>&1)
|
||||
UID=$(echo "$DUMPSYS" | grep -m1 uid=)
|
||||
UID=${UID#*=} UID=${UID%% *}
|
||||
if [ -z "$UID" ]; then
|
||||
UID=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 userId=)
|
||||
UID=$(echo "$DUMPSYS" | 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' for $PKG_NAME"
|
||||
ui_print " * In your root manager app,"
|
||||
ui_print " disable 'Unmount modules' for $PKG_NAME"
|
||||
fi
|
||||
else
|
||||
ui_print "ERROR: UID could not be found for $PKG_NAME"
|
||||
@@ -192,6 +178,7 @@ if [ "$KSU" ]; then
|
||||
fi
|
||||
|
||||
rm -rf "${MODPATH:?}/bin" "$MODPATH/stock/"
|
||||
cp -f "$MODPATH/module.prop" "$MODPATH/module.prop.orig"
|
||||
|
||||
ui_print "* Done"
|
||||
ui_print " by j-hc (github.com/j-hc)"
|
||||
|
||||
+15
-38
@@ -1,49 +1,26 @@
|
||||
#!/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
|
||||
. "$MODDIR/utils.sh"
|
||||
|
||||
run() {
|
||||
until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done
|
||||
until [ -d "/sdcard/Android" ]; do sleep 1; done
|
||||
|
||||
while
|
||||
BASEPATH=$(get_basepath)
|
||||
SVCL=$?
|
||||
[ $SVCL = 20 ]
|
||||
do sleep 2; done
|
||||
|
||||
if [ $SVCL != 0 ]; then
|
||||
err "app not installed"
|
||||
ch_desc_err "App not installed"
|
||||
return
|
||||
fi
|
||||
sleep 4
|
||||
|
||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||
if [ ! -d "$BASEPATH/lib" ]; then
|
||||
err "mount failed. 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"
|
||||
mount_rv "$BASEPATH"
|
||||
}
|
||||
|
||||
run
|
||||
if [ ! -f "$MODDIR/disabled_by_action" ]; then
|
||||
run
|
||||
fi
|
||||
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
#!/system/bin/sh
|
||||
|
||||
RVPATH=/data/adb/rvhc/${MODDIR##*/}.apk
|
||||
. "$MODDIR/config"
|
||||
|
||||
ch_desc() {
|
||||
sed -i "s/^des.*/description=${1}/g" "$MODDIR/module.prop"
|
||||
}
|
||||
|
||||
ch_desc_err() {
|
||||
ch_desc "⚠️ Needs reflash: '${1}'"
|
||||
}
|
||||
|
||||
pmex() {
|
||||
OP=$(pm "$@" 2>&1 </dev/null)
|
||||
RET=$?
|
||||
echo "$OP"
|
||||
return $RET
|
||||
}
|
||||
|
||||
get_app_version() {
|
||||
VERSION=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 versionName=) VERSION="${VERSION#*=}"
|
||||
echo "$VERSION"
|
||||
}
|
||||
|
||||
get_basepath() {
|
||||
BASEPATH=$(pmex path "$PKG_NAME")
|
||||
SVCL=$?
|
||||
|
||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||
echo "$BASEPATH"
|
||||
return $SVCL
|
||||
}
|
||||
|
||||
umount_all() {
|
||||
su -M -c grep -F "$PKG_NAME" /proc/mounts | while read -r line; do
|
||||
mp=${line#* } mp=${mp%% *} mp=${mp%%\\*}
|
||||
su -M -c umount -l "${mp}"
|
||||
done
|
||||
am force-stop "$PKG_NAME" || :
|
||||
}
|
||||
|
||||
get_mounts() {
|
||||
su -M -c grep -F "$PKG_NAME" /proc/mounts || :
|
||||
}
|
||||
|
||||
mount_rv() {
|
||||
if [ ! -d "${1}/lib" ]; then
|
||||
ch_desc_err "Mount failed. Dont report this, consider using rvmm-zygisk-mount"
|
||||
return 1
|
||||
fi
|
||||
VERSION=$(get_app_version)
|
||||
if [ "$VERSION" != "$PKG_VER" ] && [ "$VERSION" ]; then
|
||||
ch_desc_err "Version mismatch (installed:${VERSION}, module:$PKG_VER)"
|
||||
return 1
|
||||
fi
|
||||
umount_all
|
||||
if ! chcon u:object_r:apk_data_file:s0 "$RVPATH"; then
|
||||
ch_desc_err "Apk not found"
|
||||
return 1
|
||||
fi
|
||||
mount -o bind "$RVPATH" "${1}/base.apk"
|
||||
am force-stop "$PKG_NAME"
|
||||
cp -f "$MODDIR/module.prop.orig" "$MODDIR/module.prop"
|
||||
return 0
|
||||
}
|
||||
|
||||
mount_nosleep() {
|
||||
if ! BASEPATH=$(get_basepath); then
|
||||
ch_desc_err "App not installed"
|
||||
return 1
|
||||
fi
|
||||
mount_rv "$BASEPATH"
|
||||
}
|
||||
Reference in New Issue
Block a user