forked from dsixda/Android-Kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_nano_to_update_script
More file actions
executable file
·71 lines (54 loc) · 2.08 KB
/
add_nano_to_update_script
File metadata and controls
executable file
·71 lines (54 loc) · 2.08 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
############################################################################
#
# Copyright (c) 2012 - 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.
#
############################################################################
cd WORKING_*
cd META-INF/com/google/android
echo
if [ -e update-script ]
then
if [ "`grep -om 1 nano update-script`" == "nano" ]
then
echo "update-script already has nano content"
else
#
# Do this to prevent conflicts with the update-script in ROMs that already have the binary
#
if [ -e ../../../../system/bin/nano ]
then
if [ "`find ../../../../system/xbin -name nano`" == "" ]
then
echo "Copying system/bin/nano to system/xbin/nano"
cp -f ../../../../system/bin/nano ../../../../system/xbin/nano
fi
fi
echo "Updating update-script with nano entries"
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\/nano\n/' update-script
elif [ `grep -c "init.goldfish.sh" update-script` != 0 ]
then
sed -i -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\/nano\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\/nano\nwrite_raw_image \1 BOOT:/' update-script
else
echo "set_perm 0 0 04755 SYSTEM:xbin/nano" >> update-script
fi
if [ "`grep -om 1 nano update-script`" != "nano" ]
then
echo "Error: Unable to update the update-script with nano"
fi
fi
else
echo "Error: No update-script found!"
cd ../../../../..
exit 1
fi
cd ../../../../..
scripts/fix_update_script_blanks