From 58e2ecb126f00ffaf334335cd13890703d4e99fb Mon Sep 17 00:00:00 2001 From: Rei Ryuki <46316533+reiryuki@users.noreply.github.com> Date: Sat, 8 Jul 2023 00:08:34 +0700 Subject: [PATCH] Support /odm/etc/ & /my_product/etc/ (#6) * Support /odm/etc/ & /my_product/etc/ - Support /odm/etc/ & /my_product/etc/ audio files - Support stage_policy.conf - Remove duplicate - Fix context * Mount bind - Mount bind of support /odm/etc/ & /my_product/etc/ audio files * Fix permissions for Nougat and bellow * Tidy up * Added support for Magisk Delta Canary - Magisk Delta Canary now supports $MAGISKTMP/.magisk/mirror/odm & $MAGISKTMP/.magisk/mirror/my_product - Fixed permissions * Fix Bug Fix /odm/etc/ & /my_product/etc files umount & mount failures in Magisk Delta Canary --- post-fs-data.sh | 24 +++++++++++++++++++----- service.sh | 6 ++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/post-fs-data.sh b/post-fs-data.sh index 05998f3..5b9e889 100755 --- a/post-fs-data.sh +++ b/post-fs-data.sh @@ -55,13 +55,25 @@ osp_detect() { exec 2>$MODPATH/debug-pfsd.log set -x +# Paths +MIRROR=$MAGISKTMP/mirror +SYSTEM=`realpath $MIRROR/system` +VENDOR=`realpath $MIRROR/vendor` +ODM=`realpath $MIRROR/odm` +MY_PRODUCT=`realpath $MIRROR/my_product` + # Restore and reset . $MODPATH/uninstall.sh rm -rf $amldir $MODPATH/system $MODPATH/errors.txt $MODPATH/system.prop [ -f "$moddir/acdb/post-fs-data.sh" ] && mv -f $moddir/acdb/post-fs-data.sh $moddir/acdb/post-fs-data.sh.bak mkdir $amldir # Don't follow symlinks -files="$(find $MAGISKTMP/mirror/system_root/system $MAGISKTMP/mirror/system $MAGISKTMP/mirror/vendor -type f -name "*audio_effects*.conf" -o -name "*audio_effects*.xml" -o -name "*audio_*policy*.conf" -o -name "*audio_*policy*.xml" -o -name "*mixer_paths*.xml" -o -name "*mixer_gains*.xml" -o -name "*audio_device*.xml" -o -name "*sapa_feature*.xml" -o -name "*audio_platform_info*.xml" -o -name "*audio_configs*.xml" -o -name "*audio_device*.xml")" +lists="*audio*effects*.conf -o -name *audio*effects*.xml\ + -o -name *policy*.conf -o -name *policy*.xml\ + -o -name *mixer*paths*.xml -o -name *mixer*gains*.xml\ + -o -name *audio*device*.xml -o -name *sapa*feature*.xml\ + -o -name *audio*platform*info*.xml -o -name *audio*configs*.xml" +files="$(find $SYSTEM $VENDOR $ODM $MY_PRODUCT -type f -name $lists)" for file in $files; do name=$(echo "$file" | sed -e "s|$MAGISKTMP/mirror||" -e "s|/system_root/|/|" -e "s|/system/|/|") cp_mv -c $file $MODPATH/system$name @@ -74,7 +86,7 @@ for mod in $(find $moddir/* -maxdepth 0 -type d ! -name aml); do modname="$(basename $mod)" [ -f "$mod/disable" ] && continue # Move files - files="$(find $mod/system -type f -name "*audio_effects*.conf" -o -name "*audio_effects*.xml" -o -name "*audio_*policy*.conf" -o -name "*audio_*policy*.xml" -o -name "*mixer_paths*.xml" -o -name "*mixer_gains*.xml" -o -name "*audio_device*.xml" -o -name "*sapa_feature*.xml" -o -name "*audio_platform_info*.xml" -o -name "*audio_configs*.xml" -o -name "*audio_device*.xml" 2>/dev/null)" + files="$(find $mod/system -type f -name $lists 2>/dev/null)" [ "$files" ] && echo "$modname" >> $amldir/modlist || continue for file in $files; do cp_mv -m $file $amldir/$modname/$(echo "$file" | sed "s|$mod/||") @@ -90,8 +102,10 @@ done # Set perms and such set_perm_recursive $MODPATH/system 0 0 0755 0644 -if [ -d $MODPATH/system/vendor ]; then - set_perm_recursive $MODPATH/system/vendor 0 0 0755 0644 u:object_r:vendor_file:s0 - [ -d $MODPATH/system/vendor/etc ] && set_perm_recursive $MODPATH/system/vendor/etc 0 0 0755 0644 u:object_r:vendor_configs_file:s0 +if [ $API -ge 26 ]; then + set_perm_recursive $MODPATH/system/vendor 0 2000 0755 0644 u:object_r:vendor_file:s0 + set_perm_recursive $MODPATH/system/vendor/etc 0 2000 0755 0644 u:object_r:vendor_configs_file:s0 + set_perm_recursive $MODPATH/system/vendor/odm/etc 0 2000 0755 0644 u:object_r:vendor_configs_file:s0 + set_perm_recursive $MODPATH/system/odm/etc 0 0 0755 0644 u:object_r:vendor_configs_file:s0 fi exit 0 diff --git a/service.sh b/service.sh index 0a1a216..91822ec 100755 --- a/service.sh +++ b/service.sh @@ -212,8 +212,10 @@ for mod in $(find $moddir/* -maxdepth 0 -type d ! -name aml); do done # Reload patched files - original mounted files are seemingly deleted and replaced by sed -for i in $(find $MODPATH/system -type f); do - j="$(echo $i | sed "s|$MODPATH||")" +dir=$MODPATH/system +files=$(find $dir -type f) +for i in $files; do + j="$(echo $i | sed "s|$dir||")" umount $j mount -o bind $i $j done