PageRenderTime 24ms CodeModel.GetById 13ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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