/sbin/rooted.sh

http://github.com/kyapa/sc02b_initramfs · Shell · 47 lines · 31 code · 8 blank · 8 comment · 4 complexity · ea411888fc99e0707d79564715c26e0c MD5 · raw file

  1. #!/sbin/ext/busybox sh
  2. # mount system and rootfs r/w
  3. /sbin/ext/busybox mount -o remount,rw /system;
  4. /sbin/ext/busybox mount -t rootfs -o remount,rw rootfs;
  5. # make sure we have /system/xbin
  6. /sbin/ext/busybox mkdir -p /system/xbin
  7. # if symlinked busybox in /system/bin or /system/xbin, remove them
  8. LINK=$(/sbin/ext/busybox find /system/bin/busybox -type l);
  9. if /sbin/ext/busybox [ $LINK = "/system/bin/busybox" ]; then
  10. /sbin/ext/busybox rm -rf /system/bin/busybox;
  11. fi;
  12. LINK=$(/sbin/ext/busybox find /system/xbin/busybox -type l);
  13. if /sbin/ext/busybox [ $LINK = "/system/xbin/busybox" ]; then
  14. /sbin/ext/busybox rm -rf /system/xbin/busybox;
  15. fi;
  16. # if real busybox in /system/bin, move to /system/xbin
  17. if /sbin/ext/busybox [ -f /system/bin/busybox ]; then
  18. /sbin/ext/busybox rm -rf /system/xbin/busybox
  19. /sbin/ext/busybox mv /system/bin/busybox /system/xbin/busybox
  20. fi;
  21. # place wrapper script
  22. /sbin/ext/busybox cp /sbin/ext/busybox-wrapper /sbin/busybox;
  23. /sbin/ext/busybox rm /system/bin/su
  24. /sbin/ext/busybox rm /system/xbin/su
  25. /sbin/ext/busybox cat /res/misc/su > /system/xbin/su
  26. /sbin/ext/busybox chown 0.0 /system/xbin/su
  27. /sbin/ext/busybox chmod 4755 /system/xbin/su
  28. /sbin/ext/busybox rm /system/app/Superuser.apk
  29. /sbin/ext/busybox rm /data/app/Superuser.apk
  30. /sbin/ext/busybox cat /res/misc/Superuser.apk > /system/app/Superuser.apk
  31. /sbin/ext/busybox chown 0.0 /system/app/Superuser.apk
  32. /sbin/ext/busybox chmod 644 /system/app/Superuser.apk
  33. # mount system and rootfs r/o
  34. /sbin/ext/busybox mount -t rootfs -o remount,ro rootfs;
  35. /sbin/ext/busybox mount -o remount,ro /system;
  36. #init.d enabled
  37. if [ -d /system/etc/init.d ]; then
  38. /sbin/ext/busybox run-parts /system/etc/init.d
  39. fi;