mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-01-11 23:23:37 +00:00
Properly handle loading prop files
1. Add new trigger "load_magisk_props_action" in init.magisk.rc 2. Patch init*.rc with new trigger 3. Update resetprop to handle prop value with spaces 4. Handle the case when modules contains file/folder names with spaces
This commit is contained in:
parent
f72205c401
commit
3315228a90
@ -74,6 +74,7 @@ EXIT /B %ERRORLEVEL%
|
|||||||
forfiles /P zip_static\x86 /C "cmd /C IF NOT @file == \"busybox\" DEL @file"
|
forfiles /P zip_static\x86 /C "cmd /C IF NOT @file == \"busybox\" DEL @file"
|
||||||
forfiles /P zip_static\x64 /C "cmd /C IF NOT @file == \"busybox\" DEL @file"
|
forfiles /P zip_static\x64 /C "cmd /C IF NOT @file == \"busybox\" DEL @file"
|
||||||
2>NUL DEL zip_static\META-INF\com\google\android\update-binary
|
2>NUL DEL zip_static\META-INF\com\google\android\update-binary
|
||||||
|
2>NUL DEL zip_static\common\custom_ramdisk_patch.sh
|
||||||
2>NUL DEL zip_static\common\magic_mask.sh
|
2>NUL DEL zip_static\common\magic_mask.sh
|
||||||
2>NUL RMDIR /S /Q uninstaller\arm
|
2>NUL RMDIR /S /Q uninstaller\arm
|
||||||
2>NUL RMDIR /S /Q uninstaller\arm64
|
2>NUL RMDIR /S /Q uninstaller\arm64
|
||||||
@ -98,6 +99,7 @@ EXIT /B %ERRORLEVEL%
|
|||||||
ECHO ************************
|
ECHO ************************
|
||||||
ECHO * Zipping Magisk v%~1
|
ECHO * Zipping Magisk v%~1
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
|
COPY /Y scripts\custom_ramdisk_patch.sh zip_static\common\custom_ramdisk_patch.sh
|
||||||
CD zip_static
|
CD zip_static
|
||||||
2>NUL DEL "..\Magisk-v%~1.zip"
|
2>NUL DEL "..\Magisk-v%~1.zip"
|
||||||
..\ziptools\win_bin\zip "..\Magisk-v%~1.zip" -r .
|
..\ziptools\win_bin\zip "..\Magisk-v%~1.zip" -r .
|
||||||
|
4
build.sh
4
build.sh
@ -24,7 +24,8 @@ cleanup() {
|
|||||||
ls zip_static/arm64/* | grep -v "busybox" | xargs rm -rfv
|
ls zip_static/arm64/* | grep -v "busybox" | xargs rm -rfv
|
||||||
ls zip_static/x86/* | grep -v "busybox" | xargs rm -rfv
|
ls zip_static/x86/* | grep -v "busybox" | xargs rm -rfv
|
||||||
ls zip_static/x64/* | grep -v "busybox" | xargs rm -rfv
|
ls zip_static/x64/* | grep -v "busybox" | xargs rm -rfv
|
||||||
rm -rfv zip_static/META-INF/com/google/android/update-binary
|
rm -rfv zip_static/META-INF/com/google/android/update-binary
|
||||||
|
rm -rfv zip_static/common/custom_ramdisk_patch.sh
|
||||||
rm -rfv zip_static/common/magic_mask.sh
|
rm -rfv zip_static/common/magic_mask.sh
|
||||||
rm -rfv uninstaller/arm
|
rm -rfv uninstaller/arm
|
||||||
rm -rfv uninstaller/arm64
|
rm -rfv uninstaller/arm64
|
||||||
@ -71,6 +72,7 @@ zip_package() {
|
|||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Zipping Magisk v$1"
|
echo "* Zipping Magisk v$1"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
|
cp -afv scripts/custom_ramdisk_patch.sh zip_static/common/custom_ramdisk_patch.sh
|
||||||
cd zip_static
|
cd zip_static
|
||||||
find . -type f -exec chmod 644 {} \;
|
find . -type f -exec chmod 644 {} \;
|
||||||
find . -type d -exec chmod 755 {} \;
|
find . -type d -exec chmod 755 {} \;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 5bafa01da8ea6c82742f96673a89dd6ca668372d
|
Subproject commit 3a6db7dbafdfb46fd09705ba1ab5477cacb87155
|
@ -30,24 +30,33 @@ cpio_rm() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file_contain() {
|
||||||
|
grep "$1" "$2" >/dev/null 2>&1
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
rm -rf /tmp/magisk/ramdisk 2>/dev/null
|
rm -rf /tmp/magisk/ramdisk 2>/dev/null
|
||||||
mkdir -p /tmp/magisk/ramdisk
|
mkdir -p /tmp/magisk/ramdisk
|
||||||
cd /tmp/magisk/ramdisk
|
cd /tmp/magisk/ramdisk
|
||||||
|
|
||||||
cat $RAMDISK | cpio -i
|
cat $RAMDISK | cpio -i
|
||||||
|
|
||||||
# Patch ramdisk
|
|
||||||
echo "- Patching ramdisk"
|
|
||||||
|
|
||||||
# Cleanup SuperSU backups
|
# Cleanup SuperSU backups
|
||||||
cpio_rm -r .subackup
|
cpio_rm -r .subackup
|
||||||
|
|
||||||
# Add magisk entrypoint
|
# Add magisk entrypoint
|
||||||
for INIT in init*.rc; do
|
for RC in init*.rc; do
|
||||||
if [ `grep -c "import /init.environ.rc" $INIT` -ne "0" ] && [ `grep -c "import /init.magisk.rc" $INIT` -eq "0" ]; then
|
if file_contain "import /init.environ.rc" $RC && ! file_contain "import /init.magisk.rc" $RC; then
|
||||||
sed -i "/import \/init\.environ\.rc/iimport /init.magisk.rc" $INIT
|
sed -i "/import \/init\.environ\.rc/iimport /init.magisk.rc" $RC
|
||||||
cpio_add $INIT 750
|
cpio_add $RC 750
|
||||||
break
|
fi
|
||||||
|
if file_contain "trigger load_persist_props_action" $RC && ! file_contain "trigger load_magisk_props_action" $RC; then
|
||||||
|
sed -i "/trigger load_persist_props_action/a\ \ \ \ trigger load_magisk_props_action" $RC
|
||||||
|
cpio_add $RC 750
|
||||||
|
fi
|
||||||
|
if file_contain "selinux.reload_policy"; then
|
||||||
|
sed -i "/selinux.reload_policy/d" $RC
|
||||||
|
cpio_add $RC 750
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -149,6 +149,11 @@ grep_prop() {
|
|||||||
cat $FILES 2>/dev/null | sed -n $REGEX | head -n 1
|
cat $FILES 2>/dev/null | sed -n $REGEX | head -n 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file_contain() {
|
||||||
|
grep "$1" "$2" >/dev/null 2>&1
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
unpack_boot() {
|
unpack_boot() {
|
||||||
rm -rf $UNPACKDIR $RAMDISK 2>/dev/null
|
rm -rf $UNPACKDIR $RAMDISK 2>/dev/null
|
||||||
mkdir -p $UNPACKDIR
|
mkdir -p $UNPACKDIR
|
||||||
@ -491,23 +496,31 @@ else
|
|||||||
mkdir -p /magisk/phh/su.d 2>/dev/null
|
mkdir -p /magisk/phh/su.d 2>/dev/null
|
||||||
cp -af $INSTALLER/common/phh/. /magisk/phh
|
cp -af $INSTALLER/common/phh/. /magisk/phh
|
||||||
cp -af $BINDIR/su $BINDIR/sepolicy-inject /magisk/phh/bin
|
cp -af $BINDIR/su $BINDIR/sepolicy-inject /magisk/phh/bin
|
||||||
chmod -R 755 /magisk/phh/bin
|
chmod -R 755 /magisk/phh
|
||||||
|
chown -R 0.0 /magisk/phh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Patch ramdisk
|
# Patch ramdisk
|
||||||
ui_print "- Patching ramdisk"
|
ui_print "- Patching ramdisk"
|
||||||
|
|
||||||
# Add magisk entrypoint
|
# Add magisk entrypoints
|
||||||
for INIT in init*.rc; do
|
for RC in init*.rc; do
|
||||||
if [ `grep -c "import /init.environ.rc" $INIT` -ne "0" ] && [ `grep -c "import /init.magisk.rc" $INIT` -eq "0" ]; then
|
if file_contain "import /init.environ.rc" $RC && ! file_contain "import /init.magisk.rc" $RC; then
|
||||||
cp $INIT .backup
|
[ ! -f .backup/$RC ] && cp -af $RC .backup
|
||||||
sed -i "/import \/init\.environ\.rc/iimport /init.magisk.rc" $INIT
|
sed -i "/import \/init\.environ\.rc/iimport /init.magisk.rc" $RC
|
||||||
break
|
fi
|
||||||
|
if file_contain "trigger load_persist_props_action" $RC && ! file_contain "trigger load_magisk_props_action" $RC; then
|
||||||
|
[ ! -f .backup/$RC ] && cp -af $RC .backup
|
||||||
|
sed -i "/trigger load_persist_props_action/a\ \ \ \ trigger load_magisk_props_action" $RC
|
||||||
|
fi
|
||||||
|
if file_contain "selinux.reload_policy"; then
|
||||||
|
[ ! -f .backup/$RC ] && cp -af $RC .backup
|
||||||
|
sed -i "/selinux.reload_policy/d" $RC
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
sed -i "/selinux.reload_policy/d" init.rc
|
for FSTAB in *fstab*; do
|
||||||
find . -type f -name "*fstab*" 2>/dev/null | while read FSTAB ; do
|
[ -L $FSTAB ] && continue
|
||||||
if (! $KEEPVERITY); then
|
if (! $KEEPVERITY); then
|
||||||
sed -i "s/,support_scfs//g" $FSTAB
|
sed -i "s/,support_scfs//g" $FSTAB
|
||||||
sed -i 's;,\{0,1\}verify\(=[^,]*\)\{0,1\};;g' $FSTAB
|
sed -i 's;,\{0,1\}verify\(=[^,]*\)\{0,1\};;g' $FSTAB
|
||||||
|
@ -28,7 +28,7 @@ log_print() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mktouch() {
|
mktouch() {
|
||||||
mkdir -p ${1%/*} 2>/dev/null
|
mkdir -p "${1%/*}" 2>/dev/null
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
touch "$1" 2>/dev/null
|
touch "$1" 2>/dev/null
|
||||||
else
|
else
|
||||||
@ -54,7 +54,7 @@ run_scripts() {
|
|||||||
if [ ! -f $MOD/disable ]; then
|
if [ ! -f $MOD/disable ]; then
|
||||||
if [ -f $MOD/$1.sh ]; then
|
if [ -f $MOD/$1.sh ]; then
|
||||||
chmod 755 $MOD/$1.sh
|
chmod 755 $MOD/$1.sh
|
||||||
chcon "u:object_r:system_file:s0" "$MOD/$1.sh"
|
chcon u:object_r:system_file:s0 $MOD/$1.sh
|
||||||
log_print "$1: $MOD/$1.sh"
|
log_print "$1: $MOD/$1.sh"
|
||||||
sh $MOD/$1.sh
|
sh $MOD/$1.sh
|
||||||
fi
|
fi
|
||||||
@ -73,7 +73,7 @@ loopsetup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
target_size_check() {
|
target_size_check() {
|
||||||
e2fsck -p -f $1
|
e2fsck -p -f "$1"
|
||||||
curBlocks=`e2fsck -n $1 2>/dev/null | cut -d, -f3 | cut -d\ -f2`;
|
curBlocks=`e2fsck -n $1 2>/dev/null | cut -d, -f3 | cut -d\ -f2`;
|
||||||
curUsedM=$((`echo "$curBlocks" | cut -d/ -f1` * 4 / 1024));
|
curUsedM=$((`echo "$curBlocks" | cut -d/ -f1` * 4 / 1024));
|
||||||
curSizeM=$((`echo "$curBlocks" | cut -d/ -f2` * 4 / 1024));
|
curSizeM=$((`echo "$curBlocks" | cut -d/ -f2` * 4 / 1024));
|
||||||
@ -84,39 +84,39 @@ travel() {
|
|||||||
# Ignore /system/vendor, we will handle it differently
|
# Ignore /system/vendor, we will handle it differently
|
||||||
[ "$1" = "system/vendor" ] && return
|
[ "$1" = "system/vendor" ] && return
|
||||||
|
|
||||||
cd $TRAVEL_ROOT/$1
|
cd "$TRAVEL_ROOT/$1"
|
||||||
if [ -f .replace ]; then
|
if [ -f .replace ]; then
|
||||||
rm -rf $MOUNTINFO/$1
|
rm -rf "$MOUNTINFO/$1"
|
||||||
mktouch $MOUNTINFO/$1 $TRAVEL_ROOT
|
mktouch "$MOUNTINFO/$1" "$TRAVEL_ROOT"
|
||||||
else
|
else
|
||||||
for ITEM in * ; do
|
for ITEM in * ; do
|
||||||
if [ ! -e /$1/$ITEM ]; then
|
if [ ! -e "/$1/$ITEM" ]; then
|
||||||
# New item found
|
# New item found
|
||||||
# If we are in a higher level, delete the lower levels
|
# If we are in a higher level, delete the lower levels
|
||||||
rm -rf $MOUNTINFO/dummy/$1
|
rm -rf "$MOUNTINFO/dummy/$1"
|
||||||
# Mount the dummy parent
|
# Mount the dummy parent
|
||||||
mktouch $MOUNTINFO/dummy/$1
|
mktouch "$MOUNTINFO/dummy/$1"
|
||||||
|
|
||||||
if [ -d $ITEM ]; then
|
if [ -d "$ITEM" ]; then
|
||||||
# Create new dummy directory and mount it
|
# Create new dummy directory and mount it
|
||||||
mkdir -p $DUMMDIR/$1/$ITEM
|
mkdir -p "$DUMMDIR/$1/$ITEM"
|
||||||
mktouch $MOUNTINFO/$1/$ITEM $TRAVEL_ROOT
|
mktouch "$MOUNTINFO/$1/$ITEM" "$TRAVEL_ROOT"
|
||||||
elif [ -L $ITEM ]; then
|
elif [ -L "$ITEM" ]; then
|
||||||
# Symlinks are small, copy them
|
# Symlinks are small, copy them
|
||||||
mkdir -p $DUMMDIR/$1 2>/dev/null
|
mkdir -p "$DUMMDIR/$1" 2>/dev/null
|
||||||
cp -afc $ITEM $DUMMDIR/$1/$ITEM
|
cp -afc "$ITEM" $"DUMMDIR/$1/$ITEM"
|
||||||
else
|
else
|
||||||
# Create new dummy file and mount it
|
# Create new dummy file and mount it
|
||||||
mktouch $DUMMDIR/$1/$ITEM
|
mktouch "$DUMMDIR/$1/$ITEM"
|
||||||
mktouch $MOUNTINFO/$1/$ITEM $TRAVEL_ROOT
|
mktouch "$MOUNTINFO/$1/$ITEM" "$TRAVEL_ROOT"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -d $ITEM ]; then
|
if [ -d "$ITEM" ]; then
|
||||||
# It's an directory, travel deeper
|
# It's an directory, travel deeper
|
||||||
(travel $1/$ITEM)
|
(travel "$1/$ITEM")
|
||||||
elif [ ! -L $ITEM ]; then
|
elif [ ! -L "$ITEM" ]; then
|
||||||
# Mount this file
|
# Mount this file
|
||||||
mktouch $MOUNTINFO/$1/$ITEM $TRAVEL_ROOT
|
mktouch "$MOUNTINFO/$1/$ITEM" "$TRAVEL_ROOT"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -125,28 +125,28 @@ travel() {
|
|||||||
|
|
||||||
clone_dummy() {
|
clone_dummy() {
|
||||||
LINK=false
|
LINK=false
|
||||||
in_list $1 "$WHITELIST" && LINK=true
|
in_list "$1" "$WHITELIST" && LINK=true
|
||||||
|
|
||||||
for ITEM in $MIRRDIR$1/* ; do
|
for ITEM in $MIRRDIR$1/* ; do
|
||||||
REAL=${ITEM#$MIRRDIR}
|
REAL="${ITEM#$MIRRDIR}"
|
||||||
if [ -d $MOUNTINFO$REAL ]; then
|
if [ -d "$MOUNTINFO$REAL" ]; then
|
||||||
# Need to clone deeper
|
# Need to clone deeper
|
||||||
mkdir -p $DUMMDIR$REAL
|
mkdir -p "$DUMMDIR$REAL"
|
||||||
(clone_dummy $REAL)
|
(clone_dummy "$REAL")
|
||||||
else
|
else
|
||||||
if [ -L $ITEM ]; then
|
if [ -L "$ITEM" ]; then
|
||||||
# Copy original symlink
|
# Copy original symlink
|
||||||
cp -afc $ITEM $DUMMDIR$REAL
|
cp -afc "$ITEM" "$DUMMDIR$REAL"
|
||||||
else
|
else
|
||||||
if $LINK && [ ! -e $MOUNTINFO$REAL ]; then
|
if $LINK && [ ! -e "$MOUNTINFO$REAL" ]; then
|
||||||
ln -s $MIRRDIR$REAL $DUMMDIR$REAL
|
ln -s "$MIRRDIR$REAL" "$DUMMDIR$REAL"
|
||||||
else
|
else
|
||||||
if [ -d $ITEM ]; then
|
if [ -d "$ITEM" ]; then
|
||||||
mkdir -p $DUMMDIR$REAL
|
mkdir -p "$DUMMDIR$REAL"
|
||||||
else
|
else
|
||||||
mktouch $DUMMDIR$REAL
|
mktouch "$DUMMDIR$REAL"
|
||||||
fi
|
fi
|
||||||
[ ! -e $MOUNTINFO$REAL ] && mktouch $MOUNTINFO/mirror$REAL
|
[ ! -e "$MOUNTINFO$REAL" ] && mktouch "$MOUNTINFO/mirror$REAL"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -154,8 +154,8 @@ clone_dummy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bind_mount() {
|
bind_mount() {
|
||||||
if [ -e $1 -a -e $2 ]; then
|
if [ -e "$1" -a -e "$2" ]; then
|
||||||
mount -o bind $1 $2
|
mount -o bind "$1" "$2"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
log_print "Mount: $1"
|
log_print "Mount: $1"
|
||||||
else
|
else
|
||||||
@ -248,10 +248,10 @@ case $1 in
|
|||||||
if [ -d /cache/magisk_mount ]; then
|
if [ -d /cache/magisk_mount ]; then
|
||||||
log_print "* Mounting cache files"
|
log_print "* Mounting cache files"
|
||||||
find /cache/magisk_mount -type f 2>/dev/null | while read ITEM ; do
|
find /cache/magisk_mount -type f 2>/dev/null | while read ITEM ; do
|
||||||
chmod 644 $ITEM
|
chmod 644 "$ITEM"
|
||||||
chcon "u:object_r:system_file:s0" $ITEM
|
chcon u:object_r:system_file:s0 "$ITEM"
|
||||||
TARGET=${ITEM#/cache/magisk_mount}
|
TARGET="${ITEM#/cache/magisk_mount}"
|
||||||
bind_mount $ITEM $TARGET
|
bind_mount "$ITEM" "$TARGET"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -276,7 +276,6 @@ case $1 in
|
|||||||
rm -rf $BINPATH $TOOLPATH
|
rm -rf $BINPATH $TOOLPATH
|
||||||
mkdir -p $TOOLPATH
|
mkdir -p $TOOLPATH
|
||||||
mv /cache/data_bin $BINPATH
|
mv /cache/data_bin $BINPATH
|
||||||
chmod -R 755 $BINPATH $TOOLPATH
|
|
||||||
$BINPATH/busybox --install -s $TOOLPATH
|
$BINPATH/busybox --install -s $TOOLPATH
|
||||||
ln -s $BINPATH/busybox $TOOLPATH/busybox
|
ln -s $BINPATH/busybox $TOOLPATH/busybox
|
||||||
# Prevent issues
|
# Prevent issues
|
||||||
@ -286,9 +285,10 @@ case $1 in
|
|||||||
mv /cache/stock_boot.img /data/stock_boot.img 2>/dev/null
|
mv /cache/stock_boot.img /data/stock_boot.img 2>/dev/null
|
||||||
mv /cache/magisk.apk /data/magisk.apk 2>/dev/null
|
mv /cache/magisk.apk /data/magisk.apk 2>/dev/null
|
||||||
|
|
||||||
find $BINPATH -exec chcon -h "u:object_r:system_file:s0" {} \;
|
# Set up environment
|
||||||
find $TOOLPATH -exec chcon -h "u:object_r:system_file:s0" {} \;
|
|
||||||
chmod -R 755 $BINPATH $TOOLPATH
|
chmod -R 755 $BINPATH $TOOLPATH
|
||||||
|
chown -R 0.0 $BINPATH $TOOLPATH
|
||||||
|
find $BINPATH $TOOLPATH -exec chcon -h u:object_r:system_file:s0 {} \;
|
||||||
|
|
||||||
# Live patch sepolicy
|
# Live patch sepolicy
|
||||||
$BINPATH/sepolicy-inject --live -s su
|
$BINPATH/sepolicy-inject --live -s su
|
||||||
@ -314,12 +314,12 @@ case $1 in
|
|||||||
|
|
||||||
# Remove empty directories, legacy paths, symlinks, old temporary images
|
# Remove empty directories, legacy paths, symlinks, old temporary images
|
||||||
find $MOUNTPOINT -type d -depth ! -path "*core*" -exec rmdir {} \; 2>/dev/null
|
find $MOUNTPOINT -type d -depth ! -path "*core*" -exec rmdir {} \; 2>/dev/null
|
||||||
rm -rf $COREDIR/bin $COREDIR/dummy $COREDIR/mirror /data/magisk/*.img 2>/dev/null
|
rm -rf $MOUNTPOINT/zzsupersu $COREDIR/bin $COREDIR/dummy $COREDIR/mirror /data/magisk/*.img 2>/dev/null
|
||||||
|
|
||||||
# Remove modules that is labeled to be removed
|
# Remove modules that is labeled to be removed
|
||||||
for MOD in $MOUNTPOINT/* ; do
|
for MOD in $MOUNTPOINT/* ; do
|
||||||
rm -f $MOD/system/placeholder 2>/dev/null
|
rm -f $MOD/system/placeholder 2>/dev/null
|
||||||
if [ -f $MOD/remove ] || [ $MOD = zzsupersu ]; then
|
if [ -f $MOD/remove ]; then
|
||||||
log_print "Remove module: $MOD"
|
log_print "Remove module: $MOD"
|
||||||
rm -rf $MOD
|
rm -rf $MOD
|
||||||
fi
|
fi
|
||||||
@ -327,7 +327,7 @@ case $1 in
|
|||||||
|
|
||||||
# Unmount, shrink, remount
|
# Unmount, shrink, remount
|
||||||
if umount $MOUNTPOINT; then
|
if umount $MOUNTPOINT; then
|
||||||
losetup -d $LOOPDEVICE
|
losetup -d $LOOPDEVICE 2>/dev/null
|
||||||
target_size_check $IMG
|
target_size_check $IMG
|
||||||
NEWDATASIZE=$(((curUsedM / 32 + 2) * 32))
|
NEWDATASIZE=$(((curUsedM / 32 + 2) * 32))
|
||||||
if [ "$curSizeM" -gt "$NEWDATASIZE" ]; then
|
if [ "$curSizeM" -gt "$NEWDATASIZE" ]; then
|
||||||
@ -365,8 +365,6 @@ case $1 in
|
|||||||
|
|
||||||
# Travel through all mods
|
# Travel through all mods
|
||||||
for MOD in $MOUNTPOINT/* ; do
|
for MOD in $MOUNTPOINT/* ; do
|
||||||
# Read in defined system props
|
|
||||||
[ -f $MOD/system.prop ] && /data/magisk/resetprop --file $MOD/system.prop
|
|
||||||
if [ -f $MOD/auto_mount -a -d $MOD/system -a ! -f $MOD/disable ]; then
|
if [ -f $MOD/auto_mount -a -d $MOD/system -a ! -f $MOD/disable ]; then
|
||||||
TRAVEL_ROOT=$MOD
|
TRAVEL_ROOT=$MOD
|
||||||
(travel system)
|
(travel system)
|
||||||
@ -379,7 +377,7 @@ case $1 in
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Proper permissions for generated items
|
# Proper permissions for generated items
|
||||||
find $TMPDIR -exec chcon -h "u:object_r:system_file:s0" {} \;
|
find $TMPDIR -exec chcon -h u:object_r:system_file:s0 {} \;
|
||||||
|
|
||||||
# linker(64), t*box required for bin
|
# linker(64), t*box required for bin
|
||||||
if [ -f $MOUNTINFO/dummy/system/bin ]; then
|
if [ -f $MOUNTINFO/dummy/system/bin ]; then
|
||||||
@ -411,10 +409,10 @@ case $1 in
|
|||||||
mv -f $MOUNTINFO/dummy/system/vendor $MOUNTINFO/dummy/vendor 2>/dev/null
|
mv -f $MOUNTINFO/dummy/system/vendor $MOUNTINFO/dummy/vendor 2>/dev/null
|
||||||
mv -f $DUMMDIR/system/vendor $DUMMDIR/vendor 2>/dev/null
|
mv -f $DUMMDIR/system/vendor $DUMMDIR/vendor 2>/dev/null
|
||||||
find $MOUNTINFO/dummy -type f 2>/dev/null | while read ITEM ; do
|
find $MOUNTINFO/dummy -type f 2>/dev/null | while read ITEM ; do
|
||||||
TARGET=${ITEM#$MOUNTINFO/dummy}
|
TARGET="${ITEM#$MOUNTINFO/dummy}"
|
||||||
ORIG=$DUMMDIR$TARGET
|
ORIG="$DUMMDIR$TARGET"
|
||||||
(clone_dummy $TARGET)
|
(clone_dummy "$TARGET")
|
||||||
bind_mount $ORIG $TARGET
|
bind_mount "$ORIG" "$TARGET"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check if the dummy /system/bin is empty, it shouldn't
|
# Check if the dummy /system/bin is empty, it shouldn't
|
||||||
@ -422,15 +420,10 @@ case $1 in
|
|||||||
|
|
||||||
# Stage 3
|
# Stage 3
|
||||||
log_print "* Stage 3: Mount module items"
|
log_print "* Stage 3: Mount module items"
|
||||||
find $MOUNTINFO/system -type f 2>/dev/null | while read ITEM ; do
|
find $MOUNTINFO/system $MOUNTINFO/vendor -type f 2>/dev/null | while read ITEM ; do
|
||||||
TARGET=${ITEM#$MOUNTINFO}
|
TARGET="${ITEM#$MOUNTINFO}"
|
||||||
ORIG=`cat $ITEM`$TARGET
|
ORIG="`cat "$ITEM"`$TARGET"
|
||||||
bind_mount $ORIG $TARGET
|
bind_mount "$ORIG" "$TARGET"
|
||||||
done
|
|
||||||
find $MOUNTINFO/vendor -type f 2>/dev/null | while read ITEM ; do
|
|
||||||
TARGET=${ITEM#$MOUNTINFO}
|
|
||||||
ORIG=`cat $ITEM`$TARGET
|
|
||||||
bind_mount $ORIG $TARGET
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Stage 4
|
# Stage 4
|
||||||
@ -440,9 +433,9 @@ case $1 in
|
|||||||
# Stage 5
|
# Stage 5
|
||||||
log_print "* Stage 5: Mount mirrored items back to dummy"
|
log_print "* Stage 5: Mount mirrored items back to dummy"
|
||||||
find $MOUNTINFO/mirror -type f 2>/dev/null | while read ITEM ; do
|
find $MOUNTINFO/mirror -type f 2>/dev/null | while read ITEM ; do
|
||||||
TARGET=${ITEM#$MOUNTINFO/mirror}
|
TARGET="${ITEM#$MOUNTINFO/mirror}"
|
||||||
ORIG=$MIRRDIR$TARGET
|
ORIG="$MIRRDIR$TARGET"
|
||||||
bind_mount $ORIG $TARGET
|
bind_mount "$ORIG" "$TARGET"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Bind hosts for Adblock apps
|
# Bind hosts for Adblock apps
|
||||||
@ -457,7 +450,7 @@ case $1 in
|
|||||||
cp -afc /data/busybox/. $COREDIR/busybox
|
cp -afc /data/busybox/. $COREDIR/busybox
|
||||||
cp -afc /system/xbin/. $COREDIR/busybox
|
cp -afc /system/xbin/. $COREDIR/busybox
|
||||||
chmod -R 755 $COREDIR/busybox
|
chmod -R 755 $COREDIR/busybox
|
||||||
chcon -hR "u:object_r:system_file:s0" $COREDIR/busybox
|
chcon -hR u:object_r:system_file:s0 $COREDIR/busybox
|
||||||
bind_mount $COREDIR/busybox /system/xbin
|
bind_mount $COREDIR/busybox /system/xbin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -482,6 +475,17 @@ case $1 in
|
|||||||
unblock
|
unblock
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
load_magisk_props )
|
||||||
|
for MOD in $MOUNTPOINT/* ; do
|
||||||
|
# Read in defined system props
|
||||||
|
if [ -f $MOD/system.prop ]; then
|
||||||
|
log_print "* Reading props from $MOD/system.prop"
|
||||||
|
/data/magisk/resetprop --file $MOD/system.prop
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unblock
|
||||||
|
;;
|
||||||
|
|
||||||
service )
|
service )
|
||||||
# Version info
|
# Version info
|
||||||
MAGISK_VERSION_STUB
|
MAGISK_VERSION_STUB
|
||||||
|
@ -10,6 +10,11 @@ on post-fs-data
|
|||||||
wait /dev/.magisk.unblock 60
|
wait /dev/.magisk.unblock 60
|
||||||
rm /dev/.magisk.unblock
|
rm /dev/.magisk.unblock
|
||||||
|
|
||||||
|
on load_magisk_props_action
|
||||||
|
start magisk_props
|
||||||
|
wait /dev/.magisk.unblock 5
|
||||||
|
rm /dev/.magisk.unblock
|
||||||
|
|
||||||
on property:magisk.restart_pfsd=1
|
on property:magisk.restart_pfsd=1
|
||||||
trigger post-fs-data
|
trigger post-fs-data
|
||||||
|
|
||||||
@ -27,6 +32,12 @@ service magisk_pfsd /sbin/magic_mask.sh post-fs-data
|
|||||||
seclabel u:r:su:s0
|
seclabel u:r:su:s0
|
||||||
oneshot
|
oneshot
|
||||||
|
|
||||||
|
# Load module props
|
||||||
|
service magisk_props /sbin/magic_mask.sh load_magisk_props
|
||||||
|
user root
|
||||||
|
seclabel u:r:su:s0
|
||||||
|
oneshot
|
||||||
|
|
||||||
# launch late_start script
|
# launch late_start script
|
||||||
service magisk_service /sbin/magic_mask.sh service
|
service magisk_service /sbin/magic_mask.sh service
|
||||||
class late_start
|
class late_start
|
||||||
|
Loading…
x
Reference in New Issue
Block a user