Repository navigation
Expand file tree
/
Copy pathdo_root
More file actions
executable file
·180 lines (147 loc) · 3.02 KB
/
Copy pathdo_root
File metadata and controls
executable file
·180 lines (147 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
############################################################################
#
# Copyright (c) 2012 - dsixda (dislam@rocketmail.com)
#
# Android Kitchen is 100% free. This script file is intended for personal
# and/or educational use only. It may not be duplicated for monetary
# benefit or any other purpose without the permission of the developer.
#
############################################################################
if [ "$1" == "" ]
then
clear
fi
if [ ! -d WORKING_* ]
then
echo "No working folder found!"
scripts/press_enter
exit 0
fi
scripts/check_galaxy_s_and_s2
sgs=$?
echo
echo "ROOTING"
echo "--------------------------------------------"
echo
echo "The following will be done for root:"
echo
echo "- Add Superuser app and su binary"
echo "- Add necessary lines to the update-script"
if [ "$sgs" == "0" ]
then
echo "- Update default.prop in the ramdisk"
fi
echo
echo "--------------------------------------------"
echo
cd WORKING_*
if [ ! -d system ]
then
echo "No system folder found!"
cd ..
scripts/press_enter
exit 0
fi
cd system
if [ ! -e build.prop ]
then
echo "Error: build.prop not found!"
cd ../..
scripts/press_enter
exit 0
fi
su_path=`find . -name su`
super_path=`find . -iname Superuser.apk`
super_su_exists=0
if [ "$super_path" == "" ]
then
super_path=`find . -iname SuperSU.apk`
if [ "$super_path" != "" ]
then
super_su_exists=1
fi
fi
overwrite=0
if [ "$su_path" != "" ] && [ "$super_path" != "" ]
then
echo "The /system folder contains $su_path and $super_path"
echo -n "Overwrite (y/n)? (default: n): "
read do_su
if [ "$do_su" != "y" ]
then
cd ../..
exit 0
else
overwrite=1
echo
echo
fi
fi
echo "Which version of the Superuser package do you want"
echo "to install?"
echo
echo " c - Chainfire's SuperSU"
echo " d - ChainsDD's version "
echo " v - Original version (very old)"
echo
echo " x - Cancel rooting (default)"
echo
echo -n "? "
read enterVersion
echo
if [ "$enterVersion" == "c" ]
then
folder=chainfire
elif [ "$enterVersion" == "d" ]
then
if [ "`grep -c ro.build.version.release=1 build.prop`" != "0" ]
then
folder=cupcake-donut
else
folder=current
fi
elif [ "$enterVersion" == "v" ]
then
folder=old
else
echo "Cancelled"
cd ../..
exit 1
fi
if [ "$overwrite" == "1" ]
then
echo
echo "Overwriting old 'su' binary and Superuser app ..."
rm -fv $su_path
rm -fv $super_path
fi
if [ -d xbin ]
then
echo Found /system/xbin
else
echo Creating /system/xbin
mkdir xbin
fi
if [ "$enterVersion" == "d" ]
then
cp -fv ../../tools/su_files/chainsdd/Superuser.apk app
cp -fv ../../tools/su_files/chainsdd/$folder/su xbin
else
cp -fv ../../tools/su_files/$folder/app/Superuser.apk app
cp -fv ../../tools/su_files/$folder/bin/su xbin
fi
if [ "$super_su_exists" == "1" ] && [ "$enterVersion" == "c" ]
then
mv -fv app/Superuser.apk app/SuperSU.apk
fi
cd ../..
echo
scripts/add_su_to_update_script
if [ "$sgs" == "0" ]
then
scripts/do_root_boot_img
fi
echo
echo "Finished rooting"
echo
scripts/press_enter