From cec74ff92cb9fad8ff507b71543f9c6b2186a7e8 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Mon, 26 Oct 2026 19:25:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=A7=A3=E5=8E=8Brootfs?= =?UTF-8?q?=E6=9B=BF=E4=BB=A3debootstrap,=E6=8F=90=E5=8D=87=E9=80=9F?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gfdgd_xi <3025613752@qq.com> --- ...nfigure-building-enviroment-base-system.sh | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/configure-building-enviroment-base-system.sh b/.github/workflows/configure-building-enviroment-base-system.sh index 799ac38..c4e2c47 100755 --- a/.github/workflows/configure-building-enviroment-base-system.sh +++ b/.github/workflows/configure-building-enviroment-base-system.sh @@ -21,9 +21,26 @@ function useLoongnix() { function useDeepin25() { sudo cp .github/workflows/crimson /usr/share/debootstrap/scripts/ -v } +function getRootfsFromCloudTar() { + # $1=suite(bookworm/trixie) $2=arch + local suite=$1 + local arch=$2 + local version + case "$suite" in + bookworm) version=12 ;; + trixie) version=13 ;; + *) return 1 ;; + esac + local tarball="debian-${version}-nocloud-${arch}.tar.xz" + local url="http://cdimage.debian.org/cdimage/cloud/${suite}/latest/${tarball}" + sudo rm -rf "$bottlePath" + sudo mkdir -p "$bottlePath" + wget -O "/tmp/${tarball}" "$url" + sudo tar -xJf "/tmp/${tarball}" -C "$bottlePath" +} sudo apt update -sudo apt install debootstrap rename binfmt-support qemu-user qemu-user-static git -y +sudo apt install debootstrap rename binfmt-support qemu-user qemu-user-static git xz-utils wget -y ls /usr/bin/qemu-* bottlePath=./system-bottle if [[ $2 == "beige" ]]; then @@ -35,11 +52,16 @@ else useLoongnix fi fi -if [[ $2 == "crimson" ]]; then - useDeepin25 - sudo debootstrap --no-check-gpg --include=git,deepin-keyring,gcc,make,g++,dpkg-dev,qtbase5-dev,ca-certificates --arch=$1 $2 $bottlePath $5 +if [[ $1 != "loong64" ]] && [[ $2 == "bookworm" || $2 == "trixie" ]]; then + # 非 loong64 的 bookworm/trixie 直接从官方云镜像 tar 解压,跳过 debootstrap + getRootfsFromCloudTar $2 $1 else - sudo debootstrap --no-check-gpg --include=git,gcc,make,debian-ports-archive-keyring,debian-archive-keyring,g++,dpkg-dev,qtbase5-dev,ca-certificates --arch=$1 $2 $bottlePath $5 + if [[ $2 == "crimson" ]]; then + useDeepin25 + sudo debootstrap --no-check-gpg --include=git,deepin-keyring,gcc,make,g++,dpkg-dev,qtbase5-dev,ca-certificates --arch=$1 $2 $bottlePath $5 + else + sudo debootstrap --no-check-gpg --include=git,gcc,make,debian-ports-archive-keyring,debian-archive-keyring,g++,dpkg-dev,qtbase5-dev,ca-certificates --arch=$1 $2 $bottlePath $5 + fi fi if [[ $2 == "crimson" ]]; then