commit 1bcde9094de6e36d60559d1520899ed29f80aee1 equwal <13551856+equwal@users.noreply.github.com> 2026-10-04 02:15:38 -0700 Download base and Nix tarballs to disk with retries A stalled TLS stream cut the Gentoo stage3 pipe mid-way; curl now retries and resumes before tar reads the file.
backends/arch.sh | 4 ++-- backends/gentoo.sh | 2 +- backends/kiss.sh | 4 ++-- install.sh | 7 ++++++- 4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/backends/arch.sh b/backends/arch.sh index 5668797..886285e 100644 --- a/backends/arch.sh +++ b/backends/arch.sh @@ -3,8 +3,8 @@ # shellcheck shell=sh disable=SC2034 ARCH_MIRROR=${ARCH_MIRROR:-https://geo.mirror.pkgbuild.com} bootstrap() { - curl -fsSL "$ARCH_MIRROR/iso/latest/archlinux-bootstrap-x86_64.tar.zst" | - zstd -dc | tar -x -C $M --strip-components=1 --numeric-owner + f=$(fetch "$ARCH_MIRROR/iso/latest/archlinux-bootstrap-x86_64.tar.zst") + zstd -dc "$f" | tar -x -C $M --strip-components=1 --numeric-owner && rm "$f" echo "Server = $ARCH_MIRROR/\$repo/os/\$arch" > $M/etc/pacman.d/mirrorlist sed -i 's/^CheckSpace/#CheckSpace/' $M/etc/pacman.conf # / is not a mount point in the chroot chroot_mounts diff --git a/backends/gentoo.sh b/backends/gentoo.sh index 4d49eb9..9c4bcc5 100644 --- a/backends/gentoo.sh +++ b/backends/gentoo.sh @@ -7,7 +7,7 @@ E="emerge --quiet --getbinpkgonly --usepkgonly --noreplace" bootstrap() { b=$GENTOO_MIRROR/releases/amd64/autobuilds f=$(curl -fsSL "$b/latest-stage3-amd64-desktop-openrc.txt" | grep -o '^[^# ]*stage3[^ ]*\.tar\.xz' | head -1) - curl -fsSL "$b/$f" | tar -xJp -C $M --xattrs-include='*.*' --numeric-owner + f=$(fetch "$b/$f") && tar -xJpf "$f" -C $M --xattrs-include='*.*' --numeric-owner && rm "$f" chroot_mounts printf 'FEATURES="getbinpkg binpkg-request-signature"\nACCEPT_LICENSE="*"\n' >> $M/etc/portage/make.conf mkdir -p $M/etc/portage/package.use $M/etc/dracut.conf.d diff --git a/backends/kiss.sh b/backends/kiss.sh index 4aac9b6..9eaaeeb 100644 --- a/backends/kiss.sh +++ b/backends/kiss.sh @@ -6,8 +6,8 @@ bootstrap() { v=$(curl -fsSL https://api.github.com/repos/kisslinux/repo/releases/latest | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p') - curl -fsSL "https://github.com/kisslinux/repo/releases/download/$v/kiss-chroot-$v.tar.xz" | - tar -xJ -C $M --numeric-owner + f=$(fetch "https://github.com/kisslinux/repo/releases/download/$v/kiss-chroot-$v.tar.xz") + tar -xJf "$f" -C $M --numeric-owner && rm "$f" chroot_mounts ch "git clone -q https://github.com/kisslinux/repo /var/db/kiss/repo" ch "KISS_PATH=/var/db/kiss/repo/core KISS_PROMPT=0 kiss build baseinit" >/dev/null diff --git a/install.sh b/install.sh index e276d48..8819dee 100644 --- a/install.sh +++ b/install.sh @@ -46,6 +46,11 @@ menu() { # menu VAR "prompt" choice...: numbered menu unless VAR is set } in_list() { case " $2 " in *" $1 "*) return 0 ;; esac; return 1; } ch() { chroot $M /bin/sh -c "$*"; } +fetch() { # fetch URL: download into $M/tmp with retries (resumes), print the path + mkdir -p $M/tmp; f=$M/tmp/${1##*/} + curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 -C - -o "$f" "$1" || curl -fsSL --retry 5 -o "$f" "$1" + echo "$f" +} # --- questions ----------------------------------------------------------- menu BASE "base system" $BASES @@ -159,7 +164,7 @@ if ! nix_native; then NV=$(curl -fsSL https://nixos.org/nix/install | grep -o 'releases.nixos.org/nix/nix-[0-9.]*[0-9]' | head -1) NV=${NV##*/nix-} T=/tmp/nix-$NV-x86_64-linux - curl -fsSL "https://releases.nixos.org/nix/nix-$NV/nix-$NV-x86_64-linux.tar.xz" | tar -xJ -C $M/tmp + f=$(fetch "https://releases.nixos.org/nix/nix-$NV/nix-$NV-x86_64-linux.tar.xz") && tar -xJf "$f" -C $M/tmp && rm "$f" mkdir -p $M/nix/store $M/nix/var/nix/profiles/per-user $M/nix/var/nix/gcroots mv $M$T/store/* $M/nix/store/ NIX=$(cd $M/nix/store && ls -d ./*-nix-"$NV" | head -1); NIX=/nix/store/${NIX#./}