-
Notifications
You must be signed in to change notification settings - Fork 11
/
fetch_buildtool.sh
executable file
·92 lines (85 loc) · 2.23 KB
/
fetch_buildtool.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# Bash Color
green='\033[01;32m'
red='\033[01;31m'
blink_red='\033[05;31m'
restore='\033[0m'
# Path
TOOLCHAIN_DIR=${HOME}/toolchains
TOOLCHAIN_VER=arm-eabi-4.9
AK2_BRANCH="d2"
ANYKERNEL_DIR="AnyKernel2"
KERNEL_DIR=$PWD
# Functions
function get_ubertc {
if [ ! -d $TOOLCHAIN_DIR/$TOOLCHAIN_VER ]; then
echo -e "${green}"
echo ""
echo "=====> Get ToolChain"
echo -e "${restore}"
mkdir -p ${HOME}/toolchains
cd $TOOLCHAIN_DIR
repo init -u git://github.com/lawnn/UBERTC.git -b master
repo sync
cd $KERNEL_DIR
fi
}
function get_anykernel2 {
if [ ! -d $KERNEL_DIR/AnyKernel2 ]; then
echo -e "${green}"
echo ""
echo "=====> Get AnyKernel2"
echo -e "${restore}"
cd $KERNEL_DIR
git clone -b $AK2_BRANCH git@github.com:lawnn/AnyKernel2.git
fi
}
function update_ubertc {
echo -e "${green}"
echo ""
echo "=====> Update ToolChain"
echo -e "${restore}"
cd $TOOLCHAIN_DIR
repo sync
cd $KERNEL_DIR
}
function fetch_anykernel2 {
echo -e "${green}"
echo ""
echo "=====> Update AnyKernel2"
echo -e "${restore}"
if [ -d $KERNEL_DIR/AnyKernel2 ]; then
cd $ANYKERNEL_DIR
rm -rf $KERNEL
rm -rf $DTBIMAGE
git reset --hard > /dev/null 2>&1
git clean -f -d > /dev/null 2>&1
git fetch git@github.com:lawnn/AnyKernel2.git $AK2_BRANCH
git merge FETCH_HEAD
git add-A
git commit -a
cd $KERNEL_DIR
fi
}
while read -p "Update Buildtool? (y/n)? " cchoice
do
case "$cchoice" in
y|Y )
get_ubertc
get_anykernel2
update_ubertc
fetch_anykernel2
echo
echo "Update BuildTools."
break
;;
n|N )
break
;;
* )
echo
echo "Invalid try again!"
echo
;;
esac
done