Skip to content

Commit

Permalink
Add re-try logic for linux-surface packages
Browse files Browse the repository at this point in the history
Even though linux-surface packages are distributed via GitHub (the
repository redirects to GitHub releases for package file downloads),
downloads sporadically fail with as of yet unknown reason. Therefore,
work around this by adding some re-try logic.
  • Loading branch information
qzed committed Jul 23, 2023
1 parent bc088f2 commit 7977e69
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
23 changes: 23 additions & 0 deletions lib/modules/linux-surface.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#!/usr/bin/env bash

__pacman_install_retry() {
for i in {1..5}; do
if pacman --noconfirm -S "${@}"; then
break
fi

local n=$((5 * 2**i))

echo "failed to install ${*}, trying again in $n seconds"
sleep $n
done
}

setup() {
_msg2 "Adding linux-surface repository..."

Expand All @@ -18,4 +31,14 @@ EOF

# update
pacman --noconfirm -Syu

# WORKAROUND: This is a workaround for an issue with GitHub CI. Normally,
# we would install these packages together with the other packages via the
# packages/install file, however, when running in CI on GitHub, pacman
# regularly fails to download the package files for some reason. We have
# not yet figured out why, so as a workaround install the problematic
# packages here. If the download/installation fails, wait for a bit and try
# again, up to 5 times before giving up.
__pacman_install_retry linux-firmware-msft-surface-pro-x linux-firmware-msft-surface-pro-x-qcom
__pacman_install_retry linux-surface linux-surface-headers
}
4 changes: 0 additions & 4 deletions profiles/default/packages/install
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
base
base-devel
linux-surface
linux-surface-headers
linux-firmware-msft-surface-pro-x
linux-firmware-msft-surface-pro-x-qcom
git
wget
iwd
Expand Down

0 comments on commit 7977e69

Please sign in to comment.