-
Notifications
You must be signed in to change notification settings - Fork 15
/
helper
executable file
·121 lines (106 loc) · 2.77 KB
/
helper
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash
DATE=$(date +"%Y%m%d-%H%M")
make_build(){
print "Make kernel dtb..." green
if [ $TOOLCHAIN == clang ]; then
export KBUILD_COMPILER_STRING=$(clang/bin/clang --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g' -e 's/[[:space:]]*$//')
PATH="$(pwd)/clang/bin:${PATH}"
make O=out ARCH=arm64 $1
make -j$(nproc --all) O=out \
ARCH=arm64 \
CC=clang \
AR=llvm-ar \
NM=llvm-nm \
OBJCOPY=llvm-objcopy \
OBJDUMP=llvm-objdump \
STRIP=llvm-strip \
CROSS_COMPILE=aarch64-linux-gnu- \
CROSS_COMPILE_ARM32=arm-linux-gnueabi-
else
export CROSS_COMPILE=$(pwd)/gcc64/bin/aarch64-elf-
export CROSS_COMPILE_ARM32=$(pwd)/gcc32/bin/arm-eabi-
make O=out ARCH=arm64 $1
make -j$(nproc --all) O=out ARCH=arm64
fi
}
make_clean(){
rm -rf out
}
send_msg(){
print "${1}" green
curl -s -X POST https://api.telegram.org/bot"${bot_token}"/sendMessage \
-d parse_mode="Markdown" \
-d chat_id="${chat_id}" \
-d text="${1}"
}
send_pesan(){
print "${1}" green
curl -s -X POST https://api.telegram.org/bot"${TOKEN}"/sendMessage \
-d parse_mode="Markdown" \
-d chat_id="${GRUP}" \
-d text="${1}"
}
send_file(){
print "Sending file..." green
curl -F chat_id="${chat_id}" \
-F caption="DEVICE: ${type} | SHA1 : $(sha1sum ${file} | awk '{ print $1 }')" \
-F document=@"${1}" \
https://api.telegram.org/bot"${bot_token}"/sendDocument
}
send_berkas(){
print "Sending file..." green
curl -F chat_id="${GRUP}" \
-F caption="DEVICE: ${type} | SHA1 : $(sha1sum ${file} | awk '{ print $1 }')" \
-F document=@"${1}" \
https://api.telegram.org/bot"${TOKEN}"/sendDocument
}
mkzip(){
print "Generate zip file..." green
if [ -f $(pwd)/out/arch/arm64/boot/Image.gz-dtb ]; then
cp $(pwd)/out/arch/arm64/boot/Image.gz-dtb anykernel
cd anykernel
zip -r9 ../$1 * -x .git README.md *placeholder
cd ..
send_file $1
send_berkas $1
else
send_msg "Build error !"
send_pesan "Build error !"
print "Build error !" red
exit 1
fi
}
print(){
echo ""
case ${2} in
"red")
echo -e "\033[31m $1 \033[0m";;
"green")
echo -e "\033[32m $1 \033[0m";;
*)
echo $1
;;
esac
}
gen_toolchain(){
print "Cloning toolchain files..." green
if [ $TOOLCHAIN == "clang" ]
then
git clone --depth=1 https://github.com/kdrag0n/proton-clang clang
else
git clone --depth=1 https://github.com/chips-project/aarch64-elf gcc64
git clone --depth=1 https://github.com/chips-project/arm-eabi gcc32
fi
git clone --depth=1 https://github.com/DDEAGLE/AnyKernel3 -b release anykernel
}
build(){
export type="${1} ${2} ${3}"
make_clean
if [ $2 == "-oldcam" ]
then
make_build "deagle_${1}_defconfig"
else
make_build "deagle_${1}_newcam_defconfig"
fi
mkzip "$KERNELNAME-$LOCALVERSION-${1}${2}${3}-$DATE.zip"
}