diff --git a/scripts/Arch/Devices/Surface/install.sh b/scripts/Arch/Devices/Surface/install.sh index 7b774c12..6aa2a45f 100755 --- a/scripts/Arch/Devices/Surface/install.sh +++ b/scripts/Arch/Devices/Surface/install.sh @@ -11,6 +11,21 @@ sudo pacman-key --lsign-key 56C464BAAC421453; pacmanConf="/etc/pacman.conf"; +retry() { + retryCount="$1"; + command="${@:2}"; + exitCode=0; + + for i in $(seq 1 $retryCount); + do + eval "$command" && { + exitCode=0; + break; + }; + exitCode="$?"; + done; +} + if ! grep "^\[linux-surface\]$" "$pacmanConf" then { @@ -20,9 +35,12 @@ then } | sudo tee -a "$pacmanConf" > /dev/null; fi; -sudo pacman --noconfirm -Syu; +for i in $(seq 1 5); +do pacman --noconfirm -Syu && s=0 && break || s=$? && sleep 15; done; (exit $s) -sudo pacman --noconfirm -Sy \ +retry 5 sudo pacman --noconfirm -Syu; + +retry 5 sudo pacman --noconfirm -Sy \ intel-ucode \ linux-surface \ linux-surface-headers \