-
Notifications
You must be signed in to change notification settings - Fork 4
/
uboot.sh
60 lines (59 loc) · 1.81 KB
/
uboot.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
###
# @Author: ttimochan
# @Date: 2022-12-21 22:09:11
# @LastEditors: ttimochan
# @LastEditTime: 2023-9-9 18:09:14
# @FilePath: /unlock-redmi-ax6000/uboot.sh
###
#!/bin/bash
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root user"
exit 1
fi
download_file(){
echo "Copyright"
echo "======================"
echo "Official blog: https://www.miaoer.xyz/posts/network/flash-redmi-ax6000"
echo "Read more at: miaoer.xyz"
echo "======================"
echo " "
cd /tmp
curl -O https://fastly.jsdelivr.net/gh/miaoermua/unlock-redmi-ax6000@main/mt7986_redmi_ax6000-fip-fixed-parts.bin
if [ ! -f mt7986_redmi_ax6000-fip-fixed-parts.bin ]; then
echo "Error: mt7986_redmi_ax6000-fip-fixed-parts.bin download failed"
exit 1
fi
}
check_file(){
if [ $(md5sum mt7986_redmi_ax6000-fip-fixed-parts.bin | awk '{print $1}') != "7610a1722073748c3c3a860b75d94d5d" ]; then
echo "Error: mt7986_redmi_ax6000-fip-fixed-parts.bin md5 is not correct"
exit 1
fi
}
backup(){
dd if=/dev/mtd4 of=/tmp/mtd4_Factory.bin
dd if=/dev/mtd5 of=/tmp/mtd5_FIP.bin
}
rm_self(){
dir=$(pwd)
file=$(basename $0)
rm -rf $dir/$file
}
main(){
download_file
check_file
echo -e "\033[32mdownload file and check file success\033[0m"
backup
if [ ! -f /tmp/mtd4_Factory.bin ] || [ ! -f /tmp/mtd5_FIP.bin ]; then
echo "Error: backup failed"
exit 1
fi
echo "\033[32mSuccess!"
echo "======================"
echo -e "\033[31mBackup success! Please use SCP tool to download to your computer \033[0m"
echo -e "\033[31mFactory: /tmp/mtd4_Factory.bin \033[0m"
echo -e "\033[31mFIP: /tmp/mtd5_FIP.bin \033[0m"
echo -e "\033[31mThis shell script will rm self \033[0m"
rm_self
}
main