This commit is contained in:
Marc Beninca 2024-06-24 11:06:19 +02:00
parent 61f61b08f2
commit 3a8c567beb
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

38
pidd.sh
View file

@ -72,7 +72,7 @@ pidd_set_environment_variables() {
esac esac
# set operating system version # set operating system version
case "${PIDD_OS_ID}" in case "${PIDD_OS_ID}" in
"${PIDD_OS_ALMA}"|"${PIDD_OS_ARCH}"|"${PIDD_OS_FEDORA}"|"${PIDD_OS_ROCKY}") "${PIDD_OS_ALMA}" | "${PIDD_OS_ARCH}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}")
PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \
| sed "s|^\([0-9]\+\)\..*|\1|") | sed "s|^\([0-9]\+\)\..*|\1|")
;; ;;
@ -80,46 +80,46 @@ pidd_set_environment_variables() {
PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \
| sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|") | sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|")
;; ;;
"${PIDD_OS_DEBIAN}"|"${PIDD_OS_UBUNTU}") "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}")
PIDD_OS_VERSION="$(pidd_grep_os VERSION_CODENAME)" PIDD_OS_VERSION="$(pidd_grep_os VERSION_CODENAME)"
;; ;;
*) ;; *) ;;
esac esac
# check operating system version # check operating system version
case "${PIDD_OS_ID}" in case "${PIDD_OS_ID}" in
"${PIDD_OS_ALMA}"|"${PIDD_OS_ROCKY}") "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}")
case "${PIDD_OS_VERSION}" in case "${PIDD_OS_VERSION}" in
"8"|"9") ;; "8" | "9") ;;
*) pidd_error_os "PIDD_OS_VERSION" ;; *) pidd_error_os "PIDD_OS_VERSION" ;;
esac esac
;; ;;
"${PIDD_OS_ALPINE}") "${PIDD_OS_ALPINE}")
case "${PIDD_OS_VERSION}" in case "${PIDD_OS_VERSION}" in
"3.18"|"3.19") ;; "3.18" | "3.19") ;;
*) pidd_error_os "PIDD_OS_VERSION" ;; *) pidd_error_os "PIDD_OS_VERSION" ;;
esac esac
;; ;;
"${PIDD_OS_ARCH}") "${PIDD_OS_ARCH}")
case "${PIDD_OS_VERSION}" in case "${PIDD_OS_VERSION}" in
"20231112"|"20240101") ;; "20231112" | "20240101") ;;
*) pidd_error_os "PIDD_OS_VERSION" ;; *) pidd_error_os "PIDD_OS_VERSION" ;;
esac esac
;; ;;
"${PIDD_OS_DEBIAN}") "${PIDD_OS_DEBIAN}")
case "${PIDD_OS_VERSION}" in case "${PIDD_OS_VERSION}" in
"bookworm"|"bullseye") ;; "bookworm" | "bullseye") ;;
*) pidd_error_os "PIDD_OS_VERSION" ;; *) pidd_error_os "PIDD_OS_VERSION" ;;
esac esac
;; ;;
"${PIDD_OS_FEDORA}") "${PIDD_OS_FEDORA}")
case "${PIDD_OS_VERSION}" in case "${PIDD_OS_VERSION}" in
"39"|"40") ;; "39" | "40") ;;
*) pidd_error_os "PIDD_OS_VERSION" ;; *) pidd_error_os "PIDD_OS_VERSION" ;;
esac esac
;; ;;
"${PIDD_OS_UBUNTU}") "${PIDD_OS_UBUNTU}")
case "${PIDD_OS_VERSION}" in case "${PIDD_OS_VERSION}" in
"jammy"|"noble") ;; "jammy" | "noble") ;;
*) pidd_error_os "PIDD_OS_VERSION" ;; *) pidd_error_os "PIDD_OS_VERSION" ;;
esac esac
;; ;;
@ -138,7 +138,7 @@ pidd_set_environment_variables() {
pidd_echo "PIDD_DNS_FILE" "PIDD_PKG_CA" "PIDD_PKG_GIT" "PIDD_PYTHON_ALIAS" pidd_echo "PIDD_DNS_FILE" "PIDD_PKG_CA" "PIDD_PKG_GIT" "PIDD_PYTHON_ALIAS"
# set ca command & root # set ca command & root
case "${PIDD_OS_ID}" in case "${PIDD_OS_ID}" in
"${PIDD_OS_ALMA}"|"${PIDD_OS_FEDORA}"|"${PIDD_OS_ROCKY}") "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}")
PIDD_CA_ROOT="/etc/pki/ca-trust/source/anchors" PIDD_CA_ROOT="/etc/pki/ca-trust/source/anchors"
PIDD_CMD_CA="update-ca-trust" PIDD_CMD_CA="update-ca-trust"
;; ;;
@ -150,7 +150,7 @@ pidd_set_environment_variables() {
PIDD_CA_ROOT="/etc/ca-certificates/trust-source/anchors" PIDD_CA_ROOT="/etc/ca-certificates/trust-source/anchors"
PIDD_CMD_CA="update-ca-trust" PIDD_CMD_CA="update-ca-trust"
;; ;;
"${PIDD_OS_DEBIAN}"|"${PIDD_OS_UBUNTU}") "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}")
PIDD_CA_ROOT="/usr/local/share/ca-certificates" PIDD_CA_ROOT="/usr/local/share/ca-certificates"
PIDD_CMD_CA="update-ca-certificates" PIDD_CMD_CA="update-ca-certificates"
;; ;;
@ -163,10 +163,10 @@ pidd_set_environment_variables() {
"${PIDD_OS_ALPINE}") "${PIDD_OS_ALPINE}")
PIDD_PM="${PIDD_PM_APK}" PIDD_PM="${PIDD_PM_APK}"
;; ;;
"${PIDD_OS_DEBIAN}"|"${PIDD_OS_UBUNTU}") "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}")
PIDD_PM="${PIDD_PM_APT}" PIDD_PM="${PIDD_PM_APT}"
;; ;;
"${PIDD_OS_ALMA}"|"${PIDD_OS_FEDORA}"|"${PIDD_OS_ROCKY}") "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}")
PIDD_PM="${PIDD_PM_DNF}" PIDD_PM="${PIDD_PM_DNF}"
;; ;;
"${PIDD_OS_ARCH}") "${PIDD_OS_ARCH}")
@ -311,7 +311,7 @@ Acquire::https::Verify-Peer False;
pidd_echo "PIDD_URL_DEFAULT" "PIDD_URL_CHOSEN" pidd_echo "PIDD_URL_DEFAULT" "PIDD_URL_CHOSEN"
# set python command & package # set python command & package
case "${PIDD_OS_ID}" in case "${PIDD_OS_ID}" in
"${PIDD_OS_ALMA}"|"${PIDD_OS_ROCKY}") "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}")
PIDD_PYTHON_COMMAND="python3.11" PIDD_PYTHON_COMMAND="python3.11"
PIDD_PYTHON_PACKAGE="python3.11" PIDD_PYTHON_PACKAGE="python3.11"
;; ;;
@ -347,13 +347,13 @@ Acquire::https::Verify-Peer False;
esac esac
# set python packages # set python packages
case "${PIDD_OS_ID}" in case "${PIDD_OS_ID}" in
"${PIDD_OS_ALMA}"|"${PIDD_OS_FEDORA}"|"${PIDD_OS_ROCKY}") "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}")
PIDD_PYTHON_PACKAGES="/usr/lib64/${PIDD_PYTHON_COMMAND}/site-packages" PIDD_PYTHON_PACKAGES="/usr/lib64/${PIDD_PYTHON_COMMAND}/site-packages"
;; ;;
"${PIDD_OS_ALPINE}"|"${PIDD_OS_ARCH}") "${PIDD_OS_ALPINE}" | "${PIDD_OS_ARCH}")
PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_COMMAND}/site-packages" PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_COMMAND}/site-packages"
;; ;;
"${PIDD_OS_DEBIAN}"|"${PIDD_OS_UBUNTU}") "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}")
PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_ALIAS}/dist-packages" PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_ALIAS}/dist-packages"
;; ;;
*) ;; *) ;;
@ -436,7 +436,7 @@ Acquire::https::Verify-Peer False;
"PIDD_PROJECT_PATH" "PIDD_PROJECT_NAME" "PIDD_PROJECT_BRANCH" "PIDD_PROJECT_PATH" "PIDD_PROJECT_NAME" "PIDD_PROJECT_BRANCH"
# TODO move to Python # TODO move to Python
case "${PIDD_PM}" in case "${PIDD_PM}" in
"${PIDD_PM_APK}"|"${PIDD_PM_APT}") PIDD_PKG_SSH="openssh-client" ;; "${PIDD_PM_APK}" | "${PIDD_PM_APT}") PIDD_PKG_SSH="openssh-client" ;;
"${PIDD_PM_DNF}") PIDD_PKG_SSH="openssh-clients" ;; "${PIDD_PM_DNF}") PIDD_PKG_SSH="openssh-clients" ;;
"${PIDD_PM_PACMAN}") PIDD_PKG_SSH="openssh" ;; "${PIDD_PM_PACMAN}") PIDD_PKG_SSH="openssh" ;;
*) ;; *) ;;
@ -501,7 +501,7 @@ pidd_set_packages_configuration() {
pidd_step "Set packages configuration" pidd_step "Set packages configuration"
pidd_write "${PIDD_PM_CONF_PATH}" "${PIDD_PM_CONF_TEXT}" pidd_write "${PIDD_PM_CONF_PATH}" "${PIDD_PM_CONF_TEXT}"
case "${PIDD_OS_ID}" in case "${PIDD_OS_ID}" in
"${PIDD_OS_DEBIAN}"|"${PIDD_OS_UBUNTU}") "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}")
export DEBIAN_FRONTEND="noninteractive" export DEBIAN_FRONTEND="noninteractive"
;; ;;
*) ;; *) ;;