更新到双剑镜像
启动到幽兰现有的LINUX系统,Ctrl + Alt + T打开一个控制台窗口,然后执行如下命令:
wget https://gedu.oss-cn-beijing.aliyuncs.com/Products/YourLand/Release/ShuangJian1/update.sh
chmod +x update.sh
sudo ./update.sh
附:脚本代码:
#!/bin/bash
NorFlash="/dev/mtdblock0"
NVME="/dev/nvme0n1"
UrlBase="https://gedu.oss-cn-beijing.aliyuncs.com/Products/YourLand/Release"
Version="ShuangJian1"
UefiImg="UEFI.img"
YourLandImage="YourLand.img"
echo_with_color() {
echo -e "$1 $2\e[0m"
}
update_failed() {
echo_with_color "\e[41m" "update failed"
exit -1
}
pre_cmd_status_check() {
if [ "$?" -eq 0 ]; then
echo_with_color "\e[42m" "$1 success"
else
update_failed
fi
}
download_file() {
wget "$UrlBase/$Version/$1"
pre_cmd_status_check "download file $1"
if [ "$1" == "$YourLandImage" ]; then
echo_with_color "\e[33m" "will unzip $1"
mv "$1" "$1.gz"
gunzip "$1.gz"
pre_cmd_status_check "unzip"
fi
}
check_file_is_exist() {
if [ -e "$1" ]; then
echo_with_color "\e[33m" "the file ["$1"] is exist"
else
echo_with_color "\e[44m" "the file ["$1"] does not exist, will download"
download_file $1
fi
}
update_img() {
check_file_is_exist "$1"
check_file_is_exist "$2"
echo_with_color "\e[33m" "complete the file verification, will update image"
dd if="$1" of="$2" status=progress
pre_cmd_status_check "dd $1 to $2"
sync
}
resize_part() {
echo_with_color "\e[33m" "will resize nvme0n1p2"
echo_with_color "\e[33m" "enter [Fix] or [Yes], when you see [Waring: xxxx]"
parted -f /dev/nvme0n1 resizepart 2 487332M
resize2fs /dev/nvme0n1p2
}
update_img "$YourLandImage" "$NVME"
update_img "$UefiImg" "$NorFlash"
resize_part
sync
exit 0
作者:Zhang Yinkui 创建时间:2024-03-18 10:07
最后编辑:Zhang Yinkui 更新时间:2024-05-06 17:42
最后编辑:Zhang Yinkui 更新时间:2024-05-06 17:42