aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Spicer <joshspicer@github.com>2022-08-23 16:17:08 +0300
committerGitHub <noreply@github.com>2022-08-23 16:17:08 +0300
commit0cafeee86296b9f19e6425055e0c4037eff41985 (patch)
tree1320a7b4c79a9a676e30632117bbd5a955b673ba
parent58e425039a1dc78cde64e9c1939e2a3dfed6d22a (diff)
favor correctness by removing `apt update ...` short-circuiting (#98)
* favor correctness by removing apt update shortciruiting * Update install.sh * apt_get_upadate in node * update test
-rwxr-xr-xsrc/anaconda/install.sh2
-rwxr-xr-xsrc/aws-cli/install.sh13
-rwxr-xr-xsrc/azure-cli/install.sh15
-rwxr-xr-xsrc/common-utils/install.sh17
-rwxr-xr-xsrc/desktop-lite/install.sh16
-rwxr-xr-xsrc/docker-from-docker/install.sh19
-rwxr-xr-xsrc/docker-in-docker/install.sh17
-rwxr-xr-xsrc/dotnet/install.sh14
-rwxr-xr-xsrc/git-lfs/install.sh15
-rwxr-xr-xsrc/git/install.sh13
-rwxr-xr-xsrc/github-cli/install.sh15
-rwxr-xr-xsrc/go/install.sh15
-rwxr-xr-xsrc/hugo/install.sh13
-rwxr-xr-xsrc/java/install.sh13
-rwxr-xr-xsrc/kubectl-helm-minikube/install.sh15
-rwxr-xr-xsrc/node/install.sh16
-rwxr-xr-xsrc/oryx/install.sh17
-rwxr-xr-xsrc/powershell/install.sh15
-rwxr-xr-xsrc/python/install.sh15
-rwxr-xr-xsrc/ruby/install.sh15
-rwxr-xr-xsrc/rust/install.sh15
-rwxr-xr-xsrc/sshd/install.sh8
-rwxr-xr-xsrc/terraform/install.sh15
-rwxr-xr-xtest/dotnet/test.sh3
24 files changed, 116 insertions, 215 deletions
diff --git a/src/anaconda/install.sh b/src/anaconda/install.sh
index 750077e..9e7042a 100755
--- a/src/anaconda/install.sh
+++ b/src/anaconda/install.sh
@@ -64,7 +64,7 @@ updaterc() {
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt-get update
+ apt-get update -y
apt-get -y install --no-install-recommends "$@"
fi
}
diff --git a/src/aws-cli/install.sh b/src/aws-cli/install.sh
index b2566c9..4ab2234 100755
--- a/src/aws-cli/install.sh
+++ b/src/aws-cli/install.sh
@@ -62,21 +62,16 @@ get_common_setting() {
echo "$1=${!1}"
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
diff --git a/src/azure-cli/install.sh b/src/azure-cli/install.sh
index 2c3c1c5..6518f6c 100755
--- a/src/azure-cli/install.sh
+++ b/src/azure-cli/install.sh
@@ -35,21 +35,16 @@ get_common_setting() {
echo "$1=${!1}"
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -127,7 +122,7 @@ install_using_apt() {
install_using_pip() {
echo "(*) No pre-built binaries available in apt-cache. Installing via pip3."
if ! dpkg -s python3-minimal python3-pip libffi-dev python3-venv > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install python3-minimal python3-pip libffi-dev python3-venv
fi
export PIPX_HOME=/usr/local/pipx
diff --git a/src/common-utils/install.sh b/src/common-utils/install.sh
index c6d9cf8..46e285b 100755
--- a/src/common-utils/install.sh
+++ b/src/common-utils/install.sh
@@ -60,15 +60,10 @@ fi
# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive
-# Function to call apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Run install apt-utils to avoid debconf warning then verify presence of other common developer tools and dependencies
@@ -134,7 +129,7 @@ if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
apt-get update
package_list="${package_list} manpages-posix manpages-posix-dev"
else
- apt_get_update_if_needed
+ apt_get_update
fi
# Install libssl1.1 if available
@@ -167,7 +162,7 @@ fi
# Get to latest versions of all packages
if [ "${UPGRADE_PACKAGES}" = "true" ]; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y upgrade --no-install-recommends
apt-get autoremove -y
fi
@@ -366,7 +361,7 @@ fi
# Optionally install and configure zsh and Oh My Zsh!
if [ "${INSTALL_ZSH}" = "true" ]; then
if ! type zsh > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get install -y zsh
fi
if [ "${ZSH_ALREADY_INSTALLED}" != "true" ]; then
diff --git a/src/desktop-lite/install.sh b/src/desktop-lite/install.sh
index 806a7e1..b05896c 100755
--- a/src/desktop-lite/install.sh
+++ b/src/desktop-lite/install.sh
@@ -149,22 +149,16 @@ copy_fluxbox_config() {
fi
}
-
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -176,7 +170,7 @@ check_packages() {
# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive
-apt_get_update_if_needed
+apt_get_update
# On older Ubuntu, Tilix is in a PPA. on Debian strech its in backports.
if [[ -z $(apt-cache --names-only search ^tilix$) ]]; then
diff --git a/src/docker-from-docker/install.sh b/src/docker-from-docker/install.sh
index 6e45865..312e283 100755
--- a/src/docker-from-docker/install.sh
+++ b/src/docker-from-docker/install.sh
@@ -59,21 +59,16 @@ get_common_setting() {
echo "$1=${!1}"
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -118,7 +113,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install dependencies
check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install git
fi
@@ -212,7 +207,7 @@ else
if [ "${TARGET_COMPOSE_ARCH}" != "x86_64" ]; then
# Use pip to get a version that runns on this architecture
if ! dpkg -s python3-minimal python3-pip libffi-dev python3-venv > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install python3-minimal python3-pip libffi-dev python3-venv
fi
export PIPX_HOME=/usr/local/pipx
@@ -287,7 +282,7 @@ DOCKER_GID="$(grep -oP '^docker:x:\K[^:]+' /etc/group)"
# If enabling non-root access and specified user is found, setup socat and add script
chown -h "${USERNAME}":root "${TARGET_SOCKET}"
if ! dpkg -s socat > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install socat
fi
tee /usr/local/share/docker-init.sh > /dev/null \
diff --git a/src/docker-in-docker/install.sh b/src/docker-in-docker/install.sh
index 477b7a4..a67aaba 100755
--- a/src/docker-in-docker/install.sh
+++ b/src/docker-in-docker/install.sh
@@ -69,21 +69,16 @@ get_common_setting() {
echo "$1=${!1}"
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -158,7 +153,7 @@ fi
# Install dependencies
check_packages apt-transport-https curl ca-certificates pigz iptables gnupg2 dirmngr
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install git
fi
@@ -254,7 +249,7 @@ else
if [ "${target_compose_arch}" != "x86_64" ]; then
# Use pip to get a version that runs on this architecture
if ! dpkg -s python3-minimal python3-pip libffi-dev python3-venv > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install python3-minimal python3-pip libffi-dev python3-venv
fi
export PIPX_HOME=/usr/local/pipx
diff --git a/src/dotnet/install.sh b/src/dotnet/install.sh
index 7cf38f1..f8231ac 100755
--- a/src/dotnet/install.sh
+++ b/src/dotnet/install.sh
@@ -107,20 +107,16 @@ updaterc() {
fi
}
-# Run apt-get if needed.
-apt_get_update_if_needed() {
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+apt_get_update()
+{
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Check if packages are installed and installs them if not.
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
diff --git a/src/git-lfs/install.sh b/src/git-lfs/install.sh
index 03e22e5..d88a379 100755
--- a/src/git-lfs/install.sh
+++ b/src/git-lfs/install.sh
@@ -105,21 +105,16 @@ receive_gpg_keys() {
fi
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -183,7 +178,7 @@ export DEBIAN_FRONTEND=noninteractive
. /etc/os-release
check_packages curl ca-certificates gnupg2 dirmngr apt-transport-https
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends git
fi
if [ "${ID}" = "debian" ]; then
diff --git a/src/git/install.sh b/src/git/install.sh
index 1da6500..7e6f71a 100755
--- a/src/git/install.sh
+++ b/src/git/install.sh
@@ -74,21 +74,16 @@ receive_gpg_keys() {
fi
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
diff --git a/src/github-cli/install.sh b/src/github-cli/install.sh
index 4fea41b..689a816 100755
--- a/src/github-cli/install.sh
+++ b/src/github-cli/install.sh
@@ -138,21 +138,16 @@ receive_gpg_keys() {
fi
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -162,7 +157,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install curl, apt-transport-https, curl, gpg, or dirmngr, git if missing
check_packages curl ca-certificates apt-transport-https dirmngr gnupg2
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends git
fi
diff --git a/src/go/install.sh b/src/go/install.sh
index e524e26..e50c024 100755
--- a/src/go/install.sh
+++ b/src/go/install.sh
@@ -107,21 +107,16 @@ get_common_setting() {
echo "$1=${!1}"
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -131,7 +126,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install curl, tar, git, other dependencies if missing
check_packages curl ca-certificates gnupg2 tar g++ gcc libc6-dev make pkg-config
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends git
fi
diff --git a/src/hugo/install.sh b/src/hugo/install.sh
index f7ab7a2..0ccc294 100755
--- a/src/hugo/install.sh
+++ b/src/hugo/install.sh
@@ -61,21 +61,16 @@ updaterc() {
fi
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
diff --git a/src/java/install.sh b/src/java/install.sh
index 1f7da33..03cf2f2 100755
--- a/src/java/install.sh
+++ b/src/java/install.sh
@@ -62,21 +62,16 @@ updaterc() {
fi
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
diff --git a/src/kubectl-helm-minikube/install.sh b/src/kubectl-helm-minikube/install.sh
index b10f578..e9993a1 100755
--- a/src/kubectl-helm-minikube/install.sh
+++ b/src/kubectl-helm-minikube/install.sh
@@ -100,21 +100,16 @@ find_version_from_git_tags() {
echo "${variable_name}=${!variable_name}"
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -125,7 +120,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install dependencies
check_packages curl ca-certificates coreutils gnupg2 dirmngr bash-completion
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends git
fi
diff --git a/src/node/install.sh b/src/node/install.sh
index 80731cd..8eae62e 100755
--- a/src/node/install.sh
+++ b/src/node/install.sh
@@ -61,21 +61,15 @@ updaterc() {
fi
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
-{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+apt_get_update() {
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -186,7 +180,7 @@ if [ "${INSTALL_TOOLS_FOR_NODE_GYP}" = "true" ]; then
to_install="${to_install} python3-minimal"
fi
if [ ! -z "${to_install}" ]; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install ${to_install}
fi
fi
diff --git a/src/oryx/install.sh b/src/oryx/install.sh
index a528ec7..342a723 100755
--- a/src/oryx/install.sh
+++ b/src/oryx/install.sh
@@ -51,29 +51,24 @@ function updaterc() {
fi
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
- apt-get -y install --no-install-recommends "$@"
+ apt_get_update
+ DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends "$@"
fi
}
install_dotnet_using_apt() {
echo "Attempting to auto-install dotnet..."
install_from_microsoft_feed=false
- apt_get_update_if_needed
+ apt_get_update
apt-get -yq install dotnet6 || install_from_microsoft_feed="true"
if [ "${install_from_microsoft_feed}" = "true" ]; then
diff --git a/src/powershell/install.sh b/src/powershell/install.sh
index e686ecc..328ae93 100755
--- a/src/powershell/install.sh
+++ b/src/powershell/install.sh
@@ -72,21 +72,16 @@ get_common_setting() {
echo "$1=${!1}"
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -123,7 +118,7 @@ install_using_github() {
# Fall back on direct download if no apt package exists in microsoft pool
check_packages curl ca-certificates gnupg2 dirmngr libc6 libgcc1 libgssapi-krb5-2 libstdc++6 libunwind8 libuuid1 zlib1g libicu[0-9][0-9]
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get install -y --no-install-recommends git
fi
if [ "${architecture}" = "amd64" ]; then
diff --git a/src/python/install.sh b/src/python/install.sh
index e9f95c6..b1a75d9 100755
--- a/src/python/install.sh
+++ b/src/python/install.sh
@@ -197,21 +197,16 @@ oryx_install() {
fi
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -237,7 +232,7 @@ install_from_source() {
libbz2-dev libreadline-dev libxml2-dev xz-utils libgdbm-dev tk-dev dirmngr \
libxmlsec1-dev libsqlite3-dev libffi-dev liblzma-dev uuid-dev
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends git
fi
diff --git a/src/ruby/install.sh b/src/ruby/install.sh
index ec080c5..62a096b 100755
--- a/src/ruby/install.sh
+++ b/src/ruby/install.sh
@@ -152,21 +152,16 @@ find_version_from_git_tags() {
echo "${variable_name}=${!variable_name}"
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -185,7 +180,7 @@ check_packages curl ca-certificates software-properties-common build-essential g
procps dirmngr gawk autoconf automake bison libffi-dev libgdbm-dev libncurses5-dev \
libsqlite3-dev libtool libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libssl-dev
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends git
fi
diff --git a/src/rust/install.sh b/src/rust/install.sh
index a84716c..d8d3b74 100755
--- a/src/rust/install.sh
+++ b/src/rust/install.sh
@@ -125,22 +125,17 @@ updaterc() {
fi
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
export DEBIAN_FRONTEND=noninteractive
# Install curl, lldb, python3-minimal,libpython and rust dependencies if missing
if ! dpkg -s curl ca-certificates gnupg2 lldb python3-minimal gcc libc6-dev > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends curl ca-certificates gcc libc6-dev
apt-get -y install lldb python3-minimal libpython3.?
fi
@@ -175,7 +170,7 @@ else
if [ "${RUST_VERSION}" != "latest" ] && [ "${RUST_VERSION}" != "lts" ] && [ "${RUST_VERSION}" != "stable" ]; then
# Find version using soft match
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends git
fi
diff --git a/src/sshd/install.sh b/src/sshd/install.sh
index e02ef92..25b8859 100755
--- a/src/sshd/install.sh
+++ b/src/sshd/install.sh
@@ -39,10 +39,16 @@ elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
USERNAME=root
fi
+apt_get_update()
+{
+ echo "Running apt-get update..."
+ apt-get update -y
+}
+
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt-get update -y
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
diff --git a/src/terraform/install.sh b/src/terraform/install.sh
index 3368374..358b8b2 100755
--- a/src/terraform/install.sh
+++ b/src/terraform/install.sh
@@ -122,21 +122,16 @@ find_version_from_git_tags() {
echo "${variable_name}=${!variable_name}"
}
-# Function to run apt-get if needed
-apt_get_update_if_needed()
+apt_get_update()
{
- if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
- echo "Running apt-get update..."
- apt-get update
- else
- echo "Skipping apt-get update."
- fi
+ echo "Running apt-get update..."
+ apt-get update -y
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
@@ -147,7 +142,7 @@ export DEBIAN_FRONTEND=noninteractive
# Install dependencies if missing
check_packages curl ca-certificates gnupg2 dirmngr coreutils unzip
if ! type git > /dev/null 2>&1; then
- apt_get_update_if_needed
+ apt_get_update
apt-get -y install --no-install-recommends git
fi
diff --git a/test/dotnet/test.sh b/test/dotnet/test.sh
index 4e8281b..a16f91d 100755
--- a/test/dotnet/test.sh
+++ b/test/dotnet/test.sh
@@ -8,9 +8,10 @@ source dev-container-features-test-lib
# Definition specific tests
check "dotnet" dotnet --info
check "sdks" dotnet --list-sdks
+check "version" dotnet --version
echo "Validating expected version present..."
-check "some major version of dotnet 6 is installed" dotnet --list-sdks | grep '6\.[0-9]*\.[0-9]*'
+check "some major version of dotnet 6 is installed" dotnet --version | grep '6\.[0-9]*\.[0-9]*'
# Report result
reportResults \ No newline at end of file