Skip to content

Commit 48b3ea2

Browse files
committed
fix: detect package installed, pipefail friendly
1 parent 8ae5910 commit 48b3ea2

File tree

1 file changed

+2
-2
lines changed
  • ansible/files/admin_api_scripts/pg_upgrade_scripts

1 file changed

+2
-2
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,11 @@ function initiate_upgrade {
353353
# lsb release
354354
UBUNTU_VERSION=$(lsb_release -rs)
355355
# install amazon disk utilities if not present on 24.04
356-
if [ "${UBUNTU_VERSION}" = "24.04" ] && ! dpkg -l | grep -q amazon-ec2-utils; then
356+
if [ "${UBUNTU_VERSION}" = "24.04" ] && ! /usr/bin/dpkg-query -W amazon-ec2-utils >/dev/null 2>&1; then
357357
apt-get update
358358
apt-get install -y amazon-ec2-utils || true
359359
fi
360-
if command -v ebsnvme-id >/dev/null 2>&1 && dpkg -l | grep -q amazon-ec2-utils; then
360+
if command -v ebsnvme-id >/dev/null 2>&1 && /usr/bin/dpkg-query -W amazon-ec2-utils >/dev/null 2>&1; then
361361
for nvme_dev in $(lsblk -dprno name,size,mountpoint,type | grep disk | awk '{print $1}'); do
362362
if [ -b "$nvme_dev" ]; then
363363
mapping=$(ebsnvme-id -b "$nvme_dev" 2>/dev/null)

0 commit comments

Comments
 (0)