Add busybox to uninstaller and bug fixes
This commit is contained in:
parent
3e2e171407
commit
c6e9270590
@ -175,7 +175,8 @@ repack_boot() {
|
|||||||
cd $UNPACKDIR
|
cd $UNPACKDIR
|
||||||
LD_LIBRARY_PATH=$SYSTEMLIB $BINDIR/bootimgtools --repack $BOOTIMAGE
|
LD_LIBRARY_PATH=$SYSTEMLIB $BINDIR/bootimgtools --repack $BOOTIMAGE
|
||||||
if [ -f chromeos ]; then
|
if [ -f chromeos ]; then
|
||||||
cp -af $CHROMEDIR /data/magisk
|
# Copy required tools
|
||||||
|
cp -af $CHROMEDIR/. $CPPATH/chromeos
|
||||||
echo " " > config
|
echo " " > config
|
||||||
echo " " > bootloader
|
echo " " > bootloader
|
||||||
LD_LIBRARY_PATH=$SYSTEMLIB $CHROMEDIR/futility vbutil_kernel --pack new-boot.img.signed --keyblock $CHROMEDIR/kernel.keyblock --signprivate $CHROMEDIR/kernel_data_key.vbprivk --version 1 --vmlinuz new-boot.img --config config --arch arm --bootloader bootloader --flags 0x1
|
LD_LIBRARY_PATH=$SYSTEMLIB $CHROMEDIR/futility vbutil_kernel --pack new-boot.img.signed --keyblock $CHROMEDIR/kernel.keyblock --signprivate $CHROMEDIR/kernel_data_key.vbprivk --version 1 --vmlinuz new-boot.img --config config --arch arm --bootloader bootloader --flags 0x1
|
||||||
@ -329,25 +330,23 @@ fi
|
|||||||
|
|
||||||
ui_print "- Constructing environment"
|
ui_print "- Constructing environment"
|
||||||
|
|
||||||
|
CPPATH
|
||||||
|
|
||||||
if (is_mounted /data); then
|
if (is_mounted /data); then
|
||||||
rm -rf /data/magisk 2>/dev/null
|
CPPATH=/data/magisk
|
||||||
mkdir -p /data/magisk
|
|
||||||
cp -af $BINDIR/busybox $BINDIR/sepolicy-inject $BINDIR/resetprop $BINDIR/bootimgtools \
|
|
||||||
$INSTALLER/common/init.magisk.rc $INSTALLER/common/magic_mask.sh /data/magisk
|
|
||||||
cp -af $INSTALLER/common/magisk.apk /data/magisk.apk
|
|
||||||
chmod -R 755 /data/magisk
|
|
||||||
chcon -h u:object_r:system_file:s0 /data/magisk /data/magisk/*
|
|
||||||
PATH=/data/busybox:$PATH
|
|
||||||
else
|
else
|
||||||
rm -rf /cache/data_bin 2>/dev/null
|
CPPATH=/cache/data_bin
|
||||||
mkdir -p /cache/data_bin
|
|
||||||
cp -af $BINDIR/busybox $BINDIR/sepolicy-inject $BINDIR/resetprop $BINDIR/bootimgtools \
|
|
||||||
$INSTALLER/common/custom_ramdisk_patch.sh $INSTALLER/common/init.magisk.rc \
|
|
||||||
$INSTALLER/common/magic_mask.sh /cache/data_bin
|
|
||||||
cp -af $INSTALLER/common/magisk.apk /cache/magisk.apk
|
|
||||||
chmod -R 755 /cache/data_bin
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Copy required files
|
||||||
|
rm -rf $CPPATH 2>/dev/null
|
||||||
|
mkdir -p $CPPATH
|
||||||
|
cp -af $BINDIR/busybox $BINDIR/sepolicy-inject $BINDIR/resetprop $BINDIR/bootimgtools \
|
||||||
|
$INSTALLER/common/custom_ramdisk_patch.sh $INSTALLER/common/init.magisk.rc \
|
||||||
|
$INSTALLER/common/magic_mask.sh $CPPATH
|
||||||
|
chmod -R 755 $CPPATH
|
||||||
|
chcon -h u:object_r:system_file:s0 $CPPATH $CPPATH/*
|
||||||
|
|
||||||
# Temporary busybox for installation
|
# Temporary busybox for installation
|
||||||
mkdir -p $TMPDIR/busybox
|
mkdir -p $TMPDIR/busybox
|
||||||
$BINDIR/busybox --install -s $TMPDIR/busybox
|
$BINDIR/busybox --install -s $TMPDIR/busybox
|
||||||
@ -402,7 +401,7 @@ ui_print "- Unpacking boot image"
|
|||||||
unpack_boot $BOOTIMAGE
|
unpack_boot $BOOTIMAGE
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
ui_print "! Unable to unpack boot image"
|
ui_print "! Unable to unpack boot image"
|
||||||
exit 1;
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ORIGBOOT=
|
ORIGBOOT=
|
||||||
|
@ -49,8 +49,10 @@ unpack_boot() {
|
|||||||
cd $UNPACKDIR
|
cd $UNPACKDIR
|
||||||
LD_LIBRARY_PATH=$SYSTEMLIB $BINDIR/bootimgtools --extract $1
|
LD_LIBRARY_PATH=$SYSTEMLIB $BINDIR/bootimgtools --extract $1
|
||||||
|
|
||||||
|
[ ! -f $UNPACKDIR/ramdisk.gz ] && return 1
|
||||||
|
|
||||||
cd $RAMDISK
|
cd $RAMDISK
|
||||||
$BINDIR/busybox gunzip -c < $UNPACKDIR/ramdisk.gz | cpio -i
|
gunzip -c < $UNPACKDIR/ramdisk.gz | cpio -i
|
||||||
}
|
}
|
||||||
|
|
||||||
repack_boot() {
|
repack_boot() {
|
||||||
@ -79,8 +81,14 @@ repack_boot() {
|
|||||||
mv new-boot.img $NEWBOOT
|
mv new-boot.img $NEWBOOT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Environments
|
||||||
# Set permissions
|
# Set permissions
|
||||||
chmod -R 755 $CHROMEDIR/futility $BINDIR
|
chmod -R 755 $CHROMEDIR/futility $BINDIR 2>/dev/null
|
||||||
|
# Temporary busybox for installation
|
||||||
|
mkdir -p $TMPDIR/busybox
|
||||||
|
$BINDIR/busybox --install -s $TMPDIR/busybox
|
||||||
|
rm -f $TMPDIR/busybox/su $TMPDIR/busybox/sh $TMPDIR/busybox/reboot
|
||||||
|
PATH=$TMPDIR/busybox:$PATH
|
||||||
|
|
||||||
# Find the boot image
|
# Find the boot image
|
||||||
find_boot_image
|
find_boot_image
|
||||||
@ -121,13 +129,22 @@ fi
|
|||||||
|
|
||||||
# First unpack the boot image
|
# First unpack the boot image
|
||||||
unpack_boot $BOOTIMAGE
|
unpack_boot $BOOTIMAGE
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
ui_print "! Unable to unpack boot image"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Detect boot image state
|
||||||
SUPERSU=false
|
SUPERSU=false
|
||||||
[ -f sbin/launch_daemonsu.sh ] && SUPERSU=true
|
[ -f sbin/launch_daemonsu.sh ] && SUPERSU=true
|
||||||
|
if [ ! -f init.magisk.rc ]; then
|
||||||
|
ui_print "! Magisk is not installed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if ($SUPERSU); then
|
if ($SUPERSU); then
|
||||||
ui_print "- SuperSU patched image detected"
|
ui_print "- SuperSU patched image detected"
|
||||||
rm -f magisk sbin/init.magisk.rc sbin/magic_mask.sh
|
rm -rf magisk init.magisk.rc sbin/magic_mask.sh
|
||||||
repack_boot
|
repack_boot
|
||||||
else
|
else
|
||||||
if [ -f /data/stock_boot.img ]; then
|
if [ -f /data/stock_boot.img ]; then
|
||||||
@ -139,7 +156,7 @@ else
|
|||||||
ui_print "- Restoring ramdisk with backup"
|
ui_print "- Restoring ramdisk with backup"
|
||||||
cp -af .backup/. .
|
cp -af .backup/. .
|
||||||
fi
|
fi
|
||||||
rm -f magisk sbin/init.magisk.rc sbin/magic_mask.sh
|
rm -rf magisk init.magisk.rc sbin/magic_mask.sh .backup
|
||||||
repack_boot
|
repack_boot
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -123,7 +123,7 @@ BINDIR=$INSTALLER/$ARCH
|
|||||||
|
|
||||||
# Copy the binaries to /data/magisk
|
# Copy the binaries to /data/magisk
|
||||||
mkdir -p /data/magisk 2>/dev/null
|
mkdir -p /data/magisk 2>/dev/null
|
||||||
cp -af $BINDIR/bootimgtools $CHROMEDIR /data/magisk
|
cp -af $BINDIR/* $CHROMEDIR /data/magisk
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# Detection all done, start installing
|
# Detection all done, start installing
|
||||||
@ -134,18 +134,21 @@ ui_print "- Found Boot Image: $BOOTIMAGE"
|
|||||||
if (is_mounted /data); then
|
if (is_mounted /data); then
|
||||||
ui_print "- Running uninstaller scripts"
|
ui_print "- Running uninstaller scripts"
|
||||||
sh $INSTALLER/common/magisk_uninstaller.sh
|
sh $INSTALLER/common/magisk_uninstaller.sh
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
ui_print "! Magisk is not installed or an error occurred"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
ui_print "! Data unavailable"
|
ui_print "! Data unavailable"
|
||||||
ui_print "! Placing uninstall script to /cache"
|
ui_print "! Placing uninstall script to /cache"
|
||||||
ui_print "! The device will reboot multiple times"
|
ui_print "! The device might reboot multiple times"
|
||||||
cp -af $INSTALLER/common/magisk_uninstaller.sh /cache/magisk_uninstaller.sh
|
cp -af $INSTALLER/common/magisk_uninstaller.sh /cache/magisk_uninstaller.sh
|
||||||
umount /system
|
umount /system
|
||||||
|
ui_print "- Rebooting....."
|
||||||
sleep 5
|
sleep 5
|
||||||
reboot
|
reboot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 644 $NEWBOOT
|
|
||||||
|
|
||||||
umount /system
|
umount /system
|
||||||
ui_print "- Done"
|
ui_print "- Done"
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user