-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathadd_sysrorw_to_update_script
executable file
·80 lines (61 loc) · 2.61 KB
/
add_sysrorw_to_update_script
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
############################################################################
#
# Copyright (c) 2012 - dsixda (dislam@rocketmail.com)
#Copyright (c) 2014 - 越狱 (http://weibo.com/206021119)
#
# Android 厨房是100%免费。此脚本文件仅供个人或学习使用
# by hwh132 越狱 汉化
#
############################################################################
cd WORKING_*
cd META-INF/com/google/android
if [ -e update-script ]
then
if [ "`grep -om 1 sysro update-script`" == "sysro" ] && [ "`grep -om 1 sysrw update-script`" == "sysrw" ]
then
echo "update-script 脚本中已存在 sysro/sysrw 内容"
else
#
# Do this to prevent conflicts with the update-script in ROMs that already have the binary
#
if [ -e ../../../../system/bin/sysro ]
then
if [ "`find ../../../../system/xbin -name sysro`" == "" ]
then
echo "复制 system/bin/sysro 到 system/xbin/sysro"
cp -f ../../../../system/bin/sysro ../../../../system/xbin/sysro
fi
fi
if [ -e ../../../../system/bin/sysrw ]
then
if [ "`find ../../../../system/xbin -name sysrw`" == "" ]
then
echo "复制 system/bin/sysrw 到 system/xbin/sysrw"
cp -f ../../../../system/bin/sysrw ../../../../system/xbin/sysrw
fi
fi
echo
echo "添加 sysro 和 sysrw 内容到 update-script 脚本"
if [ `grep -c "set_perm_recursive.*SYSTEM:xbin[ ]*$" update-script` != 0 ]
then
sed -i -e 's/set_perm_recursive\(.*\)SYSTEM:xbin[ ]*$/set_perm_recursive\1SYSTEM:xbin\nset_perm 0 0 04755 SYSTEM:xbin\/sysrw\nset_perm 0 0 04755 SYSTEM:xbin\/sysro\n/' update-script
elif [ `grep -c "init.goldfish.sh" update-script` != 0 ]
then
perl -pi -e 's/set_perm 0 2000 0550 SYSTEM:etc\/init.goldfish.sh/set_perm 0 2000 0550 SYSTEM:etc\/init.goldfish.sh\nset_perm 0 0 04755 SYSTEM:xbin\/sysrw\nset_perm 0 0 04755 SYSTEM:xbin\/sysro\n/g' update-script
elif [ `grep -c "write_raw_image .*:boot.img BOOT:" update-script` != 0 ]
then
sed -i -e 's/write_raw_image \(.*:boot.img\) BOOT:/set_perm 0 0 04755 SYSTEM:xbin\/sysrw\nset_perm 0 0 04755 SYSTEM:xbin\/sysro\nwrite_raw_image \1 BOOT:/' update-script
else
echo "set_perm 0 0 04755 SYSTEM:xbin/sysrw" >> update-script
echo "set_perm 0 0 04755 SYSTEM:xbin/sysro" >> update-script
fi
if [ "`grep -om 1 sysro update-script`" != "sysro" ] || [ "`grep -om 1 sysrw update-script`" != "sysrw" ]
then
echo "错误: 无法在 update-script 脚本中添加 sysro/sysrw"
fi
fi
else
echo "错误: 未发现 update-script 脚本!"
fi
cd ../../../../..
scripts/fix_update_script_blanks