From 08f33c33c738a09f2f64ef373bb70290bb876aa3 Mon Sep 17 00:00:00 2001 From: hygienic-books Date: Sat, 28 Dec 2024 16:33:13 +0100 Subject: [PATCH] refactor(os): Retry pacman download on fail --- setup.sh | 55 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/setup.sh b/setup.sh index 8630a5d..fe8ce73 100644 --- a/setup.sh +++ b/setup.sh @@ -429,12 +429,18 @@ function update_pacman_db () { systemctl start reflector # In an ISO and for the minimal number of packages we need we do not # care about partial upgrades - pacman -Syyuu --noconfirm + while ! pacman -Syyuu --needed --noconfirm --downloadonly; do + sleep 5 + done + pacman -Syyuu --needed --noconfirm } function install_pkgs () { #1.5 printf -- '%s\n' 'Installing packages ...' + while ! pacman -S --needed --noconfirm --downloadonly "${@}"; do + sleep 5 + done pacman -S --needed --noconfirm "${@}" } @@ -763,27 +769,29 @@ function install_archlinux () { #1.12 pacman_dl_parallel pacman_dont_check_space - pacstrap /mnt \ - base \ - base-devel \ - linux \ - linux-headers \ - linux-firmware \ - amd-ucode \ - efibootmgr \ - vim \ - git \ - iwd \ - networkmanager \ - network-manager-applet \ - dialog \ - os-prober \ - reflector \ - bluez \ - bluez-utils \ - man-db \ - xdg-utils \ - xdg-user-dirs + while ! pacstrap /mnt \ + base \ + base-devel \ + linux \ + linux-headers \ + linux-firmware \ + amd-ucode \ + efibootmgr \ + vim \ + git \ + iwd \ + networkmanager \ + network-manager-applet \ + dialog \ + os-prober \ + reflector \ + bluez \ + bluez-utils \ + man-db \ + xdg-utils \ + xdg-user-dirs; do + sleep 5 + done } function gen_fstab () { @@ -1295,6 +1303,9 @@ function install_os_in_chroot () { rm -rf '/etc/pacman.d/gnupg' pacman-key --init pacman-key --populate archlinux + while ! pacman -S archlinux-keyring --noconfirm --downloadonly; do + sleep 5 + done pacman -S archlinux-keyring --noconfirm locale-gen