从秀峰更新到双剑1镜像

2024-5-8日更新:
本文档描述的是从秀峰镜像更新到双剑1版本,双剑2镜像发布后,建议直接升级到双剑2或者更新的版本,本文仅作归档和参考

在本篇文档中,将提供两种方法安装双剑1。

方法一:

使用脚本自动安装:
启动到幽兰现有的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

方法二:

如果当前机器无法联网,可以在别的机器先将镜像下载下来,点击下载UEFI.img点击下载YourLand.img拷贝到移动硬盘上,注意,YourLand.img刚下载过来大小为5G,需要解压一下才行,然后采用手动dd的方法更新:

##下载
wget https://gedu.oss-cn-beijing.aliyuncs.com/Products/YourLand/Release/ShuangJian1/UEFI.img
wget https://gedu.oss-cn-beijing.aliyuncs.com/Products/YourLand/Release/ShuangJian1/YourLand.img

##解压
mv YourLand.img YourLand.gz
gunzip YourLand.gz
mv Yourland_1.0.8_ubuntu_yourland_desktop_gnome_linux5.10.110.img YourLand.img       ##以实际解压的文件名为准

#使用dd更新过去
sudo dd if=UEFI.img of=/dev/mtdblock0 status=progress
sudo dd if=YourLand.img of=/dev/nvme0n1 status=progress
作者:李宜桐  创建时间:2024-03-18 10:07
最后编辑:zuoyingying  更新时间:2024-11-15 17:44