forked from dsixda/Android-Kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_initd_perm_to_update_script
More file actions
executable file
·59 lines (42 loc) · 1.66 KB
/
add_initd_perm_to_update_script
File metadata and controls
executable file
·59 lines (42 loc) · 1.66 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
############################################################################
#
# 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.
#
############################################################################
cd WORKING_*
if [ -d system/etc/init.d ]
then
echo
echo "Checking whether update-script requires update for /system/etc/init.d ..."
cd META-INF/com/google/android
if [ -e update-script ]
then
if [ `grep -c "set_perm_recursive .*SYSTEM:etc/init.d$" update-script` == 0 ]
then
echo "update-script is being modified"
# Look for line with set_perm_recursive of SYSTEM:
grep_perm=`grep set_perm_recursive update-script | grep -m 1 "SYSTEM:[ ]*$"`
if [ "$grep_perm" == "" ]
then
sed -i -e 's/copy_dir PACKAGE:system SYSTEM:/copy_dir PACKAGE:system SYSTEM:\nset_perm_recursive 0 0 0777 0777 SYSTEM:etc\/init.d/g' update-script
else
sed -i -e 's/\(set_perm_recursive[ ]*[^\ ]*[ ]*[^\ ]*[ ]*[^\ ]*[ ]*[^\ ]*[ ]*SYSTEM:[ ]*$\)/\1\nset_perm_recursive 0 0 0777 0777 SYSTEM:etc\/init.d/g' update-script
fi
if [ `grep -c "set_perm_recursive .*SYSTEM:etc/init.d$" update-script` == 0 ]
then
echo "Error: Could not find the line to update in update-script"
fi
else
echo "update-script already has permissions set for init.d folder"
fi
else
echo "Error: No update-script found!"
fi
cd ../../../..
fi
cd ..
scripts/fix_update_script_blanks