aboutsummaryrefslogtreecommitdiff
path: root/root-vi7.sh
diff options
context:
space:
mode:
Diffstat (limited to 'root-vi7.sh')
-rw-r--r--root-vi7.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/root-vi7.sh b/root-vi7.sh
new file mode 100644
index 0000000..8bb5e61
--- /dev/null
+++ b/root-vi7.sh
@@ -0,0 +1,68 @@
1#!/system/bin/sh -x
2
3# Chuwi Vi7 SuperSU install script <https://github.com/Pacien/vi7-root>
4# Tailored for the stock Chuwi firmware
5# Installation using the ADB root shell
6#
7# This script shall be executed if and only if the user is able to
8# understand its purposes and possible implications.
9#
10# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
13# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
14# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
15# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
16# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17
18mount -o rw,remount /system
19
20SU_DIR=/data/local/tmp
21ARCH=x86
22
23cp_chmod_chcon() {
24 cp $1 $2
25 chmod $3 $2
26 chcon $4 $2
27}
28
29bckp() {
30 cp -p $1 $1.bckp
31}
32
33mkdir -p /system/app/SuperSU
34cp_chmod_chcon $SU_DIR/common/Superuser.apk /system/app/SuperSU/SuperSU.apk 0644 u:object_r:system_file:s0
35
36cp_chmod_chcon $SU_DIR/common/install-recovery.sh /system/etc/install-recovery.sh 0755 u:object_r:toolbox_exec:s0
37
38bckp /system/bin/install-recovery.sh
39rm /system/bin/install-recovery.sh
40ln -s /system/etc/install-recovery.sh /system/bin/install-recovery.sh
41
42mkdir -p /system/bin/.ext
43cp_chmod_chcon $SU_DIR/$ARCH/su /system/xbin/su 0755 u:object_r:system_file:s0
44cp_chmod_chcon $SU_DIR/$ARCH/su /system/bin/.ext/.su 0755 u:object_r:system_file:s0
45cp_chmod_chcon $SU_DIR/$ARCH/su /system/xbin/daemonsu 0755 u:object_r:system_file:s0
46cp_chmod_chcon $SU_DIR/$ARCH/su /system/xbin/sugote 0755 u:object_r:zygote_exec:s0
47
48cp_chmod_chcon $SU_DIR/$ARCH/supolicy /system/xbin/supolicy 0755 u:object_r:system_file:s0
49cp_chmod_chcon $SU_DIR/$ARCH/libsupol.so /system/lib/libsupol.so 0644 u:object_r:system_file:s0
50
51cp_chmod_chcon /system/bin/sh /system/xbin/sugote-mksh 0755 u:object_r:system_file:s0
52
53cp_chmod_chcon /system/bin/app_process32 /system/bin/app_process32_original 0755 u:object_r:zygote_exec:s0
54cp_chmod_chcon /system/bin/app_process32 /system/bin/app_process_init 0755 u:object_r:system_file:s0
55
56rm /system/bin/app_process
57ln -s /system/xbin/daemonsu /system/bin/app_process
58
59rm /system/bin/app_process32
60ln -s /system/xbin/daemonsu /system/bin/app_process32
61
62#cp_chmod_chcon $SU_DIR/common/99SuperSUDaemon /system/etc/init.d/99SuperSUDaemon 0755 u:object_r:system_file:s0 # no init.d
63
64touch /system/etc/.installed_su_daemon
65
66rm -R /data/local/tmp/*
67#mount -o ro,remount /system # done on reboot
68/system/xbin/su --install