Skip to content

Commit

Permalink
Improve install_packages in linux.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Apr 2, 2023
1 parent ca308a6 commit 6483a6e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/scripts/linux.sh
Expand Up @@ -15,10 +15,15 @@ self_hosted_helper() {
install_packages apt-transport-https ca-certificates curl file make jq unzip autoconf automake gcc g++ gnupg
}

# Function to fix broken packages.
fix_broken_packages() {
sudo apt --fix-broken install >/dev/null 2>&1
}

# Function to install a package
install_packages() {
packages=("$@")
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && $apt_install "${packages[@]}" >/dev/null 2>&1)
$apt_install "${packages[@]}" >/dev/null 2>&1 || (update_lists && fix_broken_packages && $apt_install "${packages[@]}" >/dev/null 2>&1)
}

# Function to disable an extension.
Expand Down

0 comments on commit 6483a6e

Please sign in to comment.