-
Notifications
You must be signed in to change notification settings - Fork 1
/
makeota
executable file
·46 lines (43 loc) · 1.15 KB
/
makeota
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
#!/bin/bash
random_number() {
MATRIX="0123456789abcdefghijklmnopqrstuvwxyz"
LENGTH="10"
while [ "${n:=1}" -le "$LENGTH" ]
do
PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}"
let n+=1
done
echo "$PASS"
exit 0
}
mkdir -p ROM
if [ "$3" = "" ]
then
echo you must input device name and build number
elif [ -e "$3" -a "$1" = "c" ]
then
cp ./out/fullota.zip ./ROM/miui_"$2"_"$3"_"$OTA"_4.0.zip
else
if [ ! -e ./ROM/target_files_"$3".zip ]
then
echo -e "\E[32m last target_files_"$3".zip don't exists \E[0m"
exit 0
fi
if [ ! -e ./ROM/target_files_"$2".zip ]
then
cp ./out/target_files.zip ./ROM/target_files_"$2".zip
echo copy target_files.zip from out_dir
else
echo target_files.zip already exists
fi
../../tools/releasetools/ota_from_target_files -k ../../build/security/testkey -i ./ROM/target_files_"$3".zip ./ROM/target_files_"$2".zip ./ROM/ota_upate.zip
OTA=`random_number`
ZIP=`random_number`
mv ./ROM/ota_upate.zip ./ROM/miui-ota-"$1"-"$3"-"$2"-"$ZIP"-4.0.zip
if [ "$1" = "c8812" -o "$1" = "u8818" ]
then
echo -e "\E[32m use custom key \E[0m"
sign -g ./ROM/miui_"$1"_"$2"_"$OTA"_4.0.zip
sign -g ./ROM/miui-ota-"$1"-"$3"-"$2"-"$ZIP"-4.0.zip
fi
fi