From 6483a6ea7068043bbf3396e5230eba9877c8b129 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sun, 2 Apr 2023 22:03:11 +0530 Subject: [PATCH] Improve install_packages in linux.sh --- src/scripts/linux.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index 85a3334f..a0bd3c15 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -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.