forked from dsixda/Android-Kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_apps2sd_to_update_script
More file actions
executable file
·86 lines (66 loc) · 2.27 KB
/
add_apps2sd_to_update_script
File metadata and controls
executable file
·86 lines (66 loc) · 2.27 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
############################################################################
#
# 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_*
cd META-INF/com/google/android
if [ -e update-script ]
then
if [ "`grep -om 1 a2sd update-script`" == "a2sd" ]
then
echo "update-script already has a2sd content"
cd ../../../../..
exit 0
else
echo
echo "Updating update-script with apps2sd entries ..."
if [ `grep -c "copy_dir PACKAGE:data DATA:" update-script` == 0 ]
then
if [ `grep -c "format .*DATA:" update-script` == 0 ]
then
sed -i -e 's/format\(.*\)SYSTEM:[ ]*[\n]*/format\1SYSTEM:\n\ncopy_dir PACKAGE:data DATA:\n/' update-script
else
sed -i -e 's/format\(.*\)DATA:[ ]*[\n]*/format\1DATA:\n\ncopy_dir PACKAGE:data DATA:\n/' update-script
fi
fi
#
# Remove symlink to /data/app from previous install of apps2sd
#
if [ `grep -c "delete DATA:app" update-script` == 0 ]
then
sed -i -e 's/copy_dir PACKAGE:data DATA:/delete DATA:app\ncopy_dir PACKAGE:data DATA:/' update-script
fi
# Insert file after a certain pattern
cp ../../../../../tools/apps2sd_files/apps2sd_system .
sed -i -e '/etc\/init.goldfish.sh/r apps2sd_system' update-script
rm apps2sd_system
# Insert file before a certain line
cp ../../../../../tools/apps2sd_files/apps2sd_run_program .
line_num=`sed -n -e '/write_raw_image .*:boot.img BOOT:/{=;q}' update-script`
if [ "$line_num" != "" ]
then
line_num=$(($line_num-1))
sed -i -e ''$line_num' r apps2sd_run_program' update-script
else
echo "Error: could not find write_raw_image for boot partition"
fi
rm apps2sd_run_program
if [ "`grep -om 1 a2sd update-script`" != "a2sd" ]
then
echo "Error: Could not update update-script with a2sd"
cd ../../../../..
exit 1
fi
cd ../../../../..
exit 0
fi
else
echo "Error: No update-script found!"
cd ../../../../..
exit 1
fi