refactor(klipper.sh): rename package python-dev to python2-dev (fixes #195)

On more modern linux distros like Ubuntu 22, the package `python-dev` was renamed to `python2-dev` resulting in `E: Package 'python-dev' has no installation candidate`

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-05-14 11:46:30 +02:00
parent 2d696e8336
commit 89d38f11bd

View File

@@ -146,16 +146,24 @@ function klipper_setup_dialog(){
function install_klipper_packages(){
local packages python_version="${1}"
local install_script="${HOME}/klipper/scripts/install-octopi.sh"
local install_script="${HOME}/klipper/scripts/install-debian.sh"
status_msg "Reading dependencies..."
# shellcheck disable=SC2016
packages=$(grep "PKGLIST=" "${install_script}" | cut -d'"' -f2 | sed 's/\${PKGLIST}//g' | tr -d '\n')
### replace python-dev with python3-dev if python3 was selected
[ "${python_version}" == "python3" ] && packages="${packages//python-dev/python3-dev}"
### add dfu-util for octopi-images
packages+=" dfu-util"
### add dbus requirement for DietPi distro
[ -e "/boot/dietpi/.version" ] && packages+=" dbus"
if [[ "${python_version}" == "python3" ]]; then
### replace python-dev with python3-dev if python3 was selected
packages="${packages//python-dev/python3-dev}"
else
### package name 'python-dev' is deprecated (-> no installation candidate) on more modern linux distros
packages="${packages//python-dev/python2-dev}"
fi
echo "${cyan}${packages}${white}" | tr '[:space:]' '\n'
read -r -a packages <<< "${packages}"