Common-utils: Fixes "No package jq available" errors for CentOS (#644)
* add checks for "jq" * install epel-release if necessary * clean up epel-release post installation of "jq"
This commit is contained in:
parent
8b6f088256
commit
f90cb26c7f
7 changed files with 21 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"id": "common-utils",
|
"id": "common-utils",
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"name": "Common Utilities",
|
"name": "Common Utilities",
|
||||||
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
|
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
|
||||||
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",
|
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",
|
||||||
|
|
|
@ -175,6 +175,11 @@ install_redhat_packages() {
|
||||||
man-db \
|
man-db \
|
||||||
strace"
|
strace"
|
||||||
|
|
||||||
|
local install_cmd=dnf
|
||||||
|
if ! type dnf > /dev/null 2>&1; then
|
||||||
|
install_cmd=yum
|
||||||
|
fi
|
||||||
|
|
||||||
# rockylinux:9 installs 'curl-minimal' which clashes with 'curl'
|
# rockylinux:9 installs 'curl-minimal' which clashes with 'curl'
|
||||||
# Install 'curl' for every OS except this rockylinux:9
|
# Install 'curl' for every OS except this rockylinux:9
|
||||||
if [[ "${ID}" = "rocky" ]] && [[ "${VERSION}" != *"9."* ]]; then
|
if [[ "${ID}" = "rocky" ]] && [[ "${VERSION}" != *"9."* ]]; then
|
||||||
|
@ -201,16 +206,23 @@ install_redhat_packages() {
|
||||||
package_list="${package_list} zsh"
|
package_list="${package_list} zsh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local install_cmd=dnf
|
# Install EPEL repository if needed (required to install 'jq' for CentOS)
|
||||||
if ! type dnf > /dev/null 2>&1; then
|
local remove_epel="false"
|
||||||
install_cmd=yum
|
if ! ${install_cmd} -q list jq >/dev/null 2>&1; then
|
||||||
|
${install_cmd} -y install epel-release
|
||||||
|
remove_epel="true"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${install_cmd} -y install ${package_list}
|
${install_cmd} -y install ${package_list}
|
||||||
|
|
||||||
# Get to latest versions of all packages
|
# Get to latest versions of all packages
|
||||||
if [ "${UPGRADE_PACKAGES}" = "true" ]; then
|
if [ "${UPGRADE_PACKAGES}" = "true" ]; then
|
||||||
${install_cmd} upgrade -y
|
${install_cmd} upgrade -y
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${remove_epel}" = "true" ]]; then
|
||||||
|
${install_cmd} -y remove epel-release
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Alpine Linux packages
|
# Alpine Linux packages
|
||||||
|
|
|
@ -9,6 +9,7 @@ source dev-container-features-test-lib
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
check "non-root user" test "$(whoami)" = "devcontainer"
|
check "non-root user" test "$(whoami)" = "devcontainer"
|
||||||
check "distro" test "${VERSION_ID}" = "7"
|
check "distro" test "${VERSION_ID}" = "7"
|
||||||
|
check "jq" jq --version
|
||||||
|
|
||||||
# Report result
|
# Report result
|
||||||
reportResults
|
reportResults
|
|
@ -9,6 +9,7 @@ source dev-container-features-test-lib
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
check "non-root user" test "$(whoami)" = "devcontainer"
|
check "non-root user" test "$(whoami)" = "devcontainer"
|
||||||
check "distro" test "${ID}" = "fedora"
|
check "distro" test "${ID}" = "fedora"
|
||||||
|
check "jq" jq --version
|
||||||
|
|
||||||
# Report result
|
# Report result
|
||||||
reportResults
|
reportResults
|
|
@ -9,6 +9,7 @@ source dev-container-features-test-lib
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
check "non-root user" test "$(whoami)" = "devcontainer"
|
check "non-root user" test "$(whoami)" = "devcontainer"
|
||||||
check "distro" test "${ID}" = "mariner"
|
check "distro" test "${ID}" = "mariner"
|
||||||
|
check "jq" jq --version
|
||||||
|
|
||||||
# Report result
|
# Report result
|
||||||
reportResults
|
reportResults
|
|
@ -10,6 +10,7 @@ source dev-container-features-test-lib
|
||||||
check "non-root user" test "$(whoami)" = "devcontainer"
|
check "non-root user" test "$(whoami)" = "devcontainer"
|
||||||
check "distro" test "${PLATFORM_ID}" = "platform:el8"
|
check "distro" test "${PLATFORM_ID}" = "platform:el8"
|
||||||
check "curl" curl --version
|
check "curl" curl --version
|
||||||
|
check "jq" jq --version
|
||||||
|
|
||||||
# Report result
|
# Report result
|
||||||
reportResults
|
reportResults
|
|
@ -10,6 +10,7 @@ source dev-container-features-test-lib
|
||||||
check "non-root user" test "$(whoami)" = "devcontainer"
|
check "non-root user" test "$(whoami)" = "devcontainer"
|
||||||
check "distro" test "${PLATFORM_ID}" = "platform:el9"
|
check "distro" test "${PLATFORM_ID}" = "platform:el9"
|
||||||
check "curl" curl --version
|
check "curl" curl --version
|
||||||
|
check "jq" jq --version
|
||||||
|
|
||||||
# Report result
|
# Report result
|
||||||
reportResults
|
reportResults
|
Loading…
Reference in a new issue