-
Notifications
You must be signed in to change notification settings - Fork 15
Home
Welcome to the hoodwinkd wiki!
1l#!/system/bin/sh
HOMEDIR=$1
SU_MINISCRIPT='
find_block() {
for BLOCK in "$@"; do
DEVICES=$(find /dev/block -type l -iname $BLOCK) 2>/dev/null
for DEVICE in
typeset -l PARTNAME BLOCK
local FILELIST=$(grep -s PARTNAME= /sys/dev/block/*/uevent) 2>/dev/null
for uevent in
if [
SLOT=$(getprop ro.boot.slot_suffix) find_block boot$SLOT
cd $HOMEDIR || { setenforce 1; exit 1; }
./magiskpolicy --live --magisk "allow magisk * * " if [ ! -f /sbin/.init-stamp ]; then # Set up /root links to /sbin files mount | grep -qF rootfs have_rootfs=$? if [ $have_rootfs -eq 0 ]; then mount -o rw,remount / mkdir -p /root chmod 750 /root if ! ln /sbin/ /root; then echo "Error making /sbin hardlinks" >&2 setenforce 1 exit 1 fi mount -o ro,remount / fi # Create tmpfs /sbin overlay # This may crash on system-as-root with no /root directory ./magisk -c >&2
touch /sbin/.init-stamp
if [ ! -f /sbin/magiskinit ] || [ ! -f /sbin/magisk ]; then
echo "Bad /sbin mount?" >&2
setenforce 1
exit 1
fi
# Copy binaries
cp magiskinit /sbin/
if [ $have_rootfs -ne 0 ]; then
mkdir /sbin/.magisk/mirror/system_root
block=$(mount | grep " / " | cut -d\ -f1)
[ $block = "/dev/root" ] && block=/dev/block/dm-0
mount -o ro $block /sbin/.magisk/mirror/system_root
for file in /sbin/.magisk/mirror/system_root/sbin/*; do
if [ -L $file ]; then
cp -a $file /sbin/
else
cp -ps $file /sbin/${file##*/}
fi
done
fi
export PATH=/sbin:$PATH
# Finish startup calls
magisk --post-fs-data
sleep 1 # hack to prevent race with later service calls
magisk --service
magisk --boot-complete
fi
setenforce 1 '
cd $HOMEDIR || exit 1
ln -fs magiskinit magiskpolicy ln -fs magiskinit magisk
ctx=$(cat /proc/$$/attr/current) newctx=${ctx/%:s0:*/:s0}
export HOMEDIR echo "$SU_MINISCRIPT" | ./mtk-su -v -Z $newctx