Skip to content

Commit

Permalink
Remove apt_get_update_if_needed and check_packages
Browse files Browse the repository at this point in the history
  • Loading branch information
jungaretti committed Aug 20, 2022
1 parent 9e6255c commit c7a61d3
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions src/nvidia-cuda/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,19 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
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
}

# Prints a more helpful error message when installation fails
apt_try_install() {
apt-get install -yq "$1" || {
local exit_code=$?
echo "Failed to install $1"
echo "See $NVIDIA_REPO_URL for all available packages and versions"
echo "See $NVIDIA_REPO_URL for available packages and versions"
return $exit_code
}
}

# 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 "$@"
fi
}

check_packages wget ca-certificates
# Install dependencies
apt-get update -yq
apt-get install -yq wget ca-certificates

# Add NVIDIA's package repository to apt so that we can download packages
# Always use the ubuntu2004 repo because the other repos (e.g., debian11) are missing packages
Expand Down

0 comments on commit c7a61d3

Please sign in to comment.