Updated template to latest Magisk version (19+)
This commit is contained in:
parent
ded86fe063
commit
daaadb8973
|
@ -1,321 +1,173 @@
|
||||||
#!/sbin/sh
|
#!/sbin/sh
|
||||||
|
|
||||||
##########################################################################################
|
#################
|
||||||
# Functions
|
# Initialization
|
||||||
##########################################################################################
|
#################
|
||||||
|
|
||||||
ui_print() {
|
umask 022
|
||||||
if ($BOOTMODE); then
|
|
||||||
echo "$1"
|
# Global vars
|
||||||
else
|
TMPDIR=/dev/tmp
|
||||||
echo -n -e "ui_print $1\n" >> /proc/self/fd/$OUTFD
|
PERSISTDIR=/sbin/.magisk/mirror/persist
|
||||||
echo -n -e "ui_print\n" >> /proc/self/fd/$OUTFD
|
|
||||||
fi
|
rm -rf $TMPDIR 2>/dev/null
|
||||||
|
mkdir -p $TMPDIR
|
||||||
|
|
||||||
|
# echo before loading util_functions
|
||||||
|
ui_print() { echo "$1"; }
|
||||||
|
|
||||||
|
require_new_magisk() {
|
||||||
|
ui_print "*******************************"
|
||||||
|
ui_print " Please install Magisk v19.0+! "
|
||||||
|
ui_print "*******************************"
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
grep_prop() {
|
is_legacy_script() {
|
||||||
REGEX="s/^$1=//p"
|
unzip -l "$ZIPFILE" install.sh | grep -q install.sh
|
||||||
shift
|
|
||||||
FILES=$@
|
|
||||||
if [ -z "$FILES" ]; then
|
|
||||||
FILES='/system/build.prop'
|
|
||||||
fi
|
|
||||||
cat $FILES 2>/dev/null | sed -n $REGEX | head -n 1
|
|
||||||
}
|
|
||||||
|
|
||||||
is_mounted() {
|
|
||||||
if [ ! -z "$2" ]; then
|
|
||||||
cat /proc/mounts | grep $1 | grep $2, >/dev/null
|
|
||||||
else
|
|
||||||
cat /proc/mounts | grep $1 >/dev/null
|
|
||||||
fi
|
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
mount_image() {
|
print_modname() {
|
||||||
if [ ! -d "$2" ]; then
|
local len
|
||||||
mkdir -p $2 2>/dev/null
|
len=`echo -n $MODNAME | wc -c`
|
||||||
chmod 755 $2
|
len=$((len + 2))
|
||||||
[ ! -d "$2" ] && return 1
|
local pounds=`printf "%${len}s" | tr ' ' '*'`
|
||||||
fi
|
ui_print "$pounds"
|
||||||
if (! is_mounted $2); then
|
ui_print " $MODNAME "
|
||||||
LOOPDEVICE=
|
ui_print "$pounds"
|
||||||
for LOOP in 0 1 2 3 4 5 6 7; do
|
ui_print "*******************"
|
||||||
if (! is_mounted $2); then
|
ui_print " Powered by Magisk "
|
||||||
LOOPDEVICE=/dev/block/loop$LOOP
|
ui_print "*******************"
|
||||||
if [ ! -f "$LOOPDEVICE" ]; then
|
|
||||||
mknod $LOOPDEVICE b 7 $LOOP
|
|
||||||
fi
|
|
||||||
losetup $LOOPDEVICE $1
|
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
mount -t ext4 -o loop $LOOPDEVICE $2
|
|
||||||
if (! is_mounted $2); then
|
|
||||||
/system/bin/toolbox mount -t ext4 -o loop $LOOPDEVICE $2
|
|
||||||
fi
|
|
||||||
if (! is_mounted $2); then
|
|
||||||
/system/bin/toybox mount -t ext4 -o loop $LOOPDEVICE $2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if (is_mounted $2); then
|
|
||||||
ui_print "- Mounting $1 to $2"
|
|
||||||
break;
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_perm() {
|
##############
|
||||||
chown $2:$3 $1 || exit 1
|
# Environment
|
||||||
chmod $4 $1 || exit 1
|
##############
|
||||||
if [ "$5" ]; then
|
|
||||||
chcon $5 $1 2>/dev/null
|
|
||||||
else
|
|
||||||
chcon 'u:object_r:system_file:s0' $1 2>/dev/null
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set_perm_recursive() {
|
|
||||||
find $1 -type d 2>/dev/null | while read dir; do
|
|
||||||
set_perm $dir $2 $3 $4 $6
|
|
||||||
done
|
|
||||||
find $1 -type f 2>/dev/null | while read file; do
|
|
||||||
set_perm $file $2 $3 $5 $6
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
mktouch() {
|
|
||||||
mkdir -p ${1%/*}
|
|
||||||
if [ -z "$2" ]; then
|
|
||||||
touch $1
|
|
||||||
else
|
|
||||||
echo $2 > $1
|
|
||||||
fi
|
|
||||||
chmod 644 $1
|
|
||||||
}
|
|
||||||
|
|
||||||
payload_size_check() {
|
|
||||||
reqSizeM=0;
|
|
||||||
for entry in $(unzip -l "$@" 2>/dev/null | tail -n +4 | awk '{ print $1 }'); do
|
|
||||||
test $entry != "--------" && reqSizeM=$((reqSizeM + entry)) || break;
|
|
||||||
done;
|
|
||||||
test $reqSizeM -lt 1048576 && reqSizeM=1 || reqSizeM=$((reqSizeM / 1048576));
|
|
||||||
}
|
|
||||||
|
|
||||||
target_size_check() {
|
|
||||||
e2fsck -p -f $1
|
|
||||||
curBlocks=`e2fsck -n $1 2>/dev/null | cut -d, -f3 | cut -d\ -f2`;
|
|
||||||
curUsedM=$((`echo "$curBlocks" | cut -d/ -f1` * 4 / 1024));
|
|
||||||
curSizeM=$((`echo "$curBlocks" | cut -d/ -f2` * 4 / 1024));
|
|
||||||
curFreeM=$((curSizeM - curUsedM));
|
|
||||||
}
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Flashable update-binary preparation
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
OUTFD=$2
|
OUTFD=$2
|
||||||
ZIP=$3
|
ZIPFILE=$3
|
||||||
|
|
||||||
readlink /proc/$$/fd/$OUTFD 2>/dev/null | grep /tmp >/dev/null
|
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
OUTFD=0
|
|
||||||
|
|
||||||
for FD in `ls /proc/$$/fd`; do
|
|
||||||
readlink /proc/$$/fd/$FD 2>/dev/null | grep pipe >/dev/null
|
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
ps | grep " 3 $FD " | grep -v grep >/dev/null
|
|
||||||
if [ "$?" -eq "0" ]; then
|
|
||||||
OUTFD=$FD
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$BOOTMODE" ]; then
|
|
||||||
BOOTMODE=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ($BOOTMODE) && (! is_mounted /magisk); then
|
|
||||||
ui_print "! Magisk is not activated!... abort"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Fix SuperSU.....
|
|
||||||
($BOOTMODE) && /data/magisk/sepolicy-inject -s fsck --live
|
|
||||||
|
|
||||||
TMPDIR=/tmp
|
|
||||||
MOUNTPATH=/magisk
|
|
||||||
IMGNAME=magisk.img
|
|
||||||
|
|
||||||
if ($BOOTMODE); then
|
|
||||||
TMPDIR=/dev/tmp
|
|
||||||
MOUNTPATH=/dev/magisk_merge
|
|
||||||
IMGNAME=magisk_merge.img
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p $TMPDIR 2>/dev/null
|
|
||||||
cd $TMPDIR
|
|
||||||
unzip -o "$ZIP" config.sh
|
|
||||||
|
|
||||||
if [ ! -f "config.sh" ]; then
|
|
||||||
ui_print "! Failed: Unable to extract zip file!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
source config.sh
|
|
||||||
|
|
||||||
INSTALLER=$TMPDIR/$MODID
|
|
||||||
MODPATH=$MOUNTPATH/$MODID
|
|
||||||
|
|
||||||
mkdir -p $INSTALLER
|
|
||||||
cd $INSTALLER
|
|
||||||
unzip -o "$ZIP" "common/*" module.prop
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Main
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
# Print mod name
|
|
||||||
print_modname
|
|
||||||
|
|
||||||
# Please leave this message in your flashable zip for credits :)
|
|
||||||
ui_print "******************************"
|
|
||||||
ui_print "Powered by Magisk (@topjohnwu)"
|
|
||||||
ui_print "******************************"
|
|
||||||
|
|
||||||
ui_print "- Mounting /system(ro), /vendor(ro), /data, /cache"
|
|
||||||
mount -o ro /system 2>/dev/null
|
|
||||||
mount -o ro /vendor 2>/dev/null
|
|
||||||
mount /data 2>/dev/null
|
mount /data 2>/dev/null
|
||||||
mount /cache 2>/dev/null
|
|
||||||
|
|
||||||
if [ ! -f '/system/build.prop' ]; then
|
# Load utility functions
|
||||||
ui_print "! Failed: /system could not be mounted!"
|
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
|
||||||
exit 1
|
. /data/adb/magisk/util_functions.sh
|
||||||
fi
|
[ $MAGISK_VER_CODE -gt 18100 ] || require_new_magisk
|
||||||
|
|
||||||
API=$(grep_prop ro.build.version.sdk)
|
# Preperation for flashable zips
|
||||||
ABI=$(grep_prop ro.product.cpu.abi | cut -c-3)
|
setup_flashable
|
||||||
ABI2=$(grep_prop ro.product.cpu.abi2 | cut -c-3)
|
|
||||||
ABILONG=$(grep_prop ro.product.cpu.abi)
|
|
||||||
|
|
||||||
ARCH=arm
|
# Mount partitions
|
||||||
IS64BIT=false
|
mount_partitions
|
||||||
if [ "$ABI" = "x86" ]; then ARCH=x86; fi;
|
|
||||||
if [ "$ABI2" = "x86" ]; then ARCH=x86; fi;
|
|
||||||
if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; IS64BIT=true; fi;
|
|
||||||
if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; IS64BIT=true; fi;
|
|
||||||
|
|
||||||
# You can get the Android API version from $API, the CPU architecture from $ARCH
|
# Detect version and architecture
|
||||||
# Useful if you are creating Android version / platform dependent mods
|
api_level_arch_detect
|
||||||
|
|
||||||
IMG=
|
# Setup busybox and binaries
|
||||||
if (is_mounted /data); then
|
$BOOTMODE && boot_actions || recovery_actions
|
||||||
IMG=/data/$IMGNAME
|
|
||||||
if [ ! -f "/data/magisk.img" ]; then
|
|
||||||
ui_print "! Magisk is not installed!"
|
|
||||||
ui_print "! Magisk is required for this mod!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
IMG=/cache/magisk.img
|
|
||||||
ui_print " "
|
|
||||||
ui_print "***********************************"
|
|
||||||
ui_print "* !! Data unavailible !! *"
|
|
||||||
ui_print "* Magisk detection is impossible *"
|
|
||||||
ui_print "* Installation will still proceed *"
|
|
||||||
ui_print "* But please make sure you have *"
|
|
||||||
ui_print "* Magisk installed!! *"
|
|
||||||
ui_print "***********************************"
|
|
||||||
ui_print " "
|
|
||||||
fi
|
|
||||||
|
|
||||||
payload_size_check "$ZIP" "*"
|
##############
|
||||||
|
# Preparation
|
||||||
|
##############
|
||||||
|
|
||||||
if [ -f "$IMG" ]; then
|
# Extract prop file
|
||||||
ui_print "- $IMG detected!"
|
unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2
|
||||||
target_size_check $IMG
|
[ ! -f $TMPDIR/module.prop ] && abort "! Unable to extract zip file!"
|
||||||
if [ "$reqSizeM" -gt "$curFreeM" ]; then
|
|
||||||
SIZE=$((((reqSizeM + curUsedM) / 32 + 2) * 32))
|
|
||||||
ui_print "- Resizing $IMG to ${SIZE}M..."
|
|
||||||
resize2fs $IMG ${SIZE}M
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
SIZE=$(((reqSizeM / 32 + 2) * 32));
|
|
||||||
ui_print "- Creating $IMG with size ${SIZE}M"
|
|
||||||
make_ext4fs -l ${SIZE}M -a /magisk -S $INSTALLER/common/file_contexts_image $IMG
|
|
||||||
fi
|
|
||||||
|
|
||||||
mount_image $IMG $MOUNTPATH
|
$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
|
||||||
if (! is_mounted $MOUNTPATH); then
|
MODULEROOT=$NVBASE/$MODDIRNAME
|
||||||
ui_print "! $IMG mount failed... abort"
|
MODID=`grep_prop id $TMPDIR/module.prop`
|
||||||
exit 1
|
MODPATH=$MODULEROOT/$MODID
|
||||||
fi
|
MODNAME=`grep_prop name $TMPDIR/module.prop`
|
||||||
|
|
||||||
# Create mod paths
|
# Create mod paths
|
||||||
rm -rf $MODPATH 2>/dev/null
|
rm -rf $MODPATH 2>/dev/null
|
||||||
mkdir -p $MODPATH
|
mkdir -p $MODPATH
|
||||||
|
|
||||||
# Copy files
|
##########
|
||||||
ui_print "- Copying files"
|
# Install
|
||||||
unzip -o "$ZIP" "system/*" -d $MODPATH
|
##########
|
||||||
|
|
||||||
# Handle replace folders
|
if is_legacy_script; then
|
||||||
for TARGET in $REPLACE; do
|
unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2
|
||||||
mktouch $MODPATH$TARGET/.replace
|
|
||||||
done
|
|
||||||
|
|
||||||
# Auto Mount
|
# Load install script
|
||||||
if ($AUTOMOUNT); then
|
. $TMPDIR/install.sh
|
||||||
mktouch $MODPATH/auto_mount
|
|
||||||
fi
|
|
||||||
|
|
||||||
# prop files
|
# Callbacks
|
||||||
if ($PROPFILE); then
|
print_modname
|
||||||
cp -af $INSTALLER/common/system.prop $MODPATH/system.prop
|
on_install
|
||||||
fi
|
|
||||||
|
# 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
|
# Module info
|
||||||
cp -af $INSTALLER/module.prop $MODPATH/module.prop
|
cp -af $TMPDIR/module.prop $MODPATH/module.prop
|
||||||
if ($BOOTMODE); then
|
|
||||||
# Update info for Magisk Manager
|
|
||||||
mktouch /magisk/$MODID/update
|
|
||||||
cp -af $INSTALLER/module.prop /magisk/$MODID/module.prop
|
|
||||||
fi
|
|
||||||
|
|
||||||
# post-fs-data mode scripts
|
# post-fs-data scripts
|
||||||
if ($POSTFSDATA); then
|
$POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh
|
||||||
cp -af $INSTALLER/common/post-fs-data.sh $MODPATH/post-fs-data.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
# service mode scripts
|
# service scripts
|
||||||
if ($LATESTARTSERVICE); then
|
$LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh
|
||||||
cp -af $INSTALLER/common/service.sh $MODPATH/service.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
ui_print "- Setting permissions"
|
ui_print "- Setting permissions"
|
||||||
set_permissions
|
set_permissions
|
||||||
|
else
|
||||||
|
print_modname
|
||||||
|
|
||||||
ui_print "- Unmounting partitions"
|
unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2
|
||||||
|
|
||||||
umount $MOUNTPATH
|
if ! grep -q '^SKIPUNZIP=1$' $MODPATH/customize.sh 2>/dev/null; then
|
||||||
losetup -d $LOOPDEVICE
|
ui_print "- Extracting module files"
|
||||||
rmdir $MOUNTPATH
|
unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2
|
||||||
|
|
||||||
# Shrink the image if possible
|
# Default permissions
|
||||||
target_size_check $IMG
|
set_perm_recursive $MODPATH 0 0 0755 0644
|
||||||
NEWDATASIZE=$(((curUsedM / 32 + 2) * 32))
|
|
||||||
if [ "$curSizeM" -gt "$NEWDATASIZE" ]; then
|
|
||||||
ui_print "- Shrinking $IMG to ${NEWDATASIZE}M..."
|
|
||||||
resize2fs $IMG ${NEWDATASIZE}M
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (! $BOOTMODE); then
|
# Load customization script
|
||||||
umount /system
|
[ -f $MODPATH/customize.sh ] && . $MODPATH/customize.sh
|
||||||
umount /vendor 2>/dev/null
|
|
||||||
fi
|
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"
|
ui_print "- Done"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/magisk(/.*)? u:object_r:system_file:s0
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/system/bin/sh
|
|
||||||
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/...
|
|
||||||
# This will make your scripts compatible even if Magisk change its mount point in the future
|
|
||||||
MODDIR=${0%/*}
|
|
||||||
|
|
||||||
# This script will be executed in post-fs-data mode
|
|
||||||
# More info in the main Magisk thread
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/system/bin/sh
|
|
||||||
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/...
|
|
||||||
# This will make your scripts compatible even if Magisk change its mount point in the future
|
|
||||||
MODDIR=${0%/*}
|
|
||||||
|
|
||||||
# This script will be executed in late_start service mode
|
|
||||||
# More info in the main Magisk thread
|
|
101
config.sh
101
config.sh
|
@ -1,101 +0,0 @@
|
||||||
##########################################################################################
|
|
||||||
#
|
|
||||||
# Magisk
|
|
||||||
# by topjohnwu
|
|
||||||
#
|
|
||||||
# This is a template zip for developers
|
|
||||||
#
|
|
||||||
##########################################################################################
|
|
||||||
##########################################################################################
|
|
||||||
#
|
|
||||||
# Instructions:
|
|
||||||
#
|
|
||||||
# 1. Place your files into system folder (delete the placeholder file)
|
|
||||||
# 2. Fill in your module's info into module.prop
|
|
||||||
# 3. Configure the settings in this file (common/config.sh)
|
|
||||||
# 4. For advanced features, add shell commands into the script files under common:
|
|
||||||
# post-fs-data.sh, service.sh
|
|
||||||
# 5. For changing props, add your additional/modified props into common/system.prop
|
|
||||||
#
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Defines
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
# NOTE: This part has to be adjusted to fit your own needs
|
|
||||||
|
|
||||||
# This will be the folder name under /magisk
|
|
||||||
# This should also be the same as the id in your module.prop to prevent confusion
|
|
||||||
MODID=magisk-module-audio-policy-fix
|
|
||||||
|
|
||||||
# Set to true if you need to enable Magic Mount
|
|
||||||
# Most mods would like it to be enabled
|
|
||||||
AUTOMOUNT=true
|
|
||||||
|
|
||||||
# Set to true if you need to load system.prop
|
|
||||||
PROPFILE=false
|
|
||||||
|
|
||||||
# Set to true if you need post-fs-data script
|
|
||||||
POSTFSDATA=false
|
|
||||||
|
|
||||||
# Set to true if you need late_start service script
|
|
||||||
LATESTARTSERVICE=false
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Installation Message
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
# Set what you want to show when installing your mod
|
|
||||||
|
|
||||||
print_modname() {
|
|
||||||
ui_print "****************************************"
|
|
||||||
ui_print " Magisk Module Audio Policy Fix "
|
|
||||||
ui_print "****************************************"
|
|
||||||
}
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Replace list
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
# List all directories you want to directly replace in the system
|
|
||||||
# By default Magisk will merge your files with the original system
|
|
||||||
# Directories listed here however, will be directly mounted to the correspond directory in the system
|
|
||||||
|
|
||||||
# You don't need to remove the example below, these values will be overwritten by your own list
|
|
||||||
# This is an example
|
|
||||||
REPLACE="
|
|
||||||
/system/app/Youtube
|
|
||||||
/system/priv-app/SystemUI
|
|
||||||
/system/priv-app/Settings
|
|
||||||
/system/framework
|
|
||||||
"
|
|
||||||
|
|
||||||
# Construct your own list here, it will overwrite the example
|
|
||||||
# !DO NOT! remove this if you don't need to replace anything, leave it empty as it is now
|
|
||||||
REPLACE="
|
|
||||||
"
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Permissions
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
# NOTE: This part has to be adjusted to fit your own needs
|
|
||||||
|
|
||||||
set_permissions() {
|
|
||||||
# Default permissions, don't remove them
|
|
||||||
set_perm_recursive $MODPATH 0 0 0755 0644
|
|
||||||
|
|
||||||
# Only some special files require specific permissions
|
|
||||||
# The default permissions should be good enough for most cases
|
|
||||||
|
|
||||||
# Some templates if you have no idea what to do:
|
|
||||||
|
|
||||||
# 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 <filename> <owner> <group> <permission> <contexts> (default: u:object_r:system_file:s0)
|
|
||||||
# set_perm $MODPATH/system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0
|
|
||||||
# set_perm $MODPATH/system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0
|
|
||||||
# set_perm $MODPATH/system/lib/libart.so 0 0 0644
|
|
||||||
}
|
|
|
@ -0,0 +1 @@
|
||||||
|
# This is customize the module installation process if you need
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/system/bin/sh
|
||||||
|
# Do NOT assume where your module will be located.
|
||||||
|
# ALWAYS use $MODDIR if you need to know where this script
|
||||||
|
# and module is placed.
|
||||||
|
# This will make sure your module will still work
|
||||||
|
# if Magisk change its mount point in the future
|
||||||
|
MODDIR=${0%/*}
|
||||||
|
|
||||||
|
# This script will be executed in post-fs-data mode
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/system/bin/sh
|
||||||
|
# Do NOT assume where your module will be located.
|
||||||
|
# ALWAYS use $MODDIR if you need to know where this script
|
||||||
|
# and module is placed.
|
||||||
|
# This will make sure your module will still work
|
||||||
|
# if Magisk change its mount point in the future
|
||||||
|
MODDIR=${0%/*}
|
||||||
|
|
||||||
|
# This script will be executed in late_start service mode
|
Loading…
Reference in New Issue