forked from morristech/PDroid2.0_Framework_Patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ppatch
executable file
·79 lines (67 loc) · 1.56 KB
/
ppatch
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
#!/bin/bash
#########################################
# Written by biglsd #
# modified by CollegeDev & xelra #
#########################################
# Array of subdirectories
subdir=( "build" "libcore" "frameworks/base" "frameworks/opt/telephony" "packages/apps/Mms" )
# Absolute path to this script
SCRIPT=$(readlink -f $0)
# Absolute path this script is in
SCRIPTPATH=$(dirname $SCRIPT)
remove()
{
printf "Removing PDroid 2.0 patches ...%s"
for i in "${subdir[@]}"
do
if cd "$ANDROID_BUILD_TOP/$i" ; then
git checkout . && git clean -df
else
echo "$ANDROID_BUILD_TOP/$i: No such directory."
fi
done
if cd "$ANDROID_BUILD_TOP/packages/apps/PDroidAgent" ; then
rm -rf "$ANDROID_BUILD_TOP/packages/apps/PDroidAgent"
else
echo "$ANDROID_BUILD_TOP/packages/apps/PDroidAgent: No such directory."
fi
cd "$ANDROID_BUILD_TOP"
repo abandon pdroid
}
install()
{
printf "Installing PDroid 2.0 patches ...%s"
cd "$ANDROID_BUILD_TOP"
repo sync
for i in "${subdir[@]}"
do
if cd "$ANDROID_BUILD_TOP/$i" ; then
git checkout -b pdroid
else
echo "$ANDROID_BUILD_TOP/$i: No such directory."
fi
done
cd "$ANDROID_BUILD_TOP"
patchfiles=( "CM10.1_build.patch" "CM10.1_framework.patch" "CM10.1_libcore.patch" "CM10.1_Mms.patch" "CM10.1_PDAgent.patch" )
for i in "${patchfiles[@]}"
do
patch -p1 < $SCRIPTPATH/$i
done
}
case "$1" in
install)
install
;;
remove)
remove
;;
update)
$0 remove
$0 install
;;
*)
## If no parameters are given, print which are avaiable.
echo "Usage: $0 {install|remove|update}"
exit 1
;;
esac