forked from dsixda/Android-Kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_busybox
More file actions
executable file
·109 lines (86 loc) · 2.4 KB
/
fix_busybox
File metadata and controls
executable file
·109 lines (86 loc) · 2.4 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
############################################################################
#
# Copyright (c) 2011 - dsixda ([email protected])
#
# 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.
#
############################################################################
#
# This script is normally used after removing the busybox symlinks in the
# update(r)-script. It then repairs the busybox installation.
#
if [ ! -d WORKING_* ]
then
echo No working folder found!
exit 1
fi
cd WORKING_*
echo
if [ -e system/bin/busybox ]
then
echo "Removing /system/bin/busybox"
rm -f system/bin/busybox
fi
if [ -d system/xbin ]
then
echo "Found /system/xbin"
else
echo "Creating /system/xbin"
mkdir system/xbin
fi
if [ ! -e system/xbin/busybox ]
then
echo "Adding /system/xbin/busybox"
cp -f ../tools/busybox_files/busybox system/xbin/
else
version=`more ../tools/busybox_files/version.txt | sed -e 's/BusyBox \(.*\)$/\1/g'`
echo
echo "Working folder already has /system/xbin/busybox"
echo -n "Replace with BusyBox $version (y/n)? (default: y): "
read replace_bin_bb
echo
if [ "$replace_bin_bb" == "n" ]
then
echo "Cancelled"
else
echo "Replacing /system/xbin/busybox"
cp -f ../tools/busybox_files/busybox system/xbin/
fi
fi
#
# Remove 'installbusybox' so that the 'add_busybox_to_update_script' script
# will run completely.
#
if [ -e installbusybox ]
then
rm -f installbusybox
fi
#
# Now fix update-script
#
if [ -e META-INF/com/google/android/update-script ]
then
cd META-INF/com/google/android
search_xbin_busybox=`grep -c "symlink.*xbin/busybox" update-script`
search_symlinks=`grep -c "symlink busybox " update-script`
search_perm=`grep -c "set_perm.*xbin/busybox" update-script`
if [ $search_xbin_busybox -gt 0 ] || [ $search_symlinks -gt 0 ] || [ $search_perm -gt 0 ]
then
echo
echo "Removing existing references to /system/xbin/busybox in update-script"
sed -i \
-e '/symlink.*xbin\/busybox/d' \
-e '/symlink busybox /d' \
-e '/set_perm.*xbin\/busybox/d' \
-e '/set_perm.*installbusybox/d' \
-e '/run_program.*installbusybox/d' \
update-script
fi
cd ../../../../..
scripts/add_busybox_to_update_script
else
echo "Error: update-script not found!"
cd ..
fi