Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Rooting KitKat

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Rooting KitKat

    I put this tutorial together a while ago but forgot to post it

    Some of you may have noticed that the usual steps to root Jelly Bean fail with Kitkat. Here's one way to to Root KitKat, more importantly it's a good pointer as to how to root future versions of android. I'll be using the superuser.apk.

    First goto this thread on XDA and download UPDATE-SuperSU-v1.93 (or later if there has been an update)

    Copy the zip to a folder and extract.


    we are interested in the contents of the following folders:
    arm (the rk processes are arm processors), containing two binaries chattr and su
    common files used by all architectures, containing 99SuperSUDaemon, install-recovery.sh and Superuser.apk
    META-INF/com/google/android used when rooting from CWM or similar, in particular we want updater-binary which is a shell script. You may want to have a quick look at updater-script as well.

    First things first lets examine updater-binary from META-INF/com/google/android, as this shows us how to root:
    lines 57 to 91 remove any existing files used for root
    lines 93 to 99 free up some space, I will already have made sufficient space when I start working on a ROM
    lines 101 to 109 copy the files required for root to the required locations. Note line 109 creates a file indicating su_daemon is installed
    lines 119 to 127 set the required permissions on the deployed files
    lines 132 to 138 set the security context on the files

    Lets Root
    I'll assume that you are working in linux or from my kitchen and that you have some experience of working ROMs. See my tutorials if not.

    mount system

    remove any of the files as in lines 57 to 91 mentioned above

    copy the files from the arm and common folders to the locations specified in 101 to 109 including using echo to create /system/etc/.installed_su_daemon

    use chmod to set the permissions on the files just copied as specified in 119 to 127
    check the files are owned by root and use chown if required

    A few notes
    install-recovery.sh (open it up and take a look) is used by UPDATE-SuperSU-v1.93 root process to start the daemon, this could also be done using an init.d script or from init.rc in boot. This is the most significant change in Kitkat with respect to rooting.

    I tend to use either init.d or init.rc to implement running daemonsu as a daemon.

    How this of some use
    900Supersport

    900supersports FreakTab rkROMkitchen

    900supersports guide to working-RK-ROMs

    Under Construction 900supersports guide to working MediaTek ROMS

    Struggling for time at the moment, but will try and drop by when I can.

    If you would like to support my ROM development then please visit my Google site donate page where you can make a paypal donation

    freaktab developer

    Proof that you're never to old to learn. Sometimes too old to remember though.

    #2
    Thanks Brian for your great explanation. Just one thing to add, that Bob mentioned to me several months ago...while running an init.d script works well, be careful because if someone is using other init.d scripts they could delete this rooting script (if they don't know what it is...or if they have a script that deletes itself or other scripts after they run), rendering the device unrooted. That's why doing it in init.rc is safer.

    Just a thought, when choosing which method you want to use.
    Randy
    Freaktab Developer, Product Reviewer, Moderator and "Flashaholic".
    Read my BIO Here
    Be sure to donate to support Freaktab.com. If any of my development work makes a positive difference for you, please make a donation to support future RileyROM's.
    Donate here

    Comment


      #3
      That's always possible, I've also read of people flashing a different boot.img too so there is no guarantee.

      Sent from my Nexus 7 using Tapatalk
      900Supersport

      900supersports FreakTab rkROMkitchen

      900supersports guide to working-RK-ROMs

      Under Construction 900supersports guide to working MediaTek ROMS

      Struggling for time at the moment, but will try and drop by when I can.

      If you would like to support my ROM development then please visit my Google site donate page where you can make a paypal donation

      freaktab developer

      Proof that you're never to old to learn. Sometimes too old to remember though.

      Comment


        #4
        I modify init.rc in boot.img to permanently root KK without the need of install-recovery.sh being modified.

        I add this to init.rc after the install-recovery call.

        service daemonsu /system/xbin/su --daemon
        class main
        user root
        oneshot

        This way if some other rooted APP decides to modify install-recovery.sh it wont break root.

        Bob
        "Pzebacz im, bo nie wiedzą, co czynią"
        "Прости им, они не ведают, что творят"
        "Perdona loro perché non sanno quello che fanno"
        "Vergib ihnen, denn sie wissen nicht, was sie tun"
        "Vergeef hen want ze weten niet wat ze doen"
        "Pardonne-leur car ils ne savent pas ce qu'ils font"
        "Perdónalos porque no saben que lo que hacen"
        "Oprosti im, jer ne znaju što čine"
        "Forgive them as they know not what they do"





        Comment


          #5
          Just a quick post, I find starting su as a daemon from init.rc to be most reliable. See Bob's post above for details.
          900Supersport

          900supersports FreakTab rkROMkitchen

          900supersports guide to working-RK-ROMs

          Under Construction 900supersports guide to working MediaTek ROMS

          Struggling for time at the moment, but will try and drop by when I can.

          If you would like to support my ROM development then please visit my Google site donate page where you can make a paypal donation

          freaktab developer

          Proof that you're never to old to learn. Sometimes too old to remember though.

          Comment


            #6
            I am a real noob regarding linux knowledgement but i have installed Cygwin in order to try make things work, would it be possible to do this with Cygwin?
            Is there anywaynto do this in windows?
            900supersport, does your kitchen work in Cygwin?
            thank you for your replies., i am truly greatful!!!

            Originally posted by 900supersport View Post
            Just a quick post, I find starting su as a daemon from init.rc to be most reliable. See Bob's post above for details.
            CR11S AP6210 Chipset
            CS968 MTK Chipset MT5981 - MT6622
            HTC-T018-V04

            Comment


              #7
              Thanks for thoses explains!

              With thoses, i've modified my bash script to root/unroot JB and KK:

              Code:
              #!/bin/bash
              
              #######
              ###
              ### Made by Stephane HUC - <[email protected]>
              ###
              #######
              ### This tool is inspired (for JB) by VirusPlus Script (under Vondroid Forum)
              #### http://vondroid.com/resources/rk3188-simple-root.387/
              ### thanks for thoses explains :
              #### http://www.freaktab.com/showthread.php?12384-Rooting-KitKat
              ###
              
              PWD=$(pwd)
              
              # Packages names
              #BBOX="busybox"
              RECO="install-recovery.sh"
              SuperSU="Superuser.apk"
              SU="su"
              version="v2.02"
              
              # Directories where are packages needed into your computer
              #DIR_BB="${PWD}/RK3188 SImple Root-Unroot Tool by VirusPlus/${BBOX}"
              DIR_RECO="${PWD}/UPDATE-SuperSU-${version}/common/${RECO}"
              DIR_SU="${PWD}/UPDATE-SuperSU-${version}/arm/${SU}"
              DIR_SSU="${PWD}/UPDATE-SuperSU-${version}/common/${SuperSU}"
              
              # Directories where are packages into tablet system
              #SYS_BB="/system/xbin/${BBOX}"
              SYS_RECO="/system/etc/${RECO}"
              SYS_SU="/system/xbin/${SU}"
              SYS_SSU="/system/app/${SuperSU}"
              
              # where are adb binary
              adb=$(which adb)
              
              ###
              # functions - DON'T TOUCH!
              ###
              
              function adb_mount_system() {
              
                  case "$1" in
                      "r") echo "Mount system to read-only into your tablet!"; io="ro" ;;
                      "w") echo "Mount system to read'n write into your tablet!"; io="rw" ;;
                  esac
              
                  ${adb} shell "mount -o remount,${io} /system"
                  unset io
              
              }
              
              function menu() {
              
                  ACT[1]="root JB (4.2.x)"
                  ACT[2]="unroot JB"
                  ACT[3]="root KK (4.4.x)"
                  ACT[4]="unroot KK"
                  ACT[5]="reboot your tablet"
                  ACT[6]="Quit"
              
                  echo "RK3188 Root/Unroot Tool :: Welcome"
              
                  PS3="What do you want:"
                  select choice in "${ACT[@]}"
                  do
                      case $REPLY in
                          1) root ;;
                          2) unroot ;;
                          3) root_kk ;;
                          4) unroot_kk ;;
                          5) reboot ;;
                          6) exit 0 ;;
                      esac
                  done
              
              }
              
              function mount() {
              
                  echo "Mount your tablet to write in..."
                  ${adb} kill-server
                  ${adb} wait-for-device
                  ${adb} root
                  ${adb} remount
                  [[ $? -ne 0 ]] && adb_mount_system "w"
                  echo "Your tablet is ready to write in..."
              
              }
              
              function reboot() {
              
                  echo "Your tablet reboot..."
                  ${adb} reboot
                  ${adb} kill-server
                  echo "*** Enjoy-it! ***"
              
              }
              
              function root() {
              
                  clear
                  echo "The script will to root your tablet!"
              
                  mount
              
                  echo "Install binairy su to your tablet"
                  ${adb} push "${DIR_SU}" "${SYS_SU}"
                  ${adb} shell "if [[ -f ${SYS_SU} ]]; then chown root.root ${SYS_SU} && chmod 0755 ${SYS_SU}; fi"
                  ${adb} shell "if [[ -f ${SYS_SU} ]]; then echo Install su: OK!; else echo Install su: Error!; fi"
                  #${adb} shell chown root.root "${SYS_SU}"
                  #${adb} shell chmod 6755 "${SYS_SU}"
              
                  sleep 3
              
                  #echo "Install binary busybox to your tablet"
                  #${adb} push "${DIR_BB}" "${SYS_BB}"
                  #${adb} shell "if [[ -f ${SYS_BB} ]]; then chown root.root ${SYS_BB} && chmod 0755 ${SYS_BB}; fi"
                  #${adb} shell "if [[ -f ${SYS_BB} ]]; then echo Install busybox: OK!; else echo Install busybox: Error!; fi"
                  #${adb} shell chown root.root "${SYS_BB}"
                  #${adb} shell chmod 6755 "${SYS_BB}"
              
                  sleep 3
              
                  echo "Install binary SuperSU to your tablet"
                  ${adb} push  "${DIR_SSU}" "${SYS_SSU}"
                  ${adb} shell "if [[ -f ${SYS_SSU} ]]; then chown root.root ${SYS_SSU} && chmod 0644 ${SYS_SSU}; fi"
                  ${adb} shell "if [[ -f ${SYS_SSU} ]]; then echo Install SuperSU: OK!; else echo Install SuperSU: Error!; fi"
                  #${adb} shell chown root.root "${SYS_SSU}"
                  #${adb} shell chmod 0644 "${SYS_SSU}"
              
                  sleep 3
              
                  echo "ROOT 1rst step ENDING... Please, verify no error message!"
              
                  sleep 3
                  adb_mount_system "r"
              
              }
              
              function root_kk() {
              
                  root
              
                  sleep 3
              
                  adb_mount_system "w"
              
                  sleep 3
              
                  echo "Copy su to daemonsu"
                  ${adb} shell cp "${SYS_SU}" /system/xbin/daemonsu
                  ${adb} shell "if [[ -f /system/xbin/daemonsu ]]; then chown root.root /system/xbin/daemonsu && chmod 0755 /system/xbin/daemonsu; fi"
                  ${adb} shell "if [[ -f /system/xbin/daemonsu ]]; then echo Install DaemonSU: OK!; else echo Install DaemonSU: Error!; fi"
                  #${adb} shell chown root.root /system/xbin/daemonsu
                  #${adb} shell chmod 0755 /system/xbin/daemonsu
              
                  sleep 3
              
                  echo "Install recovery.sh"
                  ${adb} push "${DIR_RECO}" "${SYS_RECO}"
                  ${adb} shell "if [[ -f ${SYS_RECO} ]]; then chown root.root ${SYS_RECO} && chmod 0755 ${SYS_RECO}; fi"
                  ${adb} shell "if [[ -f ${SYS_RECO} ]]; then echo Install Recovery.sh: OK!; else echo Install Recovery.sh: Error!; fi"
                  #${adb} shell chown 0.2000 /system/etc/install-recovery.sh
                  #${adb} shell chmod 0755 /system/etc/install-recovery.sh
              
                  sleep 3
                  echo "ROOT KitKat ENDING... Please, verify no error message!"
              
                  sleep 3
                  adb_mount_system "r"
              
              }
              
              function unroot() {
              
                  clear
                  echo "The script will to unroot your tablet!"
              
                  mount
              
                  echo "Remove ${SuperSU}"
                  ${adb} shell "if [[ -f ${SYS_SSU} ]]; then rm ${SYS_SSU}; fi"
                  ${adb} shell "if [[ -f /data/dalvik-cache/*${SuperSU}* ]]; then rm /data/dalvik-cache/*${SuperSU}*; fi"
              
                  ${adb} shell "if [[ -f /data/app/eu.chainfire.supersu* ]]; then rm /data/app/eu.chainfire.supersu*; fi"
                  ${adb} shell "if [[ -d /data/app-lib/eu.chainfire.supersu* ]]; then rm -rf /data/app-lib/eu.chainfire.supersu*; fi"
                  ${adb} shell "if [[ -d /data/data/eu.chainfire.supersu* ]]; then rm -rf /data/data/eu.chainfire.supersu*; fi"
              
                  echo "Remove ${SU} binary"
                  ${adb} shell "if [[ -f ${SYS_SU} ]]; then rm ${SYS_SU}; fi"
              
                  #echo "Remove ${BBOX} binary"
                  #${adb} shell "if [[ -f ${SYS_BB} ]]; then rm ${SYS_BB}; fi"
              
                  echo "UNROOT 1rst step ENDING... Please, verify no error message!"
              
                  sleep 3
              
                  adb_mount_system "r"
              
              }
              
              function unroot_kk() {
              
                  unroot
              
                  sleep 3
              
                  adb_mount_system "w"
              
                  echo "Remove daemonsu binary"
                  ${adb} shell "if [[ -f /system/xbin/daemonsu ]]; then rm /system/xbin/daemonsu; fi"
              
                  echo "Remove ${RECO} file"
                  ${adb} shell "if [[ -f ${SYS_RECO} ]]; then rm ${SYS_RECO}; fi"
              
                  echo "UNROOT KitKat ENDING... Please, verify no error message!"
              
                  sleep 3
              
                  adb_mount_system "r"
              
              }
              
              menu
              Enjoy-it!
              Last edited by ATP; 08-07-2014, 12:48.
              "Just ATP"
              - MTKZenyT(ools) : Tools to backup, flash, root'n unroot under GNU/Linux

              Phone: Xiaomi Redmi 1
              Tablet
              s: CDisplay SV1.0.6 (original); PiPo M8HD (under RileyRom 1.9)

              Comment


                #8
                Thanks for the guide on how to pre-root KitKat

                The updater-binary in later revisions of the supersu flashzip adds more lines of files and permission setting so your line number reference isn't going to be that helpful in the future when the script changes even more. So if you can, can you futureproof your guide a little so this will work on later supersu zip versions, thanks in advance. I did figure out what files and permissions to apply by looking at the old and new update-binary shell script!

                Example (update-binary from the /META-INF/com/google/android/ section of the SuperSU-v2.16 zip)

                Code:
                #!/sbin/sh#
                # SuperSU installer ZIP 
                # Copyright (c) 2012-2014 - Chainfire
                #
                # 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+    common/Superuser.apk          /system/app/Superuser.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
                #
                # 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
                #
                # 17+   common/99SuperSUDaemon *4     /system/etc/init.d/99SuperSUDaemon  0755    u:object_r:system_file:s0   optional
                # *4: only place this file if /system/etc/init.d is present
                #
                # 17+   'echo 1 >' or 'touch' *5      /system/etc/.installed_su_daemon    0644    u:object_r:system_file:s0   optional
                # *5: 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 or 
                # 99SuperSUDaemon) 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
                
                
                ui_print() {
                  echo -n -e "ui_print $1\n" > /proc/self/fd/$OUTFD
                  echo -n -e "ui_print\n" > /proc/self/fd/$OUTFD
                }
                
                
                set_perm() {
                  chown $1.$2 $4
                  chown $1:$2 $4
                  chmod $3 $4
                }
                
                
                ch_con() {
                  LD_LIBRARY_PATH=/system/lib /system/toolbox chcon u:object_r:system_file:s0 $1
                  LD_LIBRARY_PATH=/system/lib /system/bin/toolbox chcon u:object_r:system_file:s0 $1
                  chcon u:object_r:system_file:s0 $1
                }
                
                
                ch_con_ext() {
                  LD_LIBRARY_PATH=/system/lib /system/toolbox chcon $2 $1
                  LD_LIBRARY_PATH=/system/lib /system/bin/toolbox chcon $2 $1
                  chcon $2 $1
                }
                
                
                ui_print "*********************"
                ui_print "SuperSU installer ZIP"
                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
                
                
                API=$(cat /system/build.prop | grep "ro.build.version.sdk=" | dd bs=1 skip=21 count=2)
                ABI=$(cat /default.prop /system/build.prop | grep -m 1 "ro.product.cpu.abi=" | dd bs=1 skip=19 count=3)
                ABILONG=$(cat /default.prop /system/build.prop | grep -m 1 "ro.product.cpu.abi=" | dd bs=1 skip=19)
                ABI2=$(cat /default.prop /system/build.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=
                ARCH=arm
                if [ "$ABI" = "x86" ]; then ARCH=x86; fi;
                if [ "$ABI2" = "x86" ]; then ARCH=x86; fi;
                if [ "$API" -eq "$API" ]; then
                  if [ "$API" -ge "17" ]; then
                    SUMOD=0755
                    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;
                  fi
                  if [ "$API" -ge "19" ]; then
                    SUPOLICY=true
                    if [ "$(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
                  if [ "$API" -ge "20" ]; then
                    if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; fi;
                    if [ "$ABILONG" = "mips64" ]; then ARCH=mips64; fi;
                    if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; fi;
                  fi
                fi
                if [ ! -f $MKSH ]; then
                  MKSH=/system/bin/sh
                fi
                
                
                #ui_print "DBG [$API] [$ABI] [$ABI2] [$ABILONG] [$ARCH] [$MKSH]"
                
                
                ui_print "- Extracting files"
                cd /tmp
                mkdir supersu
                cd supersu
                unzip -o "$ZIP"
                
                
                BIN=/tmp/supersu/$ARCH
                COM=/tmp/supersu/common
                
                
                ui_print "- Disabling OTA survival"
                chmod 0755 /tmp/supersu/$ARCH/chattr$PIE
                LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/bin/su
                LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/xbin/su
                LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/bin/.ext/.su
                LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/xbin/daemonsu
                LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/xbin/sugote
                LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/xbin/sugote_mksh
                LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/xbin/supolicy
                LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/etc/install-recovery.sh
                LD_LIBRARY_PATH=/system/lib $BIN/chattr$PIE -i /system/bin/install-recovery.sh
                
                
                ui_print "- Removing old files"
                rm -f /system/bin/su
                rm -f /system/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/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 -f /system/app/SuperUser.apk
                rm -f /system/app/SuperUser.odex
                rm -f /system/app/superuser.apk
                rm -f /system/app/superuser.odex
                rm -f /system/app/Supersu.apk
                rm -f /system/app/Supersu.odex
                rm -f /system/app/SuperSU.apk
                rm -f /system/app/SuperSU.odex
                rm -f /system/app/supersu.apk
                rm -f /system/app/supersu.odex
                rm -f /system/app/VenomSuperUser.apk
                rm -f /system/app/VenomSuperUser.odex
                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
                
                
                ui_print "- Creating space"
                cp /system/app/Maps.apk /Maps.apk
                cp /system/app/GMS_Maps.apk /GMS_Maps.apk
                cp /system/app/YouTube.apk /YouTube.apk
                rm /system/app/Maps.apk
                rm /system/app/GMS_Maps.apk
                rm /system/app/YouTube.apk
                
                
                ui_print "- Placing files"
                mkdir /system/bin/.ext
                cp $BIN/su /system/xbin/daemonsu
                cp $BIN/su /system/xbin/su
                if ($SUGOTE); then 
                  cp $BIN/su /system/xbin/sugote
                  cp $MKSH /system/xbin/sugote-mksh
                fi
                if ($SUPOLICY); then
                  cp $BIN/supolicy /system/xbin/supolicy
                fi
                cp $BIN/su /system/bin/.ext/.su
                cp $COM/Superuser.apk /system/app/Superuser.apk
                cp $COM/install-recovery.sh /system/etc/install-recovery.sh
                ln -s /system/etc/install-recovery.sh /system/bin/install-recovery.sh
                cp $COM/99SuperSUDaemon /system/etc/init.d/99SuperSUDaemon
                echo 1 > /system/etc/.installed_su_daemon
                
                
                ui_print "- Restoring files"
                cp /Maps.apk /system/app/Maps.apk
                cp /GMS_Maps.apk /system/app/GMS_Maps.apk
                cp /YouTube.apk /system/app/YouTube.apk
                rm /Maps.apk
                rm /GMS_Maps.apk
                rm /YouTube.apk
                
                
                ui_print "- Setting permissions"
                set_perm 0 0 0777 /system/bin/.ext
                set_perm 0 0 $SUMOD /system/bin/.ext/.su
                set_perm 0 0 $SUMOD /system/xbin/su
                if ($SUGOTE); then
                  set_perm 0 0 0755 /system/xbin/sugote
                  set_perm 0 0 0755 /system/xbin/sugote-mksh
                fi
                if ($SUPOLICY); then
                  set_perm 0 0 0755 /system/xbin/supolicy
                fi
                set_perm 0 0 0755 /system/xbin/daemonsu
                set_perm 0 0 0755 /system/etc/install-recovery.sh
                set_perm 0 0 0755 /system/etc/init.d/99SuperSUDaemon
                set_perm 0 0 0644 /system/etc/.installed_su_daemon
                set_perm 0 0 0644 /system/app/Superuser.apk
                set_perm 0 0 0644 /system/app/Maps.apk
                set_perm 0 0 0644 /system/app/GMS_Maps.apk
                set_perm 0 0 0644 /system/app/YouTube.apk
                
                
                ch_con /system/bin/.ext/.su
                ch_con /system/xbin/su
                if ($SUGOTE); then 
                  ch_con_ext /system/xbin/sugote u:object_r:zygote_exec:s0
                  ch_con /system/xbin/sugote-mksh
                fi
                if ($SUPOLICY); then
                  ch_con /system/xbin/supolicy
                fi
                ch_con /system/xbin/daemonsu
                ch_con_ext /system/etc/install-recovery.sh $INSTALL_RECOVERY_CONTEXT
                ch_con /system/etc/init.d/99SuperSUDaemon
                ch_con /system/etc/.installed_su_daemon
                ch_con /system/app/Superuser.apk
                ch_con /system/app/Maps.apk
                ch_con /system/app/GMS_Maps.apk
                ch_con /system/app/YouTube.apk
                
                
                ui_print "- Post-installation script"
                rm /system/toolbox
                LD_LIBRARY_PATH=/system/lib /system/xbin/su --install
                
                
                ui_print "- Unmounting /system and /data"
                umount /system
                umount /data
                
                
                ui_print "- Done !"
                exit 0
                "I am a fan of android and other tech stuff like windows and linux on the desktop! I will contribute what I can to the FreakTab community, but only, what I'm willing to" -AndroidFanatic

                Comment

                Working...
                X