forked from Tof37/android_device_semc_es209ra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCmX10patchsinstall.sh
executable file
·65 lines (58 loc) · 1.59 KB
/
CmX10patchsinstall.sh
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
#! /bin/bash
function apply_patch()
{
echo "patch -p1 < $1"
patch -p1 < $1
}
{ clear
echo "Welcome to CmX10 patchs installer"
echo
if find $(pwd)/patches -name "*.patch" >&/dev/null ; then
rom_root=`pwd`
rom_root=$rom_root/../../../
cd patches
patch_directory=`pwd`
file_list=`find $patch_directory -name "*.patch"`
echo
echo "Patchs files found"
for n in $file_list
do
i=$(($i+1))
patchArray[$i]=$n
echo " $i. $n"
done
echo
#Go to the ROM root folder
cd $rom_root
echo -n "Please enter number of the patch you want to install (all=0, quit=q): "
read ans
if [ "$ans" == "0" ]; then
for a in $file_list
do
dir_path=$(dirname $a)
dir_path="."${dir_path#$patch_directory}
cd $dir_path
apply_patch $a
cd $rom_root
done
fi
if [ "$ans" == "q" ]; then
exit 0
fi
if [ "`echo $ans | sed 's/[0-9]*//'`" == "" ] || [ "ans"=="1" ]; then
a=${patchArray[$ans]}
if [ "$a" == "" ]; then
exit 0
fi
else
exit 0
fi
dir_path=$(dirname $a)
dir_path="."${dir_path#$patch_directory}
cd $dir_path
apply_patch $a
cd $rom_root
else
echo "There are no patchs found"
fi
}