diff --git a/SuperSU-v2.46.zip b/SuperSU-v2.46.zip deleted file mode 100644 index d276d83..0000000 Binary files a/SuperSU-v2.46.zip and /dev/null differ diff --git a/SuperSU-v2.82-SR5-20171001.zip b/SuperSU-v2.82-SR5-20171001.zip new file mode 100644 index 0000000..eda81ca Binary files /dev/null and b/SuperSU-v2.82-SR5-20171001.zip differ diff --git a/files.sh b/files.sh new file mode 100644 index 0000000..988e8c4 --- /dev/null +++ b/files.sh @@ -0,0 +1,210 @@ +#!/system/bin/sh + +delete() { + rm -rf $1 +} + +chattr_() { + chattr -ia $1 1>/dev/null 2>/dev/null +} + +# KingRoot +kingroot_data() { + delete /data/app/*kinguser* + delete /data/data/com.kingroot.kinguser + delete /data/dalvik-cache/*kinguser* + delete /data/dalvik-cache/*/*kinguser* + delete /data/app-lib/*kinguser* + delete /data/app-lib/*uranus* + delete /data/data-lib + delete /data/local/tmp/*uranus* + delete /data/system/*uranus* + delete /data/media/obb/*kinguser* + + LD_LIBRARY_PATH=/system/lib:/vendor/lib am kill com.kingroot.kinguser 1>/dev/null 2>/dev/null + LD_LIBRARY_PATH=/system/lib:/vendor/lib pm uninstall com.kingroot.kinguser 1>/dev/null 2>/dev/null +} + +kingroot_storage() { + delete /storage/*/Android/*/*kinguser* + delete /storage/emulated/obb/*kinguser* + delete /sdcard/*kinguser* +} + +kingroot_dev() { + if [ -d /dev/kinguser.req.cache ]; then + if [ ! -z "$(ls /dev/kinguser.req.cache)" ]; then + for i in /dev/kinguser.req.cache/*; do + chattr_ $i + done + fi + delete /dev/kinguser.req.cache + fi + delete /dev/ktools +} + +kingroot_system() { + kingfiles=" + /system/bin/.usr/.ku + /system/bin/.usr + /system/bin/rt.sh + /system/bin/su + /system/usr/iku/isu + /system/usr/iku + /system/xbin/ku.sud + /system/xbin/ku.sud.tmp + /system/xbin/su + /system/xbin/supolicy + " + for file in $kingfiles; do + if [ -d $file ]; then + rmdir $file 2>/dev/null + else + chattr_ $file + delete $file + fi + done +} + + +# Kingoroot +kingoroot_data() { + delete /data/app/*kingo* + delete /data/data/*kingo* + delete /data/dalvik-cache/*kingo* + delete /data/dalvik-cache/*Kingo* + delete /data/dalvik-cache/*/*kingo* + delete /data/dalvik-cache/*/*Kingo* + delete /data/app-lib/*kingo* + delete /data/media/obb/*kingo* + + LD_LIBRARY_PATH=/system/lib:/vendor/lib pm uninstall com.kingoapp.apk 1>/dev/null 2>/dev/null +} + +kingoroot_storage() { + delete /storage/*/Android/*/*kingo* + delete /storage/emulated/obb/*kingo* + delete /sdcard/*kingo* +} + +kingoroot_system() { + kingofiles=" + /system/app/KingoUser.apk + /system/app/KingoUser + /system/bin/.ext/.su + /system/bin/.ext + /system/bin/su + /system/etc/init.d/99SuperSUDaemon + /system/etc/.has_su_daemon + /system/lib/libsupol.so + /system/sbin/su + /system/sbin + /system/xbin/daemonsu + /system/xbin/su + /system/xbin/supolicy + " + for file in $kingofiles; do + if [ -d $file ]; then + rmdir $file 2>/dev/null + else + chattr_ $file + delete $file + fi + done +} + +remove_install-recovery() { + if [ -f /system/etc/install-recovery.sh-ku.bak ]; then + chattr_ /system/etc/install-recovery.sh + chattr_ /system/etc/install-recovery.sh-ku.bak + mv /system/etc/install-recovery.sh-ku.bak /system/etc/install-recovery.sh + elif [ -f /system/etc/install-recovery.sh ] && grep -q su /system/etc/install-recovery.sh; then + chattr_ /system/etc/install-recovery.sh + delete /system/etc/install-recovery.sh + chattr_ /system/bin/install-recovery.sh + delete /system/bin/install-recovery.sh + fi +} + +remove_ddexe() { + if [ -f /system/bin/ddexe_real ]; then + chattr_ /system/bin/ddexe_real + chattr_ /system/bin/ddexe-ku.bak + chattr_ /system/bin/ddexe + mv /system/bin/ddexe_real /system/bin/ddexe + if [ -f /system/bin/ddexe-ku.bak ]; then + mv /system/bin/ddexe-ku.bak /system/bin/ddexe + fi + chattr_ /system/bin/ddexe_real + chattr_ /system/bin/ddexe-ku.bak + chattr_ /system/bin/ddexe + delete /system/bin/ddexe_real /system/bin/ddexe-ku.bak + fi +} + +supersu_code() { + if [ -f "/system/etc/install-recovery_original.sh" ]; then + rm -f /system/etc/install-recovery.sh + mv /system/etc/install-recovery_original.sh /system/etc/install-recovery.sh + fi + if [ -f "/system/bin/install-recovery_original.sh" ]; then + rm -f /system/bin/install-recovery.sh + mv /system/bin/install-recovery_original.sh /system/bin/install-recovery.sh + fi + if [ -f "/system/bin/app_process64_original" ]; then + rm -f /system/bin/app_process64 + if [ -f "/system/bin/app_process64_xposed" ]; then + ln -s /system/bin/app_process64_xposed /system/bin/app_process64 + else + mv /system/bin/app_process64_original /system/bin/app_process64 + fi + fi + if [ -f "/system/bin/app_process32_original" ]; then + rm -f /system/bin/app_process32 + if [ -f "/system/bin/app_process32_xposed" ]; then + ln -s /system/bin/app_process32_xposed /system/bin/app_process32 + else + mv /system/bin/app_process32_original /system/bin/app_process32 + fi + fi + if [ -f "/system/bin/app_process64" ]; then + rm /system/bin/app_process + ln -s /system/bin/app_process64 /system/bin/app_process + elif [ -f "/system/bin/app_process32" ]; then + rm /system/bin/app_process + ln -s /system/bin/app_process32 /system/bin/app_process + fi + rm -f /system/bin/app_process_init +} + +remove_king() { + # KingRoot + kingroot_data + kingroot_storage + kingroot_dev + kingroot_system + + # KingoRoot + kingoroot_data + kingoroot_storage + kingoroot_system + + # Special files + remove_install-recovery + supersu_code +} + +abort() { + echo "$1" + exit 1 +} + +BL='\e[01;90m' > /dev/null 2>&1; # Black +R='\e[01;91m' > /dev/null 2>&1; # Red +G='\e[01;92m' > /dev/null 2>&1; # Green +Y='\e[01;93m' > /dev/null 2>&1; # Yellow +B='\e[01;94m' > /dev/null 2>&1; # Blue +P='\e[01;95m' > /dev/null 2>&1; # Purple +C='\e[01;96m' > /dev/null 2>&1; # Cyan +W='\e[01;97m' > /dev/null 2>&1; # White +N='\e[0m' > /dev/null 2>&1; # Null diff --git a/postuninstall.sh b/postuninstall.sh index bb1bcda..e4c8219 100644 --- a/postuninstall.sh +++ b/postuninstall.sh @@ -1,39 +1,20 @@ #!/system/bin/sh -rm -rf /data/app/*kinguser* -rm -rf /data/data/*kinguser* -rm -rf /data/dalvik-cache/*kinguser* -rm -rf /data/dalvik-cache/*/*kinguser* -rm -rf /data/app-lib/*kinguser* -rm -rf /data/app-lib/uranus/*kinguser* -rm -rf /data/data-lib/*kinguser* -rm -rf /data/data-lib/uranus/*kinguser* -rm -rf /data/local/tmp/*uranus* -rm -rf /data/system/*uranus* +# Source files.sh +. /sdcard/mrw/files.sh -rm -rf /storage/*/Android/data/*kinguser* -rm -rf /storage/*/Android/obb/*kinguser* -rm -rf /storage/*/Android/media/*kinguser* -rm -rf /storage/emulated/obb/*kinguser* -rm -rf /data/media/obb/*kinguser* -rm -rf /sdcard/*kinguser* +mount -o remount,rw /system +echo; echo -e $C"Cleaning..."$N -# Kingoroot -rm -rf /system/app/*Kingo* -rm -rf /data/app/*kingo* -rm -rf /data/data/*kingo* -rm -rf /data/dalvik-cache/*kingo* -rm -rf /data/dalvik-cache/*/*kingo* -rm -rf /data/app-lib/*kingo* -rm -rf /data/data-lib/*kingo* -rm -rf /data/data-lib/uranus/*kingo* -rm -rf /storage/*/Android/data/*kingo* -rm -rf /storage/*/Android/obb/*kingo* -rm -rf /storage/*/Android/media/*kingo* -rm -rf /storage/emulated/obb/*kingo* -rm -rf /data/media/obb/*kingo* -rm -rf /sdcard/*kingo* +kingroot_data +kingroot_dev +kingroot_storage -LD_LIBRARY_PATH=/vendor/lib:/system/lib am kill com.kingroot.kinguser -LD_LIBRARY_PATH=/vendor/lib:/system/lib pm uninstall com.kingroot.kinguser +kingoroot_data +kingoroot_storage + +remove_ddexe + +echo; echo -e $G"Finished Cleaning..."$N +echo diff --git a/root.sh b/root.sh index a8831c6..589731d 100644 --- a/root.sh +++ b/root.sh @@ -8,186 +8,33 @@ if [ "$id" != "0" ] && [ "$id" != "root" ]; then sleep 2 clear exit 1 -fi +elif ! [ -e /system/xbin/busybox ]; then + clear + echo "" + echo "Install BusyBox and then execute" + sleep 2 + clear + exit 1 +fi exec 2>/sdcard/mrw/root.log -echo "---------------------------------------" -echo "---------- Made By : Mr.W0lf ----------" -echo "---- Thanks @Chainfire for SuperSU ----" -echo "---------------------------------------" - mount -o remount,rw /system -if [ ! -f /system/xbin/busybox -o ! -e /system/bin/busybox ]; then - if [ -f /sdcard/mrw/busybox ]; then - cp /sdcard/mrw/busybox /system/xbin/busybox - /system/xbin/busybox --install -s /system/xbin - fi -fi - -rm -rf /data/app/*kinguser* -rm -rf /data/data/*kinguser* -rm -rf /data/dalvik-cache/*kinguser* -rm -rf /data/dalvik-cache/*/*kinguser* -rm -rf /data/app-lib/*kinguser* -rm -rf /data/app-lib/uranus/*kinguser* -rm -rf /data/data-lib/*kinguser* -rm -rf /data/data-lib/uranus/*kinguser* -rm -rf /data/local/tmp/*uranus* -rm -rf /data/system/*uranus* -rm -rf /storage/*/Android/data/*kinguser* -rm -rf /storage/*/Android/obb/*kinguser* -rm -rf /storage/*/Android/media/*kinguser* -rm -rf /storage/emulated/obb/*kinguser* -rm -rf /data/media/obb/*kinguser* -rm -rf /sdcard/*kinguser* -for i in /dev/kinguser.req.cache/*; do - chattr -ia $i -done -rm -rf /dev/kinguser.req.cache -rm -f /dev/ktools - -# Kingoroot -rm -rf /system/app/*Kingo* -rm -rf /data/app/*kingo* -rm -rf /data/data/*kingo* -rm -rf /data/dalvik-cache/*kingo* -rm -rf /data/dalvik-cache/*/*kingo* -rm -rf /data/app-lib/*kingo* -rm -rf /data/data-lib/*kingo* -rm -rf /data/data-lib/uranus/*kingo* -rm -rf /storage/*/Android/data/*kingo* -rm -rf /storage/*/Android/obb/*kingo* -rm -rf /storage/*/Android/media/*kingo* -rm -rf /storage/emulated/obb/*kingo* -rm -rf /data/media/obb/*kingo* -rm -rf /sdcard/*kingo* - -LD_LIBRARY_PATH=/vendor/lib:/system/lib am kill com.kingroot.kinguser -LD_LIBRARY_PATH=/vendor/lib:/system/lib pm uninstall com.kingroot.kinguser - -if [ -f /system/etc/install-recovery.sh-ku.bak ]; then - chattr -ia /system/etc/install-recovery.sh - chattr -ia /system/etc/install-recovery.sh-ku.bak - mv /system/etc/install-recovery.sh-ku.bak /system/etc/install-recovery.sh -elif [ -f /system/etc/install-recovery.sh ] && grep -q su /system/etc/install-recovery.sh -then - chattr -ia /system/etc/install-recovery.sh - rm -f /system/etc/install-recovery.sh - chattr -ia /system/bin/install-recovery.sh - rm -f /system/bin/install-recovery.sh -fi -if [ -f /system/bin/ddexe_real -o -f /system/bin/ddexe-ku.bak ]; then - chattr -ia /system/bin/ddexe_real - chattr -ia /system/bin/ddexe-ku.bak - chattr -ia /system/bin/ddexe - mv /system/bin/ddexe_real /system/bin/ddexe || mv /system/bin/ddexe-ku.bak /system/bin/ddexe - chattr -ia /system/bin/ddexe_real - rm -f /system/bin/ddexe_real /system/bin/ddexe-ku.bak -fi -if [ -f /system/bin/rt.sh ]; then - rm -f /system/bin/rt.sh -fi -if [ -d /system/bin/.usr -a -f /system/bin/.usr/.ku ]; then - chattr -ia /system/bin/.usr/.ku - rm -rf /system/bin/.usr -fi -if [ -d /system/usr/iku -a -f /system/usr/iku/isu ]; then - chattr -ia /system/usr/iku/isu - rm -rf /system/usr/iku -fi -for i in ku.sud ku.sud.tmp su supolicy daemonsu; do - if [ -e /system/xbin/$i ]; then - chattr -ia /system/xbin/$i - rm -f /system/xbin/$i - fi - if [ -e /system/bin/$i ]; then - chattr -ia /system/bin/$i - rm -f /system/bin/$i - fi -done +# Source files.sh +. /sdcard/mrw/files.sh -for i in /dev/kinguser.req.cache/*; do - chattr -ia $i -done -rm -rf /dev/kinguser.req.cache /dev/ktools +echo -e $C"---------------------------------------"$N +echo -e $C"---------- ${G}Made By : Mr.W0lf${N}${C} ----------"$N +echo -e $C"---- ${G}Thanks @Chainfire for SuperSU${N}${C} ----"$N +echo -e $C"---------------------------------------"$N -# Kingo -if [ -f /system/sbin/su ]; then - chattr -ia /system/sbin/su - rm -f /system/sbin/su -fi -if [ -d /system/bin/.ext -a -f /system/bin/.ext/.su ]; then - chattr -ia /system/bin/.ext/.su - rm -f /system/bin/.ext/.su - rmdir /system/bin/.ext -fi -if [ -f /system/etc/init.d/99SuperSUDaemon ]; then - chattr -ia /system/etc/init.d/99SuperSUDaemon - rm -f /system/etc/init.d/99SuperSUDaemon -fi -if [ -f /system/lib/libsupol.so ]; then - chattr -ia /system/lib/libsupol.so - rm -f /system/lib/libsupol.so -fi -if [ -f /system/etc/.has_su_daemon ]; then - chattr -ia /system/etc/.has_su_daemon - rm -f /system/etc/.has_su_daemon -fi -if [ -f /system/etc/.installed_su_daemon ]; then - chattr -ia /system/etc/.installed_su_daemon - rm -f /system/etc/.installed_su_daemon -fi -if [ -f /system/etc/install_recovery.sh ]; then - chattr -ia /system/etc/install_recovery.sh - rm -f /system/etc/install_recovery.sh -fi +remove_king # Second time cleaning to destroy all -while [ -L /system/bin/su ]; do - echo "Cleaning ..." - rm -rf /data/app/*kinguser* - rm -rf /data/data/*kinguser* - rm -rf /data/dalvik-cache/*kinguser* - rm -rf /data/dalvik-cache/*/*kinguser* - rm -rf /data/app-lib/*kinguser* - rm -rf /data/app-lib/uranus/*kinguser* - rm -rf /data/local/tmp/*uranus* - rm -rf /data/system/*uranus* - rm -rf /storage/*/Android/data/*kinguser* - rm -rf /storage/*/Android/obb/*kinguser* - rm -rf /storage/*/Android/media/*kinguser* - rm -rf /storage/emulated/obb/*kinguser* - rm -rf /data/media/obb/*kinguser* - rm -rf /sdcard/*kinguser* - for i in /dev/kinguser.req.cache/*; do - chattr -ia $i - done - rm -rf /dev/kinguser.req.cache - rm -f /dev/ktools - LD_LIBRARY_PATH=/vendor/lib:/system/lib am kill com.kingroot.kinguser - LD_LIBRARY_PATH=/vendor/lib:/system/lib pm uninstall com.kingroot.kinguser - rm -f /system/bin/su /system/xbin/su /system/xbin/supolicy - if [ -f /system/bin/ddexe_real -o -f /system/bin/ddexe-ku.bak ]; then - chattr -ia /system/bin/ddexe_real - chattr -ia /system/bin/ddexe-ku.bak - chattr -ia /system/bin/ddexe - mv /system/bin/ddexe_real /system/bin/ddexe || mv /system/bin/ddexe-ku.bak /system/bin/ddexe - chattr -ia /system/bin/ddexe_real - chattr -ia /system/bin/ddexe-ku.bak - rm -f /system/bin/ddexe_real /system/bin/ddexe-ku.bak - fi - if [ -f /system/etc/install-recovery.sh ] && grep -q ku.sud /system/etc/install-recovery.sh - then - chattr -ia /system/etc/install-recovery.sh - rm -f /system/etc/install-recovery.sh - chattr -ia /system/bin/install-recovery.sh - rm -f /system/bin/install-recovery.sh - fi - LD_LIBRARY_PATH=/vendor/lib:/system/lib am kill com.kingroot.kinguser - LD_LIBRARY_PATH=/vendor/lib:/system/lib pm uninstall com.kingroot.kinguser -done +echo; echo -e $B"Cleaning ..."$N +remove_king +sleep 1 -echo "Finished Cleaning King(o)Root" -echo "Execute suinstall.sh to install supersu" +echo; echo -e $G"Finished Cleaning King(o)Root"$N +echo; echo -e $G"Execute suinstall.sh to install supersu"$N; echo diff --git a/suinstall.sh b/suinstall.sh index 393efc5..b235733 100644 --- a/suinstall.sh +++ b/suinstall.sh @@ -2,152 +2,30 @@ exec 2>/sdcard/mrw/suinstall.log -echo "Cleaning..." -rm -rf /data/app/*kinguser* -rm -rf /data/data/*kinguser* -rm -rf /data/dalvik-cache/*kinguser* -rm -rf /data/dalvik-cache/*/*kinguser* -rm -rf /data/app-lib/*kinguser* -rm -rf /data/app-lib/uranus/*kinguser* -rm -rf /data/data-lib/*kinguser* -rm -rf /data/data-lib/uranus/*kinguser* -rm -rf /data/local/tmp/*uranus* -rm -rf /data/system/*uranus* -rm -rf /storage/*/Android/data/*kinguser* -rm -rf /storage/*/Android/obb/*kinguser* -rm -rf /storage/*/Android/media/*kinguser* -rm -rf /storage/emulated/obb/*kinguser* -rm -rf /data/media/obb/*kinguser* -rm -rf /sdcard/*kinguser* -for i in /dev/kinguser.req.cache/*; do - chattr -ia $i -done -rm -rf /dev/kinguser.req.cache -rm -f /dev/ktools -LD_LIBRARY_PATH=/vendor/lib:/system/lib am kill com.kingroot.kinguser -LD_LIBRARY_PATH=/vendor/lib:/system/lib pm uninstall com.kingroot.kinguser -rm -f /system/bin/su /system/xbin/su /system/xbin/supolicy -if [ -f /system/bin/ddexe_real -o -f /system/bin/ddexe-ku.bak ]; then - chattr -ia /system/bin/ddexe_real - chattr -ia /system/bin/ddexe-ku.bak - chattr -ia /system/bin/ddexe - mv /system/bin/ddexe_real /system/bin/ddexe || mv /system/bin/ddexe-ku.bak /system/bin/ddexe - chattr -ia /system/bin/ddexe_real - chattr -ia /system/bin/ddexe-ku.bak - rm -f /system/bin/ddexe_real /system/bin/ddexe-ku.bak -fi -if [ -f /system/etc/install-recovery.sh ] && grep -q ku.sud /system/etc/install-recovery.sh -then - chattr -ia /system/etc/install-recovery.sh - rm -f /system/etc/install-recovery.sh - chattr -ia /system/bin/install-recovery.sh - rm -f /system/bin/install-recovery.sh -fi +# Source files.sh +. /sdcard/mrw/files.sh -while true; do - echo "Cleaning..." - rm -rf /data/app/*kinguser* - rm -rf /data/data/*kinguser* - rm -rf /data/dalvik-cache/*kinguser* - rm -rf /data/dalvik-cache/*/*kinguser* - rm -rf /data/app-lib/*kinguser* - rm -rf /data/app-lib/uranus/*kinguser* - rm -rf /data/data-lib/*kinguser* - rm -rf /data/data-lib/uranus/*kinguser* - rm -rf /data/local/tmp/*uranus* - rm -rf /data/system/*uranus* - rm -rf /storage/*/Android/data/*kinguser* - rm -rf /storage/*/Android/obb/*kinguser* - rm -rf /storage/*/Android/media/*kinguser* - rm -rf /storage/emulated/obb/*kinguser* - rm -rf /data/media/obb/*kinguser* - rm -rf /sdcard/*kinguser* - for i in /dev/kinguser.req.cache/*; do - chattr -ia $i - done - rm -rf /dev/kinguser.req.cache - rm -f /dev/ktools - LD_LIBRARY_PATH=/vendor/lib:/system/lib am kill com.kingroot.kinguser - LD_LIBRARY_PATH=/vendor/lib:/system/lib pm uninstall com.kingroot.kinguser - rm -f /system/bin/su /system/xbin/su /system/xbin/supolicy - if [ -f /system/bin/ddexe_real -o -f /system/bin/ddexe-ku.bak ]; then - chattr -ia /system/bin/ddexe_real - chattr -ia /system/bin/ddexe-ku.bak - chattr -ia /system/bin/ddexe - mv /system/bin/ddexe_real /system/bin/ddexe || mv /system/bin/ddexe-ku.bak /system/bin/ddexe - chattr -ia /system/bin/ddexe_real - chattr -ia /system/bin/ddexe-ku.bak - rm -f /system/bin/ddexe_real /system/bin/ddexe-ku.bak - fi - if [ -f /system/etc/install-recovery.sh ] && grep -q ku.sud /system/etc/install-recovery.sh - then - chattr -ia /system/etc/install-recovery.sh - rm -f /system/etc/install-recovery.sh - chattr -ia /system/bin/install-recovery.sh - rm -f /system/bin/install-recovery.sh - fi - LD_LIBRARY_PATH=/vendor/lib:/system/lib am kill com.kingroot.kinguser - LD_LIBRARY_PATH=/vendor/lib:/system/lib pm uninstall com.kingroot.kinguser - sleep 1 - if [ ! -L /system/bin/su ]; then - break - fi -done +echo; echo -e $B"Cleaning..."$N +remove_king -echo "Cleaning..." -rm -rf /data/app/*kinguser* -rm -rf /data/data/*kinguser* -rm -rf /data/dalvik-cache/*kinguser* -rm -rf /data/dalvik-cache/*/*kinguser* -rm -rf /data/app-lib/*kinguser* -rm -rf /data/app-lib/uranus/*kinguser* -rm -rf /data/data-lib/*kinguser* -rm -rf /data/data-lib/uranus/*kinguser* -rm -rf /data/local/tmp/*uranus* -rm -rf /data/system/*uranus* -rm -rf /storage/*/Android/data/*kinguser* -rm -rf /storage/*/Android/obb/*kinguser* -rm -rf /storage/*/Android/media/*kinguser* -rm -rf /storage/emulated/obb/*kinguser* -rm -rf /data/media/obb/*kinguser* -rm -rf /sdcard/*kinguser* -for i in /dev/kinguser.req.cache/*; do - chattr -ia $i -done -rm -rf /dev/kinguser.req.cache -rm -f /dev/ktools -LD_LIBRARY_PATH=/vendor/lib:/system/lib am kill com.kingroot.kinguser -LD_LIBRARY_PATH=/vendor/lib:/system/lib pm uninstall com.kingroot.kinguser -rm -f /system/bin/su /system/xbin/su /system/xbin/supolicy -if [ -f /system/bin/ddexe_real -o -f /system/bin/ddexe-ku.bak ]; then - chattr -ia /system/bin/ddexe_real - chattr -ia /system/bin/ddexe-ku.bak - chattr -ia /system/bin/ddexe - mv /system/bin/ddexe_real /system/bin/ddexe || mv /system/bin/ddexe-ku.bak /system/bin/ddexe - chattr -ia /system/bin/ddexe_real - chattr -ia /system/bin/ddexe-ku.bak - rm -f /system/bin/ddexe_real /system/bin/ddexe-ku.bak -fi -if [ -f /system/etc/install-recovery.sh ] && grep -q ku.sud /system/etc/install-recovery.sh -then - chattr -ia /system/etc/install-recovery.sh - rm -f /system/etc/install-recovery.sh - chattr -ia /system/bin/install-recovery.sh - rm -f /system/bin/install-recovery.sh -fi -LD_LIBRARY_PATH=/vendor/lib:/system/lib am kill com.kingroot.kinguser -LD_LIBRARY_PATH=/vendor/lib:/system/lib pm uninstall com.kingroot.kinguser +echo; echo -e $B"Cleaning..."$N +remove_king + +echo; echo -e $B"Cleaning..."$N +remove_king # SuperSU installation mount -o remount,rw / -mkdir /tmp || exit 1 -sh /sdcard/mrw/update-binary "dummy" "1" "/sdcard/mrw/SuperSU-v2.46.zip" 2>/sdcard/mrw/supersu.log -if [ -f /system/xbin/su -o -f /system/lib/libsupol.so ]; then - echo "* the device will reboot after a few seconds *" - echo "**********************************************" +mkdir /dev/tmp || abort "Unable to create /dev/tmp, aborting" + + +sh /sdcard/mrw/update-binary "dummy" "1" "/sdcard/mrw/SuperSU-v2.82-SR5-20171001.zip" 2>/sdcard/mrw/supersu.log + +if [ -f /system/xbin/su -a -f /system/lib/libsupol.so ]; then + echo; echo -e $G"* ${C}the device will reboot after a few seconds${N}${G} *"$N + echo; echo -e $G"**********************************************"$N (sleep 8; /system/bin/reboot)& fi -echo "Finished" - +echo; echo "Finished"; echo diff --git a/update-binary b/update-binary index c504cd2..32deae4 100644 --- a/update-binary +++ b/update-binary @@ -1,124 +1,62 @@ #!/sbin/sh # -# SuperSU installer ZIP -# Copyright (c) 2012-2014 - Chainfire +# SuperSU installer ZIP +# Copyright (c) 2012-2017 - Chainfire, CCMT # -# To install SuperSU properly, aside from cleaning old versions and -# other superuser-type apps from the system, the following files need to -# be installed: -# -# API source target chmod chcon required -# -# 7-19 common/Superuser.apk /system/app/Superuser.apk 0644 u:object_r:system_file:s0 gui -# 20+ common/Superuser.apk /system/app/SuperSU/SuperSU.apk 0644 u:object_r:system_file:s0 gui -# -# 17+ common/install-recovery.sh /system/etc/install-recovery.sh 0755 *1 required -# 17+ /system/bin/install-recovery.sh (symlink to /system/etc/...) required -# *1: same as /system/bin/toolbox: u:object_r:system_file:s0 if API < 20, u:object_r:toolbox_exec:s0 if API >= 20 -# -# 7+ ARCH/su /system/xbin/su *2 u:object_r:system_file:s0 required -# 7+ /system/bin/.ext/.su *2 u:object_r:system_file:s0 gui -# 17+ /system/xbin/daemonsu 0755 u:object_r:system_file:s0 required -# 17+ /system/xbin/sugote 0755 u:object_r:zygote_exec:s0 required -# *2: 06755 if API < 18, 0755 if API >= 18 -# -# 19+ ARCH/supolicy /system/xbin/supolicy 0755 u:object_r:system_file:s0 required -# 19+ ARCH/libsupol.so /system/lib(64)/libsupol.so 0644 u:object_r:system_file:s0 required -# -# 17+ /system/bin/sh or mksh *3 /system/xbin/sugote-mksh 0755 u:object_r:system_file:s0 required -# *3: which one (or both) are available depends on API -# -# 21+ /system/bin/app_process32 *4 /system/bin/app_process32_original 0755 u:object_r:zygote_exec:s0 required -# 21+ /system/bin/app_process64 *4 /system/bin/app_process64_original 0755 u:object_r:zygote_exec:s0 required -# 21+ /system/bin/app_processXX *4 /system/bin/app_process_init 0755 u:object_r:system_file:s0 required -# 21+ /system/bin/app_process (symlink to /system/xbin/daemonsu) required -# 21+ *4 /system/bin/app_process32 (symlink to /system/xbin/daemonsu) required -# 21+ *4 /system/bin/app_process64 (symlink to /system/xbin/daemonsu) required -# *4: Only do this for the relevant bits. On a 64 bits system, leave the 32 bits files alone, or dynamic linker errors -# will prevent the system from fully working in subtle ways. The bits of the su binary must also match! -# -# 17+ common/99SuperSUDaemon *5 /system/etc/init.d/99SuperSUDaemon 0755 u:object_r:system_file:s0 optional -# *5: only place this file if /system/etc/init.d is present -# -# 17+ 'echo 1 >' or 'touch' *6 /system/etc/.installed_su_daemon 0644 u:object_r:system_file:s0 optional -# *6: the file just needs to exist or some recoveries will nag you. Even with it there, it may still happen. -# -# It may seem some files are installed multiple times needlessly, but -# it only seems that way. Installing files differently or symlinking -# instead of copying (unless specified) will lead to issues eventually. -# -# The following su binary versions are included in the full package. Each -# should be installed only if the system has the same or newer API level -# as listed. The script may fall back to a different binary on older API -# levels. supolicy are all ndk/pie/19+ for 32 bit, ndk/pie/20+ for 64 bit. -# -# binary ARCH/path build type API -# -# arm-v5te arm aosp static 7+ -# x86 x86 aosp static 7+ -# -# arm-v7a armv7 ndk pie 17+ -# mips mips ndk pie 17+ -# -# arm64-v8a arm64 ndk pie 20+ -# mips64 mips64 ndk pie 20+ -# x86_64 x64 ndk pie 20+ -# -# Note that if SELinux is set to enforcing, the daemonsu binary expects -# to be run at startup (usually from install-recovery.sh, 99SuperSUDaemon, -# or app_process) from u:r:init:s0 or u:r:kernel:s0 contexts. Depending -# on the current policies, it can also deal with u:r:init_shell:s0 and -# u:r:toolbox:s0 contexts. Any other context will lead to issues eventually. -# -# After installation, run '/system/xbin/su --install', which may need to -# perform some additional installation steps. Ideally, at one point, -# a lot of this script will be moved there. -# -# The included chattr(.pie) binaries are used to remove ext2's immutable -# flag on some files. This flag is no longer set by SuperSU's OTA -# survival since API level 18, so there is no need for the 64 bit versions. -# Note that chattr does not need to be installed to the system, it's just -# used by this script, and not supported by the busybox used in older -# recoveries. -# -# Non-static binaries are supported to be PIE (Position Independent -# Executable) from API level 16, and required from API level 20 (which will -# refuse to execute non-static non-PIE). -# -# The script performs serveral actions in various ways, sometimes -# multiple times, due to different recoveries and firmwares behaving -# differently, and it thus being required for the correct result. OUTFD=$2 ZIP=$3 -SYSTEMLIB=/system/lib +# Detect whether in boot mode +ps | grep zygote | grep -qv grep && BOOTMODE=true || BOOTMODE=false +$BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -qv grep && BOOTMODE=true ui_print() { - echo -n -e "ui_print $1\n" > /proc/self/fd/$OUTFD - echo -n -e "ui_print\n" > /proc/self/fd/$OUTFD + $BOOTMODE && echo "$1" || echo -e "ui_print $1\nui_print" > /proc/self/fd/$OUTFD; +} + +is_mounted() { + test "$(mount | grep " $1 " | grep "rw,")" + return $? +} + +mount_() { + is_mounted $1 || mount $1 2>/dev/null || mount -o remount,rw $1 2>/dev/null || abort "Aborting..Unable to mount $1" +} + +unmount() { + umount "$1" 2>/dev/null +} + +abort() { + ui_print "$*" + exit 1 } ch_con() { - LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon -h u:object_r:system_file:s0 $1 - LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon -h u:object_r:system_file:s0 $1 - chcon -h u:object_r:system_file:s0 $1 - LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon u:object_r:system_file:s0 $1 - LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon u:object_r:system_file:s0 $1 - chcon u:object_r:system_file:s0 $1 + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toybox chcon -h u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null + LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon -h u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon -h u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null + chcon -h u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toybox chcon u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null + LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null + chcon u:object_r:system_file:s0 $1 1>/dev/null 2>/dev/null } ch_con_ext() { - LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon $2 $1 - LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon $2 $1 - chcon $2 $1 + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toybox chcon $2 $1 1>/dev/null 2>/dev/null + LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon $2 $1 1>/dev/null 2>/dev/null + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon $2 $1 1>/dev/null 2>/dev/null + chcon $2 $1 1>/dev/null 2>/dev/null } ln_con() { - LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox ln -s $1 $2 - LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox ln -s $1 $2 - ln -s $1 $2 - ch_con $2 + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toybox ln -s $1 $2 1>/dev/null 2>/dev/null + LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox ln -s $1 $2 1>/dev/null 2>/dev/null + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox ln -s $1 $2 1>/dev/null 2>/dev/null + ln -s $1 $2 1>/dev/null 2>/dev/null + ch_con $2 1>/dev/null 2>/dev/null } set_perm() { @@ -130,67 +68,199 @@ set_perm() { } cp_perm() { - rm $5 + rm -f $5 if [ -f "$4" ]; then cat $4 > $5 set_perm $1 $2 $3 $5 $6 fi } +chattr_() { + LD_LIBRARY_PATH=$SYSTEMLIBTOOLS $BINTOOLS/chattr$PIE -ia $1 1>/dev/null 2>/dev/null +} + +wipe_system_files_if_present() { + SYSTEMFILES=" + /system/xbin/daemonsu + /system/xbin/sugote + /system/xbin/sugote-mksh + /system/xbin/supolicy + /system/xbin/ku.sud + /system/xbin/.ku + /system/xbin/.su + /system/lib/libsupol.so + /system/lib64/libsupol.so + /system/bin/.ext/.su + /system/etc/init.d/99SuperSUDaemon + /system/etc/.installed_su_daemon + /system/app/Superuser.apk + /system/app/Superuser.odex + /system/app/Superuser + /system/app/SuperUser.apk + /system/app/SuperUser.odex + /system/app/SuperUser + /system/app/superuser.apk + /system/app/superuser.odex + /system/app/superuser + /system/app/Supersu.apk + /system/app/Supersu.odex + /system/app/Supersu + /system/app/SuperSU.apk + /system/app/SuperSU.odex + /system/app/SuperSU + /system/app/supersu.apk + /system/app/supersu.odex + /system/app/supersu + /system/app/VenomSuperUser.apk + /system/app/VenomSuperUser.odex + /system/app/VenomSuperUser + " + + for FILE in $SYSTEMFILES; do + if [ -d "$FILE" ]; then rm -rf $FILE; fi + if [ -f "$FILE" ]; then rm -f $FILE; fi + done + + rm -f /system/xbin/su + + if [ -f "/system/etc/install-recovery_original.sh" ]; then + rm -f /system/etc/install-recovery.sh + mv /system/etc/install-recovery_original.sh /system/etc/install-recovery.sh + fi + if [ -f "/system/bin/install-recovery_original.sh" ]; then + rm -f /system/bin/install-recovery.sh + mv /system/bin/install-recovery_original.sh /system/bin/install-recovery.sh + fi + if [ -f "/system/bin/app_process64_original" ]; then + rm -f /system/bin/app_process64 + if [ -f "/system/bin/app_process64_xposed" ]; then + ln -s /system/bin/app_process64_xposed /system/bin/app_process64 + else + mv /system/bin/app_process64_original /system/bin/app_process64 + fi + fi + if [ -f "/system/bin/app_process32_original" ]; then + rm -f /system/bin/app_process32 + if [ -f "/system/bin/app_process32_xposed" ]; then + ln -s /system/bin/app_process32_xposed /system/bin/app_process32 + else + mv /system/bin/app_process32_original /system/bin/app_process32 + fi + fi + if [ -f "/system/bin/app_process64" ]; then + rm /system/bin/app_process + ln -s /system/bin/app_process64 /system/bin/app_process + elif [ -f "/system/bin/app_process32" ]; then + rm /system/bin/app_process + ln -s /system/bin/app_process32 /system/bin/app_process + fi + rm -f /system/bin/app_process_init +} + +wipe_data_competitors_and_cache() { + rm -f /data/dalvik-cache/*com.noshufou.android.su* + rm -f /data/dalvik-cache/*/*com.noshufou.android.su* + rm -f /data/dalvik-cache/*com.koushikdutta.superuser* + rm -f /data/dalvik-cache/*/*com.koushikdutta.superuser* + rm -f /data/dalvik-cache/*com.mgyun.shua.su* + rm -f /data/dalvik-cache/*/*com.mgyun.shua.su* + rm -f /data/dalvik-cache/*com.m0narx.su* + rm -f /data/dalvik-cache/*/*com.m0narx.su* + rm -f /data/dalvik-cache/*com.kingroot.kinguser* + rm -f /data/dalvik-cache/*/*com.kingroot.kinguser* + rm -f /data/dalvik-cache/*com.kingroot.master* + rm -f /data/dalvik-cache/*/*com.kingroot.master* + rm -f /data/dalvik-cache/*me.phh.superuser* + rm -f /data/dalvik-cache/*/*me.phh.superuser* + rm -f /data/dalvik-cache/*Superuser.apk* + rm -f /data/dalvik-cache/*/*Superuser.apk* + rm -f /data/dalvik-cache/*SuperUser.apk* + rm -f /data/dalvik-cache/*/*SuperUser.apk* + rm -f /data/dalvik-cache/*superuser.apk* + rm -f /data/dalvik-cache/*/*superuser.apk* + rm -f /data/dalvik-cache/*VenomSuperUser.apk* + rm -f /data/dalvik-cache/*/*VenomSuperUser.apk* + rm -f /data/dalvik-cache/*eu.chainfire.supersu* + rm -f /data/dalvik-cache/*/*eu.chainfire.supersu* + rm -f /data/dalvik-cache/*Supersu.apk* + rm -f /data/dalvik-cache/*/*Supersu.apk* + rm -f /data/dalvik-cache/*SuperSU.apk* + rm -f /data/dalvik-cache/*/*SuperSU.apk* + rm -f /data/dalvik-cache/*supersu.apk* + rm -f /data/dalvik-cache/*/*supersu.apk* + rm -f /data/dalvik-cache/*.oat + rm -rf /data/app/com.noshufou.android.su* + rm -rf /data/app/com.koushikdutta.superuser* + rm -rf /data/app/com.mgyun.shua.su* + rm -rf /data/app/com.m0narx.su* + rm -rf /data/app/com.kingroot.kinguser* + rm -rf /data/app/com.kingroot.master* + rm -rf /data/app/me.phh.superuser* +} + +ui_print " " ui_print "*****************" ui_print "SuperSU installer" ui_print "*****************" -ui_print "- Mounting /system, /data and rootfs" -mount /system -mount /data -mount -o rw,remount /system -mount -o rw,remount /system /system -mount -o rw,remount / -mount -o rw,remount / / -cat /system/bin/toolbox > /system/toolbox -chmod 0755 /system/toolbox -ch_con /system/toolbox +ui_print "- Remounting system" + +mount_ /data +mount_ /system +mount_ / +mount -o rw,remount / / API=$(cat /system/build.prop | grep "ro.build.version.sdk=" | dd bs=1 skip=21 count=2) ABI=$(cat /system/build.prop /default.prop | grep -m 1 "ro.product.cpu.abi=" | dd bs=1 skip=19 count=3) ABILONG=$(cat /system/build.prop /default.prop | grep -m 1 "ro.product.cpu.abi=" | dd bs=1 skip=19) ABI2=$(cat /system/build.prop /default.prop | grep -m 1 "ro.product.cpu.abi2=" | dd bs=1 skip=20 count=3) SUMOD=06755 -SUGOTE=false SUPOLICY=false INSTALL_RECOVERY_CONTEXT=u:object_r:system_file:s0 -MKSH=/system/bin/mksh PIE= +SU=su ARCH=arm +ARCHTOOLS=arm_tools APKFOLDER=false APKNAME=/system/app/Superuser.apk APPPROCESS=false APPPROCESS64=false -if [ "$ABI" = "x86" ]; then ARCH=x86; fi; -if [ "$ABI2" = "x86" ]; then ARCH=x86; fi; +SYSTEMLIB=/system/lib:/vendor/lib +SYSTEMLIBTOOLS=/system/lib:/vendor/lib +SYSTEMLIBPATH=/system/lib + +if [ "$API" -le "21" ]; then + # needed for some intermediate AOSP verions + + cat /system/bin/toolbox > /system/toolbox + chmod 0755 /system/toolbox + ch_con /system/toolbox +fi + +if [ "$ABI" = "x86" ]; then ARCH=x86; ARCHTOOLS=x86_tools; fi; +if [ "$ABI2" = "x86" ]; then ARCH=x86; ARCHTOOLS=x86_tools; fi; if [ "$API" -eq "$API" ]; then if [ "$API" -ge "17" ]; then - SUGOTE=true PIE=.pie - if [ "$ABILONG" = "armeabi-v7a" ]; then ARCH=armv7; fi; - if [ "$ABI" = "mip" ]; then ARCH=mips; fi; - if [ "$ABILONG" = "mips" ]; then ARCH=mips; fi; + if [ "$ARCH" = "x86" ]; then SU=su.pie; fi; + if [ "$ABILONG" = "armeabi-v7a" ]; then ARCH=armv7; ARCHTOOLS=arm_tools; fi; + if [ "$ABI" = "mip" ]; then ARCH=mips; ARCHTOOLS=mips_tools; fi; + if [ "$ABILONG" = "mips" ]; then ARCH=mips; ARCHTOOLS=mips_tools; fi; fi if [ "$API" -ge "18" ]; then SUMOD=0755 fi if [ "$API" -ge "20" ]; then - if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; SYSTEMLIB=/system/lib64; APPPROCESS64=true; fi; - if [ "$ABILONG" = "mips64" ]; then ARCH=mips64; SYSTEMLIB=/system/lib64; APPPROCESS64=true; fi; - if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; SYSTEMLIB=/system/lib64; APPPROCESS64=true; fi; + if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; ARCHTOOLS=arm_tools; SYSTEMLIB=/system/lib64:/vendor/lib64; SYSTEMLIBTOOLS=/system/lib:/vendor/lib; SYSTEMLIBPATH=/system/lib64; APPPROCESS64=true; fi; + if [ "$ABILONG" = "mips64" ]; then ARCH=mips64; ARCHTOOLS=mips_tools; SYSTEMLIB=/system/lib64:/vendor/lib64; SYSTEMLIBTOOLS=/system/lib:/vendor/lib; SYSTEMLIBPATH=/system/lib64; APPPROCESS64=true; fi; + if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; ARCHTOOLS=x86_tools; SYSTEMLIB=/system/lib64:/vendor/lib64; SYSTEMLIBTOOLS=/system/lib:/vendor/lib; SYSTEMLIBPATH=/system/lib64; APPPROCESS64=true; fi; APKFOLDER=true APKNAME=/system/app/SuperSU/SuperSU.apk fi if [ "$API" -ge "19" ]; then SUPOLICY=true - if [ "$(LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox ls -lZ /system/bin/toolbox | grep toolbox_exec > /dev/null; echo $?)" -eq "0" ]; then + if [ "$(LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox ls -lZ /system/bin/toolbox | grep toolbox_exec > /dev/null; echo $?)" -eq "0" ]; then INSTALL_RECOVERY_CONTEXT=u:object_r:toolbox_exec:s0 fi fi @@ -198,41 +268,55 @@ if [ "$API" -eq "$API" ]; then APPPROCESS=true fi fi -if [ ! -f $MKSH ]; then - MKSH=/system/bin/sh -fi -#ui_print "DBG [$API] [$ABI] [$ABI2] [$ABILONG] [$ARCH] [$MKSH]" +if [ -z "$BIN" ] || [ -z "$BINTOOLS" ]; then + ui_print "- Extracting files" -ui_print "- Extracting files" -cd /tmp -mkdir supersu -cd supersu + mkdir /dev/tmp 2>/dev/null + cd /dev/tmp + mkdir supersu + cd supersu -if [ -z "$BIN" ]; then - unzip -o "$ZIP" + unzip -oq "$ZIP" - BIN=/tmp/supersu/$ARCH - COM=/tmp/supersu/common + BIN=/dev/tmp/supersu/$ARCH + BINTOOLS=/dev/tmp/supersu/$ARCHTOOLS + COM=/dev/tmp/supersu/common fi +# execute binaries from ramdisk +chmod -R 0755 $BIN/* +chmod -R 0755 $BINTOOLS/* +RAMDISKLIB=$BIN:$SYSTEMLIB +RAMDISKLIBTOOLS=$BINTOOLS:$SYSTEMLIBTOOLS + +if [ "$API" -ge "19" ]; then + # 4.4+: permissive all teh things + LD_LIBRARY_PATH=$RAMDISKLIB $BIN/supolicy --live "permissive *" +fi + +ui_print "- System mode" + ui_print "- Disabling OTA survival" -chmod 0755 $BIN/chattr$PIE -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/bin/su -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/xbin/su -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/bin/.ext/.su -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/sbin/su -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /vendor/sbin/su -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /vendor/bin/su -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /vendor/xbin/su -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/xbin/daemonsu -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/xbin/sugote -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/xbin/sugote_mksh -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/xbin/supolicy -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/lib/libsupol.so -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/lib64/libsupol.so -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/etc/install-recovery.sh -LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/bin/install-recovery.sh +chmod 0755 $BINTOOLS/chattr$PIE +chattr_ /system/bin/su +chattr_ /system/xbin/su +chattr_ /system/bin/.ext/.su +chattr_ /system/sbin/su +chattr_ /vendor/sbin/su +chattr_ /vendor/bin/su +chattr_ /vendor/xbin/su +chattr_ /system/xbin/daemonsu +chattr_ /system/xbin/sugote +chattr_ /system/xbin/sugote_mksh +chattr_ /system/xbin/supolicy +chattr_ /system/xbin/ku.sud +chattr_ /system/xbin/.ku +chattr_ /system/xbin/.su +chattr_ /system/lib/libsupol.so +chattr_ /system/lib64/libsupol.so +chattr_ /system/etc/install-recovery.sh +chattr_ /system/bin/install-recovery.sh ui_print "- Removing old files" @@ -249,75 +333,26 @@ if [ -f "/system/etc/install-recovery.sh" ]; then fi fi +# only wipe these files in /system install, so not part of the wipe_ functions + +rm -f /system/bin/install-recovery.sh +rm -f /system/etc/install-recovery.sh + rm -f /system/bin/su rm -f /system/xbin/su rm -f /system/sbin/su rm -f /vendor/sbin/su rm -f /vendor/bin/su rm -f /vendor/xbin/su -rm -f /system/xbin/daemonsu -rm -f /system/xbin/sugote -rm -f /system/xbin/sugote-mksh -rm -f /system/xbin/supolicy -rm -f /system/lib/libsupol.so -rm -f /system/lib64/libsupol.so -rm -f /system/bin/.ext/.su -rm -f /system/bin/install-recovery.sh -rm -f /system/etc/install-recovery.sh -rm -f /system/etc/init.d/99SuperSUDaemon -rm -f /system/etc/.installed_su_daemon -rm -f /system/app/Superuser.apk -rm -f /system/app/Superuser.odex -rm -rf /system/app/Superuser -rm -f /system/app/SuperUser.apk -rm -f /system/app/SuperUser.odex -rm -rf /system/app/SuperUser -rm -f /system/app/superuser.apk -rm -f /system/app/superuser.odex -rm -rf /system/app/superuser -rm -f /system/app/Supersu.apk -rm -f /system/app/Supersu.odex -rm -rf /system/app/Supersu -rm -f /system/app/SuperSU.apk -rm -f /system/app/SuperSU.odex -rm -rf /system/app/SuperSU -rm -f /system/app/supersu.apk -rm -f /system/app/supersu.odex -rm -rf /system/app/supersu -rm -f /system/app/VenomSuperUser.apk -rm -f /system/app/VenomSuperUser.odex -rm -rf /system/app/VenomSuperUser -rm -f /data/dalvik-cache/*com.noshufou.android.su* -rm -f /data/dalvik-cache/*/*com.noshufou.android.su* -rm -f /data/dalvik-cache/*com.koushikdutta.superuser* -rm -f /data/dalvik-cache/*/*com.koushikdutta.superuser* -rm -f /data/dalvik-cache/*com.mgyun.shua.su* -rm -f /data/dalvik-cache/*/*com.mgyun.shua.su* -rm -f /data/dalvik-cache/*com.m0narx.su* -rm -f /data/dalvik-cache/*/*com.m0narx.su* -rm -f /data/dalvik-cache/*Superuser.apk* -rm -f /data/dalvik-cache/*/*Superuser.apk* -rm -f /data/dalvik-cache/*SuperUser.apk* -rm -f /data/dalvik-cache/*/*SuperUser.apk* -rm -f /data/dalvik-cache/*superuser.apk* -rm -f /data/dalvik-cache/*/*superuser.apk* -rm -f /data/dalvik-cache/*VenomSuperUser.apk* -rm -f /data/dalvik-cache/*/*VenomSuperUser.apk* -rm -f /data/dalvik-cache/*eu.chainfire.supersu* -rm -f /data/dalvik-cache/*/*eu.chainfire.supersu* -rm -f /data/dalvik-cache/*Supersu.apk* -rm -f /data/dalvik-cache/*/*Supersu.apk* -rm -f /data/dalvik-cache/*SuperSU.apk* -rm -f /data/dalvik-cache/*/*SuperSU.apk* -rm -f /data/dalvik-cache/*supersu.apk* -rm -f /data/dalvik-cache/*/*supersu.apk* -rm -f /data/dalvik-cache/*.oat -rm -f /data/app/com.noshufou.android.su* -rm -f /data/app/com.koushikdutta.superuser* -rm -f /data/app/com.mgyun.shua.su* -rm -f /data/app/com.m0narx.su* -rm -f /data/app/eu.chainfire.supersu-* -rm -f /data/app/eu.chainfire.supersu.apk + +rm -rf /data/app/eu.chainfire.supersu-* +rm -rf /data/app/eu.chainfire.supersu.apk + +wipe_system_files_if_present +wipe_data_competitors_and_cache + +rm -f /data/su.img +rm -f /cache/su.img ui_print "- Creating space" if ($APKFOLDER); then @@ -338,7 +373,7 @@ else cp /system/app/Maps.apk /Maps.apk rm /system/app/Maps.apk fi - if [ -f "/system/app/GMS_Maps.apk" ]; then + if [ -f "/system/app/GMS_Maps.apk" ]; then cp /system/app/GMS_Maps.apk /GMS_Maps.apk rm /system/app/GMS_Maps.apk fi @@ -352,16 +387,12 @@ ui_print "- Placing files" mkdir /system/bin/.ext set_perm 0 0 0777 /system/bin/.ext -cp_perm 0 0 $SUMOD $BIN/su /system/bin/.ext/.su -cp_perm 0 0 $SUMOD $BIN/su /system/xbin/su -cp_perm 0 0 0755 $BIN/su /system/xbin/daemonsu -if ($SUGOTE); then - cp_perm 0 0 0755 $BIN/su /system/xbin/sugote u:object_r:zygote_exec:s0 - cp_perm 0 0 0755 $MKSH /system/xbin/sugote-mksh -fi +cp_perm 0 0 $SUMOD $BIN/$SU /system/bin/.ext/.su +cp_perm 0 0 $SUMOD $BIN/$SU /system/xbin/su +cp_perm 0 0 0755 $BIN/$SU /system/xbin/daemonsu if ($SUPOLICY); then cp_perm 0 0 0755 $BIN/supolicy /system/xbin/supolicy - cp_perm 0 0 0644 $BIN/libsupol.so $SYSTEMLIB/libsupol.so + cp_perm 0 0 0644 $BIN/libsupol.so $SYSTEMLIBPATH/libsupol.so fi if ($APKFOLDER); then mkdir /system/app/SuperSU @@ -429,12 +460,15 @@ else fi ui_print "- Post-installation script" -rm /system/toolbox +rm -f /system/toolbox LD_LIBRARY_PATH=$SYSTEMLIB /system/xbin/su --install -ui_print "- Unmounting /system and /data" -umount /system -umount /data +ui_print "- Unmounting /system" + +unmount /system +unmount /data + +rm -rf /dev/tmp ui_print "- Done !" exit 0