From 64c65167bacf2ba9b1891ea8ac141189918b5a06 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 23 May 2024 16:04:04 +0200 Subject: [PATCH] cd_python_alias --- cd.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cd.sh b/cd.sh index 2a5fe85..ee3241f 100644 --- a/cd.sh +++ b/cd.sh @@ -108,8 +108,9 @@ cd_set_environment_variables () { CD_DNS_FILE="/etc/resolv.conf" CD_PKG_CA="ca-certificates" CD_PKG_GIT="git" + CD_PYTHON_ALIAS="python3" cd_split - cd_echo "CD_DNS_FILE" "CD_PKG_CA" "CD_PKG_GIT" + cd_echo "CD_DNS_FILE" "CD_PKG_CA" "CD_PKG_GIT" "CD_PYTHON_ALIAS" # set ca command & root case "${CD_OS_ID}" in "${CD_OS_ALMA}"|"${CD_OS_FEDORA}"|"${CD_OS_ROCKY}") @@ -297,7 +298,7 @@ Dir::Etc::SourceParts \"\"; CD_PYTHON_PACKAGES="/usr/lib/${CD_PYTHON_COMMAND}/site-packages" ;; "${CD_OS_DEBIAN}"|"${CD_OS_UBUNTU}") - CD_PYTHON_PACKAGES="/usr/lib/python3/dist-packages" + CD_PYTHON_PACKAGES="/usr/lib/${CD_PYTHON_ALIAS}/dist-packages" ;; esac cd_split @@ -535,7 +536,7 @@ ${self} ↓ ${1} " - "${CD_PYTHON_COMMAND}" -m "${1}" "${CD_STEP}" "${self}" + "${CD_PYTHON_ALIAS}" -m "${1}" "${CD_STEP}" "${self}" } # functions @@ -584,9 +585,10 @@ cd_install_package () { } cd_ln_python () { - if [ "${1}" ] ; then - echo "python3 → ${1}" - ln -f -s "${1}" "/usr/bin/python3" || exit +local command="${1}" + if [ "${command}" ] ; then + echo "${CD_PYTHON_ALIAS} → ${command}" + ln -f -s "${command}" "/usr/bin/${CD_PYTHON_ALIAS}" || exit fi }