Skip to content

Commit

Permalink
Merge pull request #244 from aws-samples/smhp-dpkg-retry
Browse files Browse the repository at this point in the history
smhp: retry hold-package when dpkg frontend is locked
  • Loading branch information
verdimrc authored Apr 5, 2024
2 parents ce37801 + 746be4b commit 6bc1417
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@

set -exuo pipefail

dpkg_hold_with_retry() {
# Retry when dpkg frontend is locked
for (( i=0; i<=20; i++ )); do
echo "$1 hold" | sudo dpkg --set-selections && break || { echo To retry... ; sleep 6 ; }
done
}

# Don't let new lustre client module brings in new kernel.
echo "lustre-client-modules-aws hold" | sudo dpkg --set-selections
dpkg_hold_with_retry lustre-client-modules-aws
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@ apt-cache show ${MOCK_PKG}=${DRV_VERSION}-0ubuntu1 \
&> ${MOCK_PKG}

equivs-build ${MOCK_PKG}
dpkg -i ${MOCK_PKG}_*.deb
echo "${MOCK_PKG} hold" | sudo dpkg --set-selections
apt install -y -o DPkg::Lock::Timeout=120 ./${MOCK_PKG}_*.deb

dpkg_hold_with_retry() {
# Retry when dpkg frontend is locked
for (( i=0; i<=20; i++ )); do
echo "$1 hold" | sudo dpkg --set-selections && break || { echo To retry... ; sleep 6 ; }
done
}
dpkg_hold_with_retry ${MOCK_PKG}

0 comments on commit 6bc1417

Please sign in to comment.