Skip to content

Commit bccfcbc

Browse files
committed
[common-utils] - Corrections in the installation of jq
1 parent eea561a commit bccfcbc

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/common-utils/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "common-utils",
3-
"version": "2.5.4",
3+
"version": "2.5.5",
44
"name": "Common Utilities",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
66
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",

src/common-utils/main.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ install_redhat_packages() {
172172
else
173173
echo "Unable to find 'tdnf', 'dnf', or 'yum' package manager. Exiting."
174174
exit 1
175-
fi
175+
fi
176176

177177
if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
178178
package_list="${package_list} \
@@ -228,7 +228,7 @@ fi
228228
fi
229229

230230
# Install EPEL repository if needed (required to install 'jq' for CentOS)
231-
if ! ${install_cmd} -q list jq >/dev/null 2>&1; then
231+
if [[ "${ID}" = "centos" ]] && ! rpm -q jq >/dev/null 2>&1; then
232232
${install_cmd} -y install epel-release
233233
remove_epel="true"
234234
fi
@@ -240,11 +240,18 @@ fi
240240
fi
241241

242242
if [ -n "${package_list}" ]; then
243-
${install_cmd} -y install ${package_list}
243+
echo "Packages to verify are installed: ${package_list}"
244+
echo "Running ${install_cmd} install..."
245+
if [ "${install_cmd}" = "dnf" ]; then
246+
${install_cmd} -y install --allowerasing ${package_list}
247+
else
248+
${install_cmd} -y install ${package_list}
249+
fi
244250
fi
245251

246252
# Get to latest versions of all packages
247253
if [ "${UPGRADE_PACKAGES}" = "true" ]; then
254+
echo "Running ${install_cmd} upgrade..."
248255
${install_cmd} upgrade -y
249256
fi
250257

0 commit comments

Comments
 (0)