small fix to the argsv and automated apt install of requirements

This commit is contained in:
Félix Boisselier
2024-01-08 00:26:44 +01:00
parent db57300eb2
commit f846534f0f
3 changed files with 31 additions and 14 deletions

View File

@@ -27,6 +27,32 @@ function preflight_checks {
echo "[ERROR] Klipper service not found, please install Klipper first!"
exit -1
fi
install_package_requirements
}
# Function to check if a package is installed
function is_package_installed {
dpkg -s "$1" &> /dev/null
return $?
}
function install_package_requirements {
packages=("python3-venv" "libopenblas-dev" "libatlas-base-dev")
packages_to_install=""
for package in "${packages[@]}"; do
if is_package_installed "$package"; then
echo "$package is already installed"
else
packages_to_install="$packages_to_install $package"
fi
done
if [ -n "$packages_to_install" ]; then
echo "Installing missing packages: $packages_to_install"
sudo apt update && sudo apt install -y $packages_to_install
fi
}
function check_download {