From bf521a720053fe8945a18e88e63ab45f31303b0e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 08:10:47 +0200 Subject: [PATCH 01/30] mv --- pidd.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pidd.sh b/pidd.sh index cfbc60b..0736363 100644 --- a/pidd.sh +++ b/pidd.sh @@ -38,6 +38,19 @@ pidd_main () { pidd_switch_to_python "${@}" } +# context + +pidd_list_environment_variables () { + pidd_step "List environment variables" + env | sort +} + +pidd_list_working_directory () { + pidd_step "List working directory" + pidd_list_working_directory__path="$(realpath .)" + pidd_ls "${pidd_list_working_directory__path}" +} + # steps pidd_set_environment_variables () { @@ -501,17 +514,6 @@ pidd_set_packages_configuration () { # agnostic steps -pidd_list_environment_variables () { - pidd_step "List environment variables" - env | sort -} - -pidd_list_working_directory () { - pidd_step "List working directory" - pidd_list_working_directory__path="$(realpath .)" - pidd_ls "${pidd_list_working_directory__path}" -} - pidd_set_https_verification_off () { if [ -n "${PIDD_CA}" ] || [ "${PIDD_PM}" = "${PIDD_PM_APT}" ] ; then pidd_step "Set HTTPS verification off" From 24312b41c579c7076060863fee48540677ac374b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 08:16:50 +0200 Subject: [PATCH 02/30] lwd --- pidd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pidd.sh b/pidd.sh index 0736363..a49f85b 100644 --- a/pidd.sh +++ b/pidd.sh @@ -47,8 +47,8 @@ pidd_list_environment_variables () { pidd_list_working_directory () { pidd_step "List working directory" - pidd_list_working_directory__path="$(realpath .)" - pidd_ls "${pidd_list_working_directory__path}" + pidd_lwd__path="$(realpath .)" + pidd_ls "${pidd_lwd__path}" } # steps From 0ee67f04c120c8507e3903403d9648e4ef79bbcb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 08:21:45 +0200 Subject: [PATCH 03/30] spr --- pidd.sh | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/pidd.sh b/pidd.sh index a49f85b..65188dd 100644 --- a/pidd.sh +++ b/pidd.sh @@ -448,27 +448,25 @@ pidd_set_packages_repositories () { case "${PIDD_OS_ID}" in "${PIDD_OS_ALMA}") case "${PIDD_OS_VERSION}" in - "8") \ -pidd_set_packages_repositories__file="/etc/yum.repos.d/almalinux.repo" ;; - "9") \ -pidd_set_packages_repositories__file="/etc/yum.repos.d/almalinux-baseos.repo" ;; + "8") pidd_spr__file="/etc/yum.repos.d/almalinux.repo" ;; + "9") pidd_spr_file="/etc/yum.repos.d/almalinux-baseos.repo" ;; *) esac - pidd_sed "${pidd_set_packages_repositories__file}" \ + pidd_sed "${pidd_spr__file}" \ "|^mirrorlist|# mirrorlist|" \ "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ "|^# baseurl|baseurl|" ;; "${PIDD_OS_ALPINE}") - pidd_set_packages_repositories__file="/etc/apk/repositories" - pidd_write "${pidd_set_packages_repositories__file}" "\ + pidd_spr__file="/etc/apk/repositories" + pidd_write "${pidd_spr__file}" "\ ${PIDD_URL_CHOSEN}/v${PIDD_OS_VERSION}/main ${PIDD_URL_CHOSEN}/v${PIDD_OS_VERSION}/community " ;; "${PIDD_OS_DEBIAN}") - pidd_set_packages_repositories__file="/etc/apt/sources.list" - pidd_write "${pidd_set_packages_repositories__file}" "\ + pidd_spr__file="/etc/apt/sources.list" + pidd_write "${pidd_spr__file}" "\ deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION} main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-backports main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-updates main @@ -477,20 +475,18 @@ deb ${PIDD_URL_CHOSEN}-security ${PIDD_OS_VERSION}-security main ;; "${PIDD_OS_ROCKY}") case "${PIDD_OS_VERSION}" in - "8") \ -pidd_set_packages_repositories__file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;; - "9") \ -pidd_set_packages_repositories__file="/etc/yum.repos.d/rocky.repo" ;; + "8") pidd_spr__file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;; + "9") pidd_spr__file="/etc/yum.repos.d/rocky.repo" ;; *) esac - pidd_sed "${pidd_set_packages_repositories__file}" \ + pidd_sed "${pidd_spr__file}" \ "|^mirrorlist|# mirrorlist|" \ "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ "|^#baseurl|baseurl|" ;; "${PIDD_OS_UBUNTU}") - pidd_set_packages_repositories__file="/etc/apt/sources.list" - pidd_write "${pidd_set_packages_repositories__file}" "\ + pidd_spr__file="/etc/apt/sources.list" + pidd_write "${pidd_spr__file}" "\ deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION} main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-backports main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-updates main From dfef8ba5a6764f65abf545a1528165544b5a80f8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 08:25:38 +0200 Subject: [PATCH 04/30] sdr --- pidd.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pidd.sh b/pidd.sh index 65188dd..8c496be 100644 --- a/pidd.sh +++ b/pidd.sh @@ -520,12 +520,12 @@ pidd_set_https_verification_off () { pidd_set_dns_resolving () { pidd_step "Set DNS resolving" - for pidd_set_dns_resolving__server in ${PIDD_DNS} ; do - pidd_set_dns_resolving__text="${pidd_set_dns_resolving__text}\ -nameserver ${pidd_set_dns_resolving__server} + for pidd_sdr__server in ${PIDD_DNS} ; do + pidd_sdr__text="${pidd_sdr__text}\ +nameserver ${pidd_sdr__server} " done - pidd_write "${PIDD_DNS_FILE}" "${pidd_set_dns_resolving__text}" + pidd_write "${PIDD_DNS_FILE}" "${pidd_sdr__text}" } pidd_update_packages_catalog () { From b1579d654f91b105f02d85c84566ca7b7f2b774d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 08:30:54 +0200 Subject: [PATCH 05/30] wcc --- pidd.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/pidd.sh b/pidd.sh index 8c496be..86e09c6 100644 --- a/pidd.sh +++ b/pidd.sh @@ -546,20 +546,17 @@ pidd_install_ca_certificates () { pidd_write_ca_certificates () { pidd_step "Write CA certificates" pidd_mkdir "${PIDD_CA_ROOT}" - pidd_write_ca_certificates__index=1 - eval "pidd_write_ca_certificates__text=\ -\"\${PIDD_CA_${pidd_write_ca_certificates__index}}\"" - while [ -n "${pidd_write_ca_certificates__text}" ] ; do - pidd_write_ca_certificates__path="\ -${PIDD_CA_ROOT}/${pidd_write_ca_certificates__index}.crt" + pidd_wcc__index=1 + eval "pidd_wcc__text=\"\${PIDD_CA_${pidd_wcc__index}}\"" + while [ -n "${pidd_wcc__text}" ] ; do + pidd_wcc__path="${PIDD_CA_ROOT}/${pidd_wcc__index}.crt" pidd_split pidd_write \ - "${pidd_write_ca_certificates__path}" \ - "${pidd_write_ca_certificates__text}" - pidd_openssl "${pidd_write_ca_certificates__path}" - pidd_write_ca_certificates__index=$((pidd_write_ca_certificates__index+1)) - eval "pidd_write_ca_certificates__text=\ -\"\${PIDD_CA_${pidd_write_ca_certificates__index}}\"" + "${pidd_wcc__path}" \ + "${pidd_wcc__text}" + pidd_openssl "${pidd_wcc__path}" + pidd_wcc__index=$((pidd_wcc__index+1)) + eval "pidd_wcc__text=\"\${PIDD_CA_${pidd_wcc__index}}\"" done } From 10b499d9799d2735fc3782d52e34bd0280750ede Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 08:39:21 +0200 Subject: [PATCH 06/30] ipm --- pidd.sh | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/pidd.sh b/pidd.sh index 86e09c6..4eca815 100644 --- a/pidd.sh +++ b/pidd.sh @@ -606,45 +606,36 @@ pidd_clean_packages_cache () { pidd_install_python_modules () { pidd_step "Install Python modules" - pidd_install_python_modules__root="$(mktemp --directory)" || exit - echo "→ ${pidd_install_python_modules__root}" - for pidd_install_python_modules__repository \ - in "${PIDD_GIT_MAIN}" "${PIDD_GIT_ROOT}" ; do - case "${pidd_install_python_modules__repository}" in - http*) pidd_install_python_modules__url="\ -${pidd_install_python_modules__repository}" ;; - /*) pidd_install_python_modules__url="${PIDD_PROJECT_ROOT}\ -${pidd_install_python_modules__repository}" ;; - *) pidd_install_python_modules__url="${PIDD_PROJECT_ROOT}\ -/${PIDD_PROJECT_PATH}/${pidd_install_python_modules__repository}" ;; + pidd_ipm__root="$(mktemp --directory)" || exit + echo "→ ${pidd_ipm__root}" + for pidd_ipm__repository in "${PIDD_GIT_MAIN}" "${PIDD_GIT_ROOT}" ; do + case "${pidd_ipm__repository}" in + http*) pidd_ipm__url="${pidd_ipm__repository}" ;; + /*) pidd_ipm__url="${PIDD_PROJECT_ROOT}${pidd_ipm__repository}" ;; + *) pidd_ipm__url="\ +${PIDD_PROJECT_ROOT}/${PIDD_PROJECT_PATH}/${pidd_ipm__repository}" ;; esac - pidd_install_python_modules__name="\ -$(basename "${pidd_install_python_modules__url}")" + pidd_ipm__name="$(basename "${pidd_ipm__url}")" pidd_split echo "\ -${pidd_install_python_modules__url} +${pidd_ipm__url} ↓" git clone \ - "${pidd_install_python_modules__url}" \ - "${pidd_install_python_modules__root}\ -/${pidd_install_python_modules__name}" \ + "${pidd_ipm__url}" \ + "${pidd_ipm__root}/${pidd_ipm__name}" \ || exit - pidd_install_python_modules__path="\ -${pidd_install_python_modules__root}\ -/${pidd_install_python_modules__name}\ -/${pidd_install_python_modules__name}" + pidd_ipm__path="${pidd_ipm__root}/${pidd_ipm__name}/${pidd_ipm__name}" echo "\ -${pidd_install_python_modules__path} +${pidd_ipm__path} ↓ ${PIDD_PYTHON_PACKAGES}" - cp --recursive \ - "${pidd_install_python_modules__path}" "${PIDD_PYTHON_PACKAGES}" \ + cp --recursive "${pidd_ipm__path}" "${PIDD_PYTHON_PACKAGES}" \ || exit done pidd_split pidd_ls "${PIDD_PYTHON_PACKAGES}" pidd_split - pidd_rm "${pidd_install_python_modules__root}" + pidd_rm "${pidd_ipm__root}" } pidd_write_python_module () { From e7f64392fc831daa1518be594d2f55db0fcffe4b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 08:43:07 +0200 Subject: [PATCH 07/30] wpm --- pidd.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pidd.sh b/pidd.sh index 4eca815..f6f11d8 100644 --- a/pidd.sh +++ b/pidd.sh @@ -640,18 +640,16 @@ ${PIDD_PYTHON_PACKAGES}" pidd_write_python_module () { pidd_step "Write Python module" - for pidd_write_python_module__variable in \ + for pidd_wpm__variable in \ OPEN DOWN VERT SPLT __UP SHUT \ OS_ID OS_VERSION \ PROJECT_ROOT PROJECT_PATH PROJECT_NAME \ ; do - pidd_write_python_module__value="\ -$(pidd_echo "PIDD_${pidd_write_python_module__variable}")" - pidd_write_python_module__text="${pidd_write_python_module__text}\ -${pidd_write_python_module__value} + pidd_wpm__value="$(pidd_echo "PIDD_${pidd_wpm__variable}")" + pidd_wpm__text="${pidd_wpm__text}${pidd_wpm__value} " done - pidd_write "${PIDD_PYTHON_PACKAGES}/env.py" "${pidd_write_python_module__text}\ + pidd_write "${PIDD_PYTHON_PACKAGES}/env.py" "${pidd_wpm__text} PIDD_STEP = $((PIDD_STEP+1)) " } From 81bcc37d25d6e5586ee49499730b44f0413634bf Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 09:51:01 +0200 Subject: [PATCH 08/30] stp --- pidd.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pidd.sh b/pidd.sh index f6f11d8..ad0406e 100644 --- a/pidd.sh +++ b/pidd.sh @@ -656,12 +656,12 @@ PIDD_STEP = $((PIDD_STEP+1)) pidd_switch_to_python () { pidd_step "Switch to Python" - pidd_switch_to_python__name="$(basename "${PIDD_GIT_MAIN}")" + pidd_stp__name="$(basename "${PIDD_GIT_MAIN}")" echo "\ ${PIDD_PATH} ↓ -${PIDD_PYTHON_PACKAGES}/${pidd_switch_to_python__name}" - "${PIDD_PYTHON_ALIAS}" -m "${pidd_switch_to_python__name}" "${@}" +${PIDD_PYTHON_PACKAGES}/${pidd_stp__name}" + "${PIDD_PYTHON_ALIAS}" -m "${pidd_stp__name}" "${@}" } # functions From 0dbbaaab69cbb509901ded91aab60e84815788bd Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 10:48:26 +0200 Subject: [PATCH 09/30] () --- pidd.sh | 80 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/pidd.sh b/pidd.sh index ad0406e..94ae8a1 100644 --- a/pidd.sh +++ b/pidd.sh @@ -8,7 +8,7 @@ [ -n "${PIDD_GIT_ROOT}" ] || PIDD_GIT_ROOT="rwx" # main -pidd_main () { +pidd_main() { pidd_list_environment_variables pidd_list_working_directory # @@ -40,12 +40,12 @@ pidd_main () { # context -pidd_list_environment_variables () { +pidd_list_environment_variables() { pidd_step "List environment variables" env | sort } -pidd_list_working_directory () { +pidd_list_working_directory() { pidd_step "List working directory" pidd_lwd__path="$(realpath .)" pidd_ls "${pidd_lwd__path}" @@ -53,7 +53,7 @@ pidd_list_working_directory () { # steps -pidd_set_environment_variables () { +pidd_set_environment_variables() { pidd_step "Set environment variables" # set path PIDD_PATH="$(realpath "${0}")" @@ -443,7 +443,7 @@ Acquire::https::Verify-Peer False; esac } -pidd_set_packages_repositories () { +pidd_set_packages_repositories() { pidd_step "Set packages repositories" case "${PIDD_OS_ID}" in "${PIDD_OS_ALMA}") @@ -497,7 +497,7 @@ deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-security main esac } -pidd_set_packages_configuration () { +pidd_set_packages_configuration() { pidd_step "Set packages configuration" pidd_write "${PIDD_PM_CONF_PATH}" "${PIDD_PM_CONF_TEXT}" case "${PIDD_OS_ID}" in @@ -510,7 +510,7 @@ pidd_set_packages_configuration () { # agnostic steps -pidd_set_https_verification_off () { +pidd_set_https_verification_off() { if [ -n "${PIDD_CA}" ] || [ "${PIDD_PM}" = "${PIDD_PM_APT}" ] ; then pidd_step "Set HTTPS verification off" pidd_mkdir "$(dirname "${PIDD_PM_HTTPS_PATH}")" @@ -518,7 +518,7 @@ pidd_set_https_verification_off () { fi } -pidd_set_dns_resolving () { +pidd_set_dns_resolving() { pidd_step "Set DNS resolving" for pidd_sdr__server in ${PIDD_DNS} ; do pidd_sdr__text="${pidd_sdr__text}\ @@ -528,22 +528,22 @@ nameserver ${pidd_sdr__server} pidd_write "${PIDD_DNS_FILE}" "${pidd_sdr__text}" } -pidd_update_packages_catalog () { +pidd_update_packages_catalog() { pidd_step "Update packages catalog" ${PIDD_PM_UPDATE} || exit } -pidd_install_packages_tools () { +pidd_install_packages_tools() { pidd_step "Install packages tools" pidd_install_package "${PIDD_PKG_PKG}" } -pidd_install_ca_certificates () { +pidd_install_ca_certificates() { pidd_step "Install CA" pidd_install_package "${PIDD_PKG_CA}" } -pidd_write_ca_certificates () { +pidd_write_ca_certificates() { pidd_step "Write CA certificates" pidd_mkdir "${PIDD_CA_ROOT}" pidd_wcc__index=1 @@ -560,27 +560,27 @@ pidd_write_ca_certificates () { done } -pidd_update_ca_certificates () { +pidd_update_ca_certificates() { pidd_step "Update CA certificates" ${PIDD_CMD_CA} || exit } -pidd_set_https_verification_on () { +pidd_set_https_verification_on() { pidd_step "Set HTTPS verification on" pidd_rm "${PIDD_PM_HTTPS_PATH}" } -pidd_upgrade_packages () { +pidd_upgrade_packages() { pidd_step "Upgrade packages" ${PIDD_PM_UPGRADE} || exit } -pidd_install_git () { +pidd_install_git() { pidd_step "Install Git" pidd_install_package "${PIDD_PKG_GIT}" } -pidd_install_python () { +pidd_install_python() { pidd_step "Install Python" pidd_install_package "${PIDD_PYTHON_PACKAGE}" pidd_split @@ -588,23 +588,23 @@ pidd_install_python () { } # TODO move to Python -pidd_install_rsync () { +pidd_install_rsync() { pidd_step "Install Rsync" pidd_install_package "${PIDD_PKG_RSYNC}" } # TODO move to Python -pidd_install_ssh () { +pidd_install_ssh() { pidd_step "Install SSH" pidd_install_package "${PIDD_PKG_SSH}" } -pidd_clean_packages_cache () { +pidd_clean_packages_cache() { pidd_step "Clean packages cache" ${PIDD_PM_CLEAN} || exit } -pidd_install_python_modules () { +pidd_install_python_modules() { pidd_step "Install Python modules" pidd_ipm__root="$(mktemp --directory)" || exit echo "→ ${pidd_ipm__root}" @@ -638,7 +638,7 @@ ${PIDD_PYTHON_PACKAGES}" pidd_rm "${pidd_ipm__root}" } -pidd_write_python_module () { +pidd_write_python_module() { pidd_step "Write Python module" for pidd_wpm__variable in \ OPEN DOWN VERT SPLT __UP SHUT \ @@ -654,7 +654,7 @@ PIDD_STEP = $((PIDD_STEP+1)) " } -pidd_switch_to_python () { +pidd_switch_to_python() { pidd_step "Switch to Python" pidd_stp__name="$(basename "${PIDD_GIT_MAIN}")" echo "\ @@ -666,7 +666,7 @@ ${PIDD_PYTHON_PACKAGES}/${pidd_stp__name}" # functions -pidd_cat () { +pidd_cat() { pidd_cat__file="${1}" if [ -n "${pidd_cat__file}" ] ; then pidd_open "${pidd_cat__file}" @@ -675,7 +675,7 @@ pidd_cat () { fi } -pidd_echo () { +pidd_echo() { if [ -n "${1}" ] ; then for pidd_echo__name in "${@}" ; do pidd_echo__text="" @@ -685,19 +685,19 @@ pidd_echo () { fi } -pidd_error_ci () { +pidd_error_ci() { echo "× CI: ${*}" exit "${PIDD_ERROR_CI}" } -pidd_error_os () { +pidd_error_os() { pidd_error_os__variable="${1}" printf "× OS: " pidd_echo "${pidd_error_os__variable}" exit "${PIDD_ERROR_OS}" } -pidd_grep_os () { +pidd_grep_os() { pidd_grep_os__variable="${1}" if [ -n "${pidd_grep_os__variable}" ] ; then grep "^${pidd_grep_os__variable}=" "/etc/os-release" \ @@ -706,14 +706,14 @@ pidd_grep_os () { fi } -pidd_install_package () { +pidd_install_package() { pidd_install_package__name="${1}" if [ -n "${pidd_install_package__name}" ] ; then ${PIDD_PM_INSTALL} "${pidd_install_package__name}" || exit fi } -pidd_ln_python () { +pidd_ln_python() { pidd_ln_python__command="${1}" if [ -n "${pidd_ln_python__command}" ] ; then echo "→ ${PIDD_PYTHON_ALIAS} → ${pidd_ln_python__command}" @@ -722,7 +722,7 @@ pidd_ln_python () { fi } -pidd_ls () { +pidd_ls() { pidd_ls__path="${1}" if [ -n "${pidd_ls__path}" ] ; then pidd_open "${pidd_ls__path}" @@ -731,7 +731,7 @@ pidd_ls () { fi } -pidd_mkdir () { +pidd_mkdir() { pidd_mkdir__path="${1}" if [ -n "${pidd_mkdir__path}" ] ; then echo "→ ${pidd_mkdir__path}" @@ -739,11 +739,11 @@ pidd_mkdir () { fi } -pidd_open () { +pidd_open() { echo "${PIDD_OPEN}${*}" } -pidd_openssl () { +pidd_openssl() { pidd_openssl__file="${1}" if [ -f "${pidd_openssl__file}" ] ; then openssl x509 \ @@ -753,7 +753,7 @@ pidd_openssl () { fi } -pidd_rm () { +pidd_rm() { pidd_rm__path="${1}" if [ -e "${pidd_rm__path}" ] ; then echo "← ${pidd_rm__path}" @@ -761,7 +761,7 @@ pidd_rm () { fi } -pidd_sed () { +pidd_sed() { pidd_sed__file="${1}" shift if [ -f "${pidd_sed__file}" ] ; then @@ -774,15 +774,15 @@ pidd_sed () { fi } -pidd_shut () { +pidd_shut() { echo "${PIDD_SHUT}${*}" } -pidd_split () { +pidd_split() { echo "${PIDD_SPLT}" } -pidd_step () { +pidd_step() { PIDD_STEP=$((PIDD_STEP+1)) echo "\ ${PIDD_DOWN} @@ -790,7 +790,7 @@ ${PIDD_VERT} ${PIDD_STEP} ${*} ${PIDD___UP}" } -pidd_write () { +pidd_write() { pidd_write__file="${1}" pidd_write__text="${2}" if [ -n "${pidd_write__file}" ] ; then From de370d346d5da46b97497910bd7cf177bf3dbaa3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 10:59:41 +0200 Subject: [PATCH 10/30] *) ;; --- pidd.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/pidd.sh b/pidd.sh index 94ae8a1..118e6d8 100644 --- a/pidd.sh +++ b/pidd.sh @@ -83,7 +83,7 @@ pidd_set_environment_variables() { "${PIDD_OS_DEBIAN}"|"${PIDD_OS_UBUNTU}") PIDD_OS_VERSION="$(pidd_grep_os VERSION_CODENAME)" ;; - *) + *) ;; esac # check operating system version case "${PIDD_OS_ID}" in @@ -123,7 +123,7 @@ pidd_set_environment_variables() { *) pidd_error_os "PIDD_OS_VERSION" ;; esac ;; - *) + *) ;; esac pidd_split pidd_echo "PIDD_OS_ID" "PIDD_OS_VERSION" @@ -154,7 +154,7 @@ pidd_set_environment_variables() { PIDD_CA_ROOT="/usr/local/share/ca-certificates" PIDD_CMD_CA="update-ca-certificates" ;; - *) + *) ;; esac pidd_split pidd_echo "PIDD_CA_ROOT" "PIDD_CMD_CA" @@ -172,7 +172,7 @@ pidd_set_environment_variables() { "${PIDD_OS_ARCH}") PIDD_PM="${PIDD_PM_PACMAN}" ;; - *) + *) ;; esac pidd_split pidd_echo "PIDD_PM" @@ -246,7 +246,7 @@ Dir::Etc::SourceParts \"\"; Acquire::https::Verify-Peer False; " ;; - *) + *) ;; esac pidd_split pidd_echo "PIDD_PM_CLEAN" \ @@ -276,7 +276,7 @@ Acquire::https::Verify-Peer False; "${PIDD_OS_UBUNTU}") PIDD_URL_DEFAULT="http://archive.ubuntu.com/ubuntu" ;; - *) + *) ;; esac PIDD_URL_CHOSEN="${PIDD_URL_DEFAULT}" case "${PIDD_OS_ID}" in @@ -305,7 +305,7 @@ Acquire::https::Verify-Peer False; [ -n "${PIDD_URL_UBUNTU}" ] && PIDD_URL_CHOSEN="${PIDD_URL_UBUNTU}" \ || PIDD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu" ;; - *) + *) ;; esac pidd_split pidd_echo "PIDD_URL_DEFAULT" "PIDD_URL_CHOSEN" @@ -327,7 +327,7 @@ Acquire::https::Verify-Peer False; case "${PIDD_OS_VERSION}" in "bookworm") PIDD_PYTHON_COMMAND="python3.11" ;; "bullseye") PIDD_PYTHON_COMMAND="python3.9" ;; - *) + *) ;; esac PIDD_PYTHON_PACKAGE="python3" ;; @@ -339,11 +339,11 @@ Acquire::https::Verify-Peer False; case "${PIDD_OS_VERSION}" in "noble") PIDD_PYTHON_COMMAND="python3.12" ;; "jammy") PIDD_PYTHON_COMMAND="python3.10" ;; - *) + *) ;; esac PIDD_PYTHON_PACKAGE="python3" ;; - *) + *) ;; esac # set python packages case "${PIDD_OS_ID}" in @@ -356,7 +356,7 @@ Acquire::https::Verify-Peer False; "${PIDD_OS_DEBIAN}"|"${PIDD_OS_UBUNTU}") PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_ALIAS}/dist-packages" ;; - *) + *) ;; esac pidd_split pidd_echo "PIDD_PYTHON_COMMAND" "PIDD_PYTHON_PACKAGE" "PIDD_PYTHON_PACKAGES" @@ -439,7 +439,7 @@ Acquire::https::Verify-Peer False; "${PIDD_PM_APK}"|"${PIDD_PM_APT}") PIDD_PKG_SSH="openssh-client" ;; "${PIDD_PM_DNF}") PIDD_PKG_SSH="openssh-clients" ;; "${PIDD_PM_PACMAN}") PIDD_PKG_SSH="openssh" ;; - *) + *) ;; esac } @@ -450,7 +450,7 @@ pidd_set_packages_repositories() { case "${PIDD_OS_VERSION}" in "8") pidd_spr__file="/etc/yum.repos.d/almalinux.repo" ;; "9") pidd_spr_file="/etc/yum.repos.d/almalinux-baseos.repo" ;; - *) + *) ;; esac pidd_sed "${pidd_spr__file}" \ "|^mirrorlist|# mirrorlist|" \ @@ -477,7 +477,7 @@ deb ${PIDD_URL_CHOSEN}-security ${PIDD_OS_VERSION}-security main case "${PIDD_OS_VERSION}" in "8") pidd_spr__file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;; "9") pidd_spr__file="/etc/yum.repos.d/rocky.repo" ;; - *) + *) ;; esac pidd_sed "${pidd_spr__file}" \ "|^mirrorlist|# mirrorlist|" \ @@ -493,7 +493,7 @@ deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-updates main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-security main " ;; - *) + *) ;; esac } @@ -504,7 +504,7 @@ pidd_set_packages_configuration() { "${PIDD_OS_DEBIAN}"|"${PIDD_OS_UBUNTU}") export DEBIAN_FRONTEND="noninteractive" ;; - *) + *) ;; esac } From 61f61b08f29d93aa541e96c85a7c26a64434da4a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 11:04:10 +0200 Subject: [PATCH 11/30] ]; --- pidd.sh | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/pidd.sh b/pidd.sh index 118e6d8..50d512c 100644 --- a/pidd.sh +++ b/pidd.sh @@ -363,39 +363,39 @@ Acquire::https::Verify-Peer False; # variables [ -n "${PIDD_CA_1}" ] && PIDD_CA=true # continuous integration platform - if [ -n "${GITHUB_ACTIONS}" ] ; then + if [ -n "${GITHUB_ACTIONS}" ]; then # github → gitea → forgejo - if [ -n "${GITHUB_SERVER_URL}" ] ; then + if [ -n "${GITHUB_SERVER_URL}" ]; then PIDD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")//" - if [ -n "${GITHUB_TOKEN}" ] ; then + if [ -n "${GITHUB_TOKEN}" ]; then PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}${GITHUB_TOKEN}@" fi PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")" else pidd_error_ci "GITHUB_SERVER_URL" fi - if [ -n "${GITHUB_REPOSITORY}" ] ; then + if [ -n "${GITHUB_REPOSITORY}" ]; then PIDD_PROJECT_PATH="$(dirname "${GITHUB_REPOSITORY}")" PIDD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")" else pidd_error_ci "GITHUB_REPOSITORY" fi - if [ -n "${GITHUB_REF_NAME}" ] ; then + if [ -n "${GITHUB_REF_NAME}" ]; then PIDD_PROJECT_BRANCH="${GITHUB_REF_NAME}" else pidd_error_ci "GITHUB_REF_NAME" fi - elif [ -n "${GITLAB_CI}" ] ; then + elif [ -n "${GITLAB_CI}" ]; then # gitlab - if [ -n "${CI_SERVER_PROTOCOL}" ] ; then - if [ -n "${CI_REGISTRY_USER}" ] ; then - if [ -n "${CI_REGISTRY_PASSWORD}" ] ; then - if [ -n "${CI_SERVER_FQDN}" ] ; then + if [ -n "${CI_SERVER_PROTOCOL}" ]; then + if [ -n "${CI_REGISTRY_USER}" ]; then + if [ -n "${CI_REGISTRY_PASSWORD}" ]; then + if [ -n "${CI_SERVER_FQDN}" ]; then PIDD_PROJECT_ROOT="${CI_SERVER_PROTOCOL}\ ://${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD}@${CI_SERVER_FQDN}" - if [ -n "${CI_PROJECT_NAMESPACE}" ] ; then + if [ -n "${CI_PROJECT_NAMESPACE}" ]; then PIDD_PROJECT_PATH="${CI_PROJECT_NAMESPACE}" - if [ -n "${CI_PROJECT_NAME}" ] ; then + if [ -n "${CI_PROJECT_NAME}" ]; then PIDD_PROJECT_NAME="${CI_PROJECT_NAME}" else pidd_error_ci "CI_PROJECT_NAME" @@ -415,7 +415,7 @@ Acquire::https::Verify-Peer False; else pidd_error_ci "CI_SERVER_PROTOCOL" fi - if [ -n "${CI_COMMIT_BRANCH}" ] ; then + if [ -n "${CI_COMMIT_BRANCH}" ]; then PIDD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}" else pidd_error_ci "CI_COMMIT_BRANCH" @@ -511,7 +511,7 @@ pidd_set_packages_configuration() { # agnostic steps pidd_set_https_verification_off() { - if [ -n "${PIDD_CA}" ] || [ "${PIDD_PM}" = "${PIDD_PM_APT}" ] ; then + if [ -n "${PIDD_CA}" ] || [ "${PIDD_PM}" = "${PIDD_PM_APT}" ]; then pidd_step "Set HTTPS verification off" pidd_mkdir "$(dirname "${PIDD_PM_HTTPS_PATH}")" pidd_write "${PIDD_PM_HTTPS_PATH}" "${PIDD_PM_HTTPS_TEXT}" @@ -668,7 +668,7 @@ ${PIDD_PYTHON_PACKAGES}/${pidd_stp__name}" pidd_cat() { pidd_cat__file="${1}" - if [ -n "${pidd_cat__file}" ] ; then + if [ -n "${pidd_cat__file}" ]; then pidd_open "${pidd_cat__file}" cat "${pidd_cat__file}" || exit pidd_shut "${pidd_cat__file}" @@ -676,7 +676,7 @@ pidd_cat() { } pidd_echo() { - if [ -n "${1}" ] ; then + if [ -n "${1}" ]; then for pidd_echo__name in "${@}" ; do pidd_echo__text="" eval "pidd_echo__text=\"\${${pidd_echo__name}}\"" @@ -699,7 +699,7 @@ pidd_error_os() { pidd_grep_os() { pidd_grep_os__variable="${1}" - if [ -n "${pidd_grep_os__variable}" ] ; then + if [ -n "${pidd_grep_os__variable}" ]; then grep "^${pidd_grep_os__variable}=" "/etc/os-release" \ | sed "s|^${pidd_grep_os__variable}=||" \ | sed "s|^\"\(.*\)\"$|\1|" @@ -708,14 +708,14 @@ pidd_grep_os() { pidd_install_package() { pidd_install_package__name="${1}" - if [ -n "${pidd_install_package__name}" ] ; then + if [ -n "${pidd_install_package__name}" ]; then ${PIDD_PM_INSTALL} "${pidd_install_package__name}" || exit fi } pidd_ln_python() { pidd_ln_python__command="${1}" - if [ -n "${pidd_ln_python__command}" ] ; then + if [ -n "${pidd_ln_python__command}" ]; then echo "→ ${PIDD_PYTHON_ALIAS} → ${pidd_ln_python__command}" ln -f -s "${pidd_ln_python__command}" "/usr/bin/${PIDD_PYTHON_ALIAS}" \ || exit @@ -724,7 +724,7 @@ pidd_ln_python() { pidd_ls() { pidd_ls__path="${1}" - if [ -n "${pidd_ls__path}" ] ; then + if [ -n "${pidd_ls__path}" ]; then pidd_open "${pidd_ls__path}" ls -a -l "${pidd_ls__path}" || exit pidd_shut "${pidd_ls__path}" @@ -733,7 +733,7 @@ pidd_ls() { pidd_mkdir() { pidd_mkdir__path="${1}" - if [ -n "${pidd_mkdir__path}" ] ; then + if [ -n "${pidd_mkdir__path}" ]; then echo "→ ${pidd_mkdir__path}" mkdir --parents "${pidd_mkdir__path}" || exit fi @@ -745,7 +745,7 @@ pidd_open() { pidd_openssl() { pidd_openssl__file="${1}" - if [ -f "${pidd_openssl__file}" ] ; then + if [ -f "${pidd_openssl__file}" ]; then openssl x509 \ -in "${pidd_openssl__file}" \ -noout -text \ @@ -755,7 +755,7 @@ pidd_openssl() { pidd_rm() { pidd_rm__path="${1}" - if [ -e "${pidd_rm__path}" ] ; then + if [ -e "${pidd_rm__path}" ]; then echo "← ${pidd_rm__path}" rm -r "${pidd_rm__path}" || exit fi @@ -764,7 +764,7 @@ pidd_rm() { pidd_sed() { pidd_sed__file="${1}" shift - if [ -f "${pidd_sed__file}" ] ; then + if [ -f "${pidd_sed__file}" ]; then pidd_cat "${pidd_sed__file}" for pidd_sed__regex in "${@}" ; do sed --in-place "s${pidd_sed__regex}g" "${pidd_sed__file}" \ @@ -793,7 +793,7 @@ ${PIDD___UP}" pidd_write() { pidd_write__file="${1}" pidd_write__text="${2}" - if [ -n "${pidd_write__file}" ] ; then + if [ -n "${pidd_write__file}" ]; then [ -f "${pidd_write__file}" ] && pidd_cat "${pidd_write__file}" echo "→ ${pidd_write__file}" printf "%s" "${pidd_write__text}" > "${pidd_write__file}" || exit From 3a8c567bebbd63cc4c0cbdc5b230e622a4b2f85e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 11:06:19 +0200 Subject: [PATCH 12/30] " | " --- pidd.sh | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pidd.sh b/pidd.sh index 50d512c..a296a92 100644 --- a/pidd.sh +++ b/pidd.sh @@ -72,7 +72,7 @@ pidd_set_environment_variables() { esac # set operating system version 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 \ | sed "s|^\([0-9]\+\)\..*|\1|") ;; @@ -80,46 +80,46 @@ pidd_set_environment_variables() { PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ | 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)" ;; *) ;; esac # check operating system version case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}"|"${PIDD_OS_ROCKY}") + "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}") case "${PIDD_OS_VERSION}" in - "8"|"9") ;; + "8" | "9") ;; *) pidd_error_os "PIDD_OS_VERSION" ;; esac ;; "${PIDD_OS_ALPINE}") case "${PIDD_OS_VERSION}" in - "3.18"|"3.19") ;; + "3.18" | "3.19") ;; *) pidd_error_os "PIDD_OS_VERSION" ;; esac ;; "${PIDD_OS_ARCH}") case "${PIDD_OS_VERSION}" in - "20231112"|"20240101") ;; + "20231112" | "20240101") ;; *) pidd_error_os "PIDD_OS_VERSION" ;; esac ;; "${PIDD_OS_DEBIAN}") case "${PIDD_OS_VERSION}" in - "bookworm"|"bullseye") ;; + "bookworm" | "bullseye") ;; *) pidd_error_os "PIDD_OS_VERSION" ;; esac ;; "${PIDD_OS_FEDORA}") case "${PIDD_OS_VERSION}" in - "39"|"40") ;; + "39" | "40") ;; *) pidd_error_os "PIDD_OS_VERSION" ;; esac ;; "${PIDD_OS_UBUNTU}") case "${PIDD_OS_VERSION}" in - "jammy"|"noble") ;; + "jammy" | "noble") ;; *) pidd_error_os "PIDD_OS_VERSION" ;; esac ;; @@ -138,7 +138,7 @@ pidd_set_environment_variables() { pidd_echo "PIDD_DNS_FILE" "PIDD_PKG_CA" "PIDD_PKG_GIT" "PIDD_PYTHON_ALIAS" # set ca command & root 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_CMD_CA="update-ca-trust" ;; @@ -150,7 +150,7 @@ pidd_set_environment_variables() { PIDD_CA_ROOT="/etc/ca-certificates/trust-source/anchors" 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_CMD_CA="update-ca-certificates" ;; @@ -163,10 +163,10 @@ pidd_set_environment_variables() { "${PIDD_OS_ALPINE}") PIDD_PM="${PIDD_PM_APK}" ;; - "${PIDD_OS_DEBIAN}"|"${PIDD_OS_UBUNTU}") + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") 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_OS_ARCH}") @@ -311,7 +311,7 @@ Acquire::https::Verify-Peer False; pidd_echo "PIDD_URL_DEFAULT" "PIDD_URL_CHOSEN" # set python command & package case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}"|"${PIDD_OS_ROCKY}") + "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}") PIDD_PYTHON_COMMAND="python3.11" PIDD_PYTHON_PACKAGE="python3.11" ;; @@ -347,13 +347,13 @@ Acquire::https::Verify-Peer False; esac # set python packages 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_OS_ALPINE}"|"${PIDD_OS_ARCH}") + "${PIDD_OS_ALPINE}" | "${PIDD_OS_ARCH}") 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" ;; *) ;; @@ -436,7 +436,7 @@ Acquire::https::Verify-Peer False; "PIDD_PROJECT_PATH" "PIDD_PROJECT_NAME" "PIDD_PROJECT_BRANCH" # TODO move to Python 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_PACMAN}") PIDD_PKG_SSH="openssh" ;; *) ;; @@ -501,7 +501,7 @@ pidd_set_packages_configuration() { pidd_step "Set packages configuration" pidd_write "${PIDD_PM_CONF_PATH}" "${PIDD_PM_CONF_TEXT}" case "${PIDD_OS_ID}" in - "${PIDD_OS_DEBIAN}"|"${PIDD_OS_UBUNTU}") + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") export DEBIAN_FRONTEND="noninteractive" ;; *) ;; From 1bbfa13c10be900965fcfa1dab579f7fab4e0b27 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 11:19:15 +0200 Subject: [PATCH 13/30] \t --- pidd.sh | 1222 +++++++++++++++++++++++++++---------------------------- 1 file changed, 611 insertions(+), 611 deletions(-) diff --git a/pidd.sh b/pidd.sh index a296a92..cbb497a 100644 --- a/pidd.sh +++ b/pidd.sh @@ -9,183 +9,183 @@ # main pidd_main() { - pidd_list_environment_variables - pidd_list_working_directory - # - pidd_set_environment_variables - pidd_set_packages_repositories - pidd_set_packages_configuration - # - pidd_set_https_verification_off - pidd_set_dns_resolving - pidd_update_packages_catalog - pidd_install_packages_tools - pidd_install_ca_certificates - pidd_write_ca_certificates - pidd_update_ca_certificates - pidd_set_https_verification_on - pidd_update_packages_catalog - pidd_upgrade_packages - pidd_install_git - pidd_install_python - # TODO move to Python - pidd_install_rsync - # TODO move to Python - pidd_install_ssh - pidd_clean_packages_cache - pidd_install_python_modules - pidd_write_python_module - pidd_switch_to_python "${@}" + pidd_list_environment_variables + pidd_list_working_directory + # + pidd_set_environment_variables + pidd_set_packages_repositories + pidd_set_packages_configuration + # + pidd_set_https_verification_off + pidd_set_dns_resolving + pidd_update_packages_catalog + pidd_install_packages_tools + pidd_install_ca_certificates + pidd_write_ca_certificates + pidd_update_ca_certificates + pidd_set_https_verification_on + pidd_update_packages_catalog + pidd_upgrade_packages + pidd_install_git + pidd_install_python + # TODO move to Python + pidd_install_rsync + # TODO move to Python + pidd_install_ssh + pidd_clean_packages_cache + pidd_install_python_modules + pidd_write_python_module + pidd_switch_to_python "${@}" } # context pidd_list_environment_variables() { - pidd_step "List environment variables" - env | sort + pidd_step "List environment variables" + env | sort } pidd_list_working_directory() { - pidd_step "List working directory" - pidd_lwd__path="$(realpath .)" - pidd_ls "${pidd_lwd__path}" + pidd_step "List working directory" + pidd_lwd__path="$(realpath .)" + pidd_ls "${pidd_lwd__path}" } # steps pidd_set_environment_variables() { - pidd_step "Set environment variables" - # set path - PIDD_PATH="$(realpath "${0}")" - pidd_echo "PIDD_PATH" - # set operating system id - PIDD_OS_ID="$(pidd_grep_os ID)" - case "${PIDD_OS_ID}" in - "almalinux") PIDD_OS_ID="${PIDD_OS_ALMA}" ;; - "alpine") PIDD_OS_ID="${PIDD_OS_ALPINE}" ;; - "arch") PIDD_OS_ID="${PIDD_OS_ARCH}" ;; - "debian") PIDD_OS_ID="${PIDD_OS_DEBIAN}" ;; - "fedora") PIDD_OS_ID="${PIDD_OS_FEDORA}" ;; - "rocky") PIDD_OS_ID="${PIDD_OS_ROCKY}" ;; - "ubuntu") PIDD_OS_ID="${PIDD_OS_UBUNTU}" ;; - *) pidd_error_os "PIDD_OS_ID" ;; - esac - # set operating system version - case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_ARCH}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") - PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ - | sed "s|^\([0-9]\+\)\..*|\1|") - ;; - "${PIDD_OS_ALPINE}") - PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ - | sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|") - ;; - "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - PIDD_OS_VERSION="$(pidd_grep_os VERSION_CODENAME)" - ;; - *) ;; - esac - # check operating system version - case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}") - case "${PIDD_OS_VERSION}" in - "8" | "9") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac - ;; - "${PIDD_OS_ALPINE}") - case "${PIDD_OS_VERSION}" in - "3.18" | "3.19") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac - ;; - "${PIDD_OS_ARCH}") - case "${PIDD_OS_VERSION}" in - "20231112" | "20240101") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac - ;; - "${PIDD_OS_DEBIAN}") - case "${PIDD_OS_VERSION}" in - "bookworm" | "bullseye") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac - ;; - "${PIDD_OS_FEDORA}") - case "${PIDD_OS_VERSION}" in - "39" | "40") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac - ;; - "${PIDD_OS_UBUNTU}") - case "${PIDD_OS_VERSION}" in - "jammy" | "noble") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac - ;; - *) ;; - esac - pidd_split - pidd_echo "PIDD_OS_ID" "PIDD_OS_VERSION" - # universal - PIDD_DNS_FILE="/etc/resolv.conf" - PIDD_PKG_CA="ca-certificates" - PIDD_PKG_GIT="git" - # TODO move to Python - PIDD_PKG_RSYNC="rsync" - PIDD_PYTHON_ALIAS="python3" - pidd_split - pidd_echo "PIDD_DNS_FILE" "PIDD_PKG_CA" "PIDD_PKG_GIT" "PIDD_PYTHON_ALIAS" - # set ca command & root - case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") - PIDD_CA_ROOT="/etc/pki/ca-trust/source/anchors" - PIDD_CMD_CA="update-ca-trust" - ;; - "${PIDD_OS_ALPINE}") - PIDD_CA_ROOT="/usr/local/share/ca-certificates" - PIDD_CMD_CA="update-ca-certificates" - ;; - "${PIDD_OS_ARCH}") - PIDD_CA_ROOT="/etc/ca-certificates/trust-source/anchors" - PIDD_CMD_CA="update-ca-trust" - ;; - "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - PIDD_CA_ROOT="/usr/local/share/ca-certificates" - PIDD_CMD_CA="update-ca-certificates" - ;; - *) ;; - esac - pidd_split - pidd_echo "PIDD_CA_ROOT" "PIDD_CMD_CA" - # set package manager - case "${PIDD_OS_ID}" in - "${PIDD_OS_ALPINE}") - PIDD_PM="${PIDD_PM_APK}" - ;; - "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - PIDD_PM="${PIDD_PM_APT}" - ;; - "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") - PIDD_PM="${PIDD_PM_DNF}" - ;; - "${PIDD_OS_ARCH}") - PIDD_PM="${PIDD_PM_PACMAN}" - ;; - *) ;; - esac - pidd_split - pidd_echo "PIDD_PM" - case "${PIDD_PM}" in - "${PIDD_PM_DNF}") - PIDD_PM_CLEAN="dnf clean all" - PIDD_PM_INSTALL="dnf install --assumeyes" - PIDD_PM_QUERY="rpm --query" - PIDD_PM_UPDATE="dnf makecache" - PIDD_PM_UPGRADE="dnf upgrade --assumeyes" - PIDD_PKG_PKG="" - PIDD_PM_CONF_PATH="/etc/dnf/dnf.conf" - PIDD_PM_CONF_TEXT="\ + pidd_step "Set environment variables" + # set path + PIDD_PATH="$(realpath "${0}")" + pidd_echo "PIDD_PATH" + # set operating system id + PIDD_OS_ID="$(pidd_grep_os ID)" + case "${PIDD_OS_ID}" in + "almalinux") PIDD_OS_ID="${PIDD_OS_ALMA}" ;; + "alpine") PIDD_OS_ID="${PIDD_OS_ALPINE}" ;; + "arch") PIDD_OS_ID="${PIDD_OS_ARCH}" ;; + "debian") PIDD_OS_ID="${PIDD_OS_DEBIAN}" ;; + "fedora") PIDD_OS_ID="${PIDD_OS_FEDORA}" ;; + "rocky") PIDD_OS_ID="${PIDD_OS_ROCKY}" ;; + "ubuntu") PIDD_OS_ID="${PIDD_OS_UBUNTU}" ;; + *) pidd_error_os "PIDD_OS_ID" ;; + esac + # set operating system version + case "${PIDD_OS_ID}" in + "${PIDD_OS_ALMA}" | "${PIDD_OS_ARCH}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") + PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ + | sed "s|^\([0-9]\+\)\..*|\1|") + ;; + "${PIDD_OS_ALPINE}") + PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ + | sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|") + ;; + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") + PIDD_OS_VERSION="$(pidd_grep_os VERSION_CODENAME)" + ;; + *) ;; + esac + # check operating system version + case "${PIDD_OS_ID}" in + "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}") + case "${PIDD_OS_VERSION}" in + "8" | "9") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac + ;; + "${PIDD_OS_ALPINE}") + case "${PIDD_OS_VERSION}" in + "3.18" | "3.19") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac + ;; + "${PIDD_OS_ARCH}") + case "${PIDD_OS_VERSION}" in + "20231112" | "20240101") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac + ;; + "${PIDD_OS_DEBIAN}") + case "${PIDD_OS_VERSION}" in + "bookworm" | "bullseye") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac + ;; + "${PIDD_OS_FEDORA}") + case "${PIDD_OS_VERSION}" in + "39" | "40") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac + ;; + "${PIDD_OS_UBUNTU}") + case "${PIDD_OS_VERSION}" in + "jammy" | "noble") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac + ;; + *) ;; + esac + pidd_split + pidd_echo "PIDD_OS_ID" "PIDD_OS_VERSION" + # universal + PIDD_DNS_FILE="/etc/resolv.conf" + PIDD_PKG_CA="ca-certificates" + PIDD_PKG_GIT="git" + # TODO move to Python + PIDD_PKG_RSYNC="rsync" + PIDD_PYTHON_ALIAS="python3" + pidd_split + pidd_echo "PIDD_DNS_FILE" "PIDD_PKG_CA" "PIDD_PKG_GIT" "PIDD_PYTHON_ALIAS" + # set ca command & root + case "${PIDD_OS_ID}" in + "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") + PIDD_CA_ROOT="/etc/pki/ca-trust/source/anchors" + PIDD_CMD_CA="update-ca-trust" + ;; + "${PIDD_OS_ALPINE}") + PIDD_CA_ROOT="/usr/local/share/ca-certificates" + PIDD_CMD_CA="update-ca-certificates" + ;; + "${PIDD_OS_ARCH}") + PIDD_CA_ROOT="/etc/ca-certificates/trust-source/anchors" + PIDD_CMD_CA="update-ca-trust" + ;; + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") + PIDD_CA_ROOT="/usr/local/share/ca-certificates" + PIDD_CMD_CA="update-ca-certificates" + ;; + *) ;; + esac + pidd_split + pidd_echo "PIDD_CA_ROOT" "PIDD_CMD_CA" + # set package manager + case "${PIDD_OS_ID}" in + "${PIDD_OS_ALPINE}") + PIDD_PM="${PIDD_PM_APK}" + ;; + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") + PIDD_PM="${PIDD_PM_APT}" + ;; + "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") + PIDD_PM="${PIDD_PM_DNF}" + ;; + "${PIDD_OS_ARCH}") + PIDD_PM="${PIDD_PM_PACMAN}" + ;; + *) ;; + esac + pidd_split + pidd_echo "PIDD_PM" + case "${PIDD_PM}" in + "${PIDD_PM_DNF}") + PIDD_PM_CLEAN="dnf clean all" + PIDD_PM_INSTALL="dnf install --assumeyes" + PIDD_PM_QUERY="rpm --query" + PIDD_PM_UPDATE="dnf makecache" + PIDD_PM_UPGRADE="dnf upgrade --assumeyes" + PIDD_PKG_PKG="" + PIDD_PM_CONF_PATH="/etc/dnf/dnf.conf" + PIDD_PM_CONF_TEXT="\ [main] best=True clean_requirements_on_remove=True @@ -193,612 +193,612 @@ gpgcheck=1 installonly_limit=3 skip_if_unavailable=False " - PIDD_PM_HTTPS_PATH="/etc/dnf/dnf.conf.d/https.conf" - PIDD_PM_HTTPS_TEXT="\ + PIDD_PM_HTTPS_PATH="/etc/dnf/dnf.conf.d/https.conf" + PIDD_PM_HTTPS_TEXT="\ sslverify=False " - ;; - "${PIDD_PM_APK}") - PIDD_PM_CLEAN="apk cache purge" - PIDD_PM_INSTALL="apk add" - PIDD_PM_QUERY="apk info" - PIDD_PM_UPDATE="apk update" - PIDD_PM_UPGRADE="apk upgrade" - PIDD_PKG_PKG="" - PIDD_PM_CONF_PATH="" - PIDD_PM_CONF_TEXT="" - PIDD_PM_HTTPS_PATH="/etc/apk/repositories.d/https" - PIDD_PM_HTTPS_TEXT="\ + ;; + "${PIDD_PM_APK}") + PIDD_PM_CLEAN="apk cache purge" + PIDD_PM_INSTALL="apk add" + PIDD_PM_QUERY="apk info" + PIDD_PM_UPDATE="apk update" + PIDD_PM_UPGRADE="apk upgrade" + PIDD_PKG_PKG="" + PIDD_PM_CONF_PATH="" + PIDD_PM_CONF_TEXT="" + PIDD_PM_HTTPS_PATH="/etc/apk/repositories.d/https" + PIDD_PM_HTTPS_TEXT="\ --no-verify " - ;; - "${PIDD_PM_PACMAN}") - PIDD_PM_CLEAN="pacman --sync --clean --noconfirm" - PIDD_PM_INSTALL="pacman --sync --noconfirm" - PIDD_PM_QUERY="pacman --query" - PIDD_PM_UPDATE="pacman --sync --refresh" - PIDD_PM_UPGRADE="pacman --sync --sysupgrade --noconfirm" - PIDD_PKG_PKG="" - PIDD_PM_CONF_PATH="" - PIDD_PM_CONF_TEXT="" - PIDD_PM_HTTPS_PATH="/etc/pacman.d/https.conf" - PIDD_PM_HTTPS_TEXT="\ + ;; + "${PIDD_PM_PACMAN}") + PIDD_PM_CLEAN="pacman --sync --clean --noconfirm" + PIDD_PM_INSTALL="pacman --sync --noconfirm" + PIDD_PM_QUERY="pacman --query" + PIDD_PM_UPDATE="pacman --sync --refresh" + PIDD_PM_UPGRADE="pacman --sync --sysupgrade --noconfirm" + PIDD_PKG_PKG="" + PIDD_PM_CONF_PATH="" + PIDD_PM_CONF_TEXT="" + PIDD_PM_HTTPS_PATH="/etc/pacman.d/https.conf" + PIDD_PM_HTTPS_TEXT="\ SSLVerify = No " - ;; - "${PIDD_PM_APT}") - PIDD_PM_CLEAN="apt-get clean" - PIDD_PM_INSTALL="apt-get install --assume-yes" - PIDD_PM_QUERY="dpkg-query --show" - PIDD_PM_UPDATE="apt-get update" - PIDD_PM_UPGRADE="apt-get upgrade --assume-yes" - PIDD_PKG_PKG="apt-utils" - PIDD_PM_CONF_PATH="/etc/apt/apt.conf.d/apt.conf" - PIDD_PM_CONF_TEXT="\ + ;; + "${PIDD_PM_APT}") + PIDD_PM_CLEAN="apt-get clean" + PIDD_PM_INSTALL="apt-get install --assume-yes" + PIDD_PM_QUERY="dpkg-query --show" + PIDD_PM_UPDATE="apt-get update" + PIDD_PM_UPGRADE="apt-get upgrade --assume-yes" + PIDD_PKG_PKG="apt-utils" + PIDD_PM_CONF_PATH="/etc/apt/apt.conf.d/apt.conf" + PIDD_PM_CONF_TEXT="\ Acquire::Check-Valid-Until True; APT::Get::Show-Versions True; APT::Install-Recommends False; APT::Install-Suggests False; Dir::Etc::SourceParts \"\"; " - PIDD_PM_HTTPS_PATH="/etc/apt/apt.conf.d/https" - PIDD_PM_HTTPS_TEXT="\ + PIDD_PM_HTTPS_PATH="/etc/apt/apt.conf.d/https" + PIDD_PM_HTTPS_TEXT="\ Acquire::https::Verify-Peer False; " - ;; - *) ;; - esac - pidd_split - pidd_echo "PIDD_PM_CLEAN" \ - "PIDD_PM_INSTALL" "PIDD_PM_QUERY" "PIDD_PM_UPDATE" "PIDD_PM_UPGRADE" - pidd_split - pidd_echo "PIDD_PKG_PKG" "PIDD_PM_CONF_PATH" "PIDD_PM_HTTPS_PATH" - # specific - case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}") - PIDD_URL_DEFAULT="https://repo.almalinux.org/almalinux" - ;; - "${PIDD_OS_ALPINE}") - PIDD_URL_DEFAULT="https://dl-cdn.alpinelinux.org/alpine" - ;; - "${PIDD_OS_ARCH}") - PIDD_URL_DEFAULT="https://geo.mirror.pkgbuild.com" - ;; - "${PIDD_OS_DEBIAN}") - PIDD_URL_DEFAULT="http://deb.debian.org/debian" - ;; - "${PIDD_OS_FEDORA}") - PIDD_URL_DEFAULT="http://download.example/pub/fedora/linux/releases" - ;; - "${PIDD_OS_ROCKY}") - PIDD_URL_DEFAULT="http://dl.rockylinux.org/\$contentdir" - ;; - "${PIDD_OS_UBUNTU}") - PIDD_URL_DEFAULT="http://archive.ubuntu.com/ubuntu" - ;; - *) ;; - esac - PIDD_URL_CHOSEN="${PIDD_URL_DEFAULT}" - case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}") - [ -n "${PIDD_URL_ALMA}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ALMA}" - ;; - "${PIDD_OS_ALPINE}") - [ -n "${PIDD_URL_ALPINE}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ALPINE}" - ;; - "${PIDD_OS_ARCH}") - [ -n "${PIDD_URL_ARCH}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ARCH}" - ;; - "${PIDD_OS_DEBIAN}") - [ -n "${PIDD_URL_DEBIAN}" ] && PIDD_URL_CHOSEN="${PIDD_URL_DEBIAN}" \ - || PIDD_URL_CHOSEN="https://deb.debian.org/debian" - ;; - "${PIDD_OS_FEDORA}") - [ -n "${PIDD_URL_FEDORA}" ] && PIDD_URL_CHOSEN="${PIDD_URL_FEDORA}" \ - || PIDD_URL_CHOSEN="https://rpmfind.net/linux/fedora/linux/releases" - ;; - "${PIDD_OS_ROCKY}") - [ -n "${PIDD_URL_ROCKY}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ROCKY}" \ - || PIDD_URL_CHOSEN="https://dl.rockylinux.org/\$contentdir" - ;; - "${PIDD_OS_UBUNTU}") - [ -n "${PIDD_URL_UBUNTU}" ] && PIDD_URL_CHOSEN="${PIDD_URL_UBUNTU}" \ - || PIDD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu" - ;; - *) ;; - esac - pidd_split - pidd_echo "PIDD_URL_DEFAULT" "PIDD_URL_CHOSEN" - # set python command & package - case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}") - PIDD_PYTHON_COMMAND="python3.11" - PIDD_PYTHON_PACKAGE="python3.11" - ;; - "${PIDD_OS_ALPINE}") - PIDD_PYTHON_COMMAND="python3.11" - PIDD_PYTHON_PACKAGE="python3" - ;; - "${PIDD_OS_ARCH}") - PIDD_PYTHON_COMMAND="python3.12" - PIDD_PYTHON_PACKAGE="python" - ;; - "${PIDD_OS_DEBIAN}") - case "${PIDD_OS_VERSION}" in - "bookworm") PIDD_PYTHON_COMMAND="python3.11" ;; - "bullseye") PIDD_PYTHON_COMMAND="python3.9" ;; - *) ;; - esac - PIDD_PYTHON_PACKAGE="python3" - ;; - "${PIDD_OS_FEDORA}") - PIDD_PYTHON_COMMAND="python3.12" - PIDD_PYTHON_PACKAGE="python3" - ;; - "${PIDD_OS_UBUNTU}") - case "${PIDD_OS_VERSION}" in - "noble") PIDD_PYTHON_COMMAND="python3.12" ;; - "jammy") PIDD_PYTHON_COMMAND="python3.10" ;; - *) ;; - esac - PIDD_PYTHON_PACKAGE="python3" - ;; - *) ;; - esac - # set python packages - case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") - PIDD_PYTHON_PACKAGES="/usr/lib64/${PIDD_PYTHON_COMMAND}/site-packages" - ;; - "${PIDD_OS_ALPINE}" | "${PIDD_OS_ARCH}") - PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_COMMAND}/site-packages" - ;; - "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_ALIAS}/dist-packages" - ;; - *) ;; - esac - pidd_split - pidd_echo "PIDD_PYTHON_COMMAND" "PIDD_PYTHON_PACKAGE" "PIDD_PYTHON_PACKAGES" - # variables - [ -n "${PIDD_CA_1}" ] && PIDD_CA=true - # continuous integration platform - if [ -n "${GITHUB_ACTIONS}" ]; then - # github → gitea → forgejo - if [ -n "${GITHUB_SERVER_URL}" ]; then - PIDD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")//" - if [ -n "${GITHUB_TOKEN}" ]; then - PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}${GITHUB_TOKEN}@" - fi - PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")" - else - pidd_error_ci "GITHUB_SERVER_URL" - fi - if [ -n "${GITHUB_REPOSITORY}" ]; then - PIDD_PROJECT_PATH="$(dirname "${GITHUB_REPOSITORY}")" - PIDD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")" - else - pidd_error_ci "GITHUB_REPOSITORY" - fi - if [ -n "${GITHUB_REF_NAME}" ]; then - PIDD_PROJECT_BRANCH="${GITHUB_REF_NAME}" - else - pidd_error_ci "GITHUB_REF_NAME" - fi - elif [ -n "${GITLAB_CI}" ]; then - # gitlab - if [ -n "${CI_SERVER_PROTOCOL}" ]; then - if [ -n "${CI_REGISTRY_USER}" ]; then - if [ -n "${CI_REGISTRY_PASSWORD}" ]; then - if [ -n "${CI_SERVER_FQDN}" ]; then - PIDD_PROJECT_ROOT="${CI_SERVER_PROTOCOL}\ + ;; + *) ;; + esac + pidd_split + pidd_echo "PIDD_PM_CLEAN" \ + "PIDD_PM_INSTALL" "PIDD_PM_QUERY" "PIDD_PM_UPDATE" "PIDD_PM_UPGRADE" + pidd_split + pidd_echo "PIDD_PKG_PKG" "PIDD_PM_CONF_PATH" "PIDD_PM_HTTPS_PATH" + # specific + case "${PIDD_OS_ID}" in + "${PIDD_OS_ALMA}") + PIDD_URL_DEFAULT="https://repo.almalinux.org/almalinux" + ;; + "${PIDD_OS_ALPINE}") + PIDD_URL_DEFAULT="https://dl-cdn.alpinelinux.org/alpine" + ;; + "${PIDD_OS_ARCH}") + PIDD_URL_DEFAULT="https://geo.mirror.pkgbuild.com" + ;; + "${PIDD_OS_DEBIAN}") + PIDD_URL_DEFAULT="http://deb.debian.org/debian" + ;; + "${PIDD_OS_FEDORA}") + PIDD_URL_DEFAULT="http://download.example/pub/fedora/linux/releases" + ;; + "${PIDD_OS_ROCKY}") + PIDD_URL_DEFAULT="http://dl.rockylinux.org/\$contentdir" + ;; + "${PIDD_OS_UBUNTU}") + PIDD_URL_DEFAULT="http://archive.ubuntu.com/ubuntu" + ;; + *) ;; + esac + PIDD_URL_CHOSEN="${PIDD_URL_DEFAULT}" + case "${PIDD_OS_ID}" in + "${PIDD_OS_ALMA}") + [ -n "${PIDD_URL_ALMA}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ALMA}" + ;; + "${PIDD_OS_ALPINE}") + [ -n "${PIDD_URL_ALPINE}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ALPINE}" + ;; + "${PIDD_OS_ARCH}") + [ -n "${PIDD_URL_ARCH}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ARCH}" + ;; + "${PIDD_OS_DEBIAN}") + [ -n "${PIDD_URL_DEBIAN}" ] && PIDD_URL_CHOSEN="${PIDD_URL_DEBIAN}" \ + || PIDD_URL_CHOSEN="https://deb.debian.org/debian" + ;; + "${PIDD_OS_FEDORA}") + [ -n "${PIDD_URL_FEDORA}" ] && PIDD_URL_CHOSEN="${PIDD_URL_FEDORA}" \ + || PIDD_URL_CHOSEN="https://rpmfind.net/linux/fedora/linux/releases" + ;; + "${PIDD_OS_ROCKY}") + [ -n "${PIDD_URL_ROCKY}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ROCKY}" \ + || PIDD_URL_CHOSEN="https://dl.rockylinux.org/\$contentdir" + ;; + "${PIDD_OS_UBUNTU}") + [ -n "${PIDD_URL_UBUNTU}" ] && PIDD_URL_CHOSEN="${PIDD_URL_UBUNTU}" \ + || PIDD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu" + ;; + *) ;; + esac + pidd_split + pidd_echo "PIDD_URL_DEFAULT" "PIDD_URL_CHOSEN" + # set python command & package + case "${PIDD_OS_ID}" in + "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}") + PIDD_PYTHON_COMMAND="python3.11" + PIDD_PYTHON_PACKAGE="python3.11" + ;; + "${PIDD_OS_ALPINE}") + PIDD_PYTHON_COMMAND="python3.11" + PIDD_PYTHON_PACKAGE="python3" + ;; + "${PIDD_OS_ARCH}") + PIDD_PYTHON_COMMAND="python3.12" + PIDD_PYTHON_PACKAGE="python" + ;; + "${PIDD_OS_DEBIAN}") + case "${PIDD_OS_VERSION}" in + "bookworm") PIDD_PYTHON_COMMAND="python3.11" ;; + "bullseye") PIDD_PYTHON_COMMAND="python3.9" ;; + *) ;; + esac + PIDD_PYTHON_PACKAGE="python3" + ;; + "${PIDD_OS_FEDORA}") + PIDD_PYTHON_COMMAND="python3.12" + PIDD_PYTHON_PACKAGE="python3" + ;; + "${PIDD_OS_UBUNTU}") + case "${PIDD_OS_VERSION}" in + "noble") PIDD_PYTHON_COMMAND="python3.12" ;; + "jammy") PIDD_PYTHON_COMMAND="python3.10" ;; + *) ;; + esac + PIDD_PYTHON_PACKAGE="python3" + ;; + *) ;; + esac + # set python packages + case "${PIDD_OS_ID}" in + "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") + PIDD_PYTHON_PACKAGES="/usr/lib64/${PIDD_PYTHON_COMMAND}/site-packages" + ;; + "${PIDD_OS_ALPINE}" | "${PIDD_OS_ARCH}") + PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_COMMAND}/site-packages" + ;; + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") + PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_ALIAS}/dist-packages" + ;; + *) ;; + esac + pidd_split + pidd_echo "PIDD_PYTHON_COMMAND" "PIDD_PYTHON_PACKAGE" "PIDD_PYTHON_PACKAGES" + # variables + [ -n "${PIDD_CA_1}" ] && PIDD_CA=true + # continuous integration platform + if [ -n "${GITHUB_ACTIONS}" ]; then + # github → gitea → forgejo + if [ -n "${GITHUB_SERVER_URL}" ]; then + PIDD_PROJECT_ROOT="$(dirname "${GITHUB_SERVER_URL}")//" + if [ -n "${GITHUB_TOKEN}" ]; then + PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}${GITHUB_TOKEN}@" + fi + PIDD_PROJECT_ROOT="${PIDD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")" + else + pidd_error_ci "GITHUB_SERVER_URL" + fi + if [ -n "${GITHUB_REPOSITORY}" ]; then + PIDD_PROJECT_PATH="$(dirname "${GITHUB_REPOSITORY}")" + PIDD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")" + else + pidd_error_ci "GITHUB_REPOSITORY" + fi + if [ -n "${GITHUB_REF_NAME}" ]; then + PIDD_PROJECT_BRANCH="${GITHUB_REF_NAME}" + else + pidd_error_ci "GITHUB_REF_NAME" + fi + elif [ -n "${GITLAB_CI}" ]; then + # gitlab + if [ -n "${CI_SERVER_PROTOCOL}" ]; then + if [ -n "${CI_REGISTRY_USER}" ]; then + if [ -n "${CI_REGISTRY_PASSWORD}" ]; then + if [ -n "${CI_SERVER_FQDN}" ]; then + PIDD_PROJECT_ROOT="${CI_SERVER_PROTOCOL}\ ://${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD}@${CI_SERVER_FQDN}" - if [ -n "${CI_PROJECT_NAMESPACE}" ]; then - PIDD_PROJECT_PATH="${CI_PROJECT_NAMESPACE}" - if [ -n "${CI_PROJECT_NAME}" ]; then - PIDD_PROJECT_NAME="${CI_PROJECT_NAME}" - else - pidd_error_ci "CI_PROJECT_NAME" - fi - else - pidd_error_ci "CI_PROJECT_NAMESPACE" - fi - else - pidd_error_ci "CI_SERVER_FQDN" - fi - else - pidd_error_ci "CI_REGISTRY_PASSWORD" - fi - else - pidd_error_ci "CI_REGISTRY_USER" - fi - else - pidd_error_ci "CI_SERVER_PROTOCOL" - fi - if [ -n "${CI_COMMIT_BRANCH}" ]; then - PIDD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}" - else - pidd_error_ci "CI_COMMIT_BRANCH" - fi - else - # unsupported - pidd_error_ci "ø" - fi - [ -n "${PIDD_PROJECT_ROOT}" ] || pidd_error_ci "PIDD_PROJECT_ROOT" - [ -n "${PIDD_PROJECT_PATH}" ] || pidd_error_ci "PIDD_PROJECT_PATH" - [ -n "${PIDD_PROJECT_NAME}" ] || pidd_error_ci "PIDD_PROJECT_NAME" - [ -n "${PIDD_PROJECT_BRANCH}" ] || pidd_error_ci "PIDD_PROJECT_BRANCH" - # - pidd_split - pidd_echo "PIDD_CA" - pidd_split - pidd_echo "PIDD_PROJECT_ROOT" \ - "PIDD_PROJECT_PATH" "PIDD_PROJECT_NAME" "PIDD_PROJECT_BRANCH" - # TODO move to Python - case "${PIDD_PM}" in - "${PIDD_PM_APK}" | "${PIDD_PM_APT}") PIDD_PKG_SSH="openssh-client" ;; - "${PIDD_PM_DNF}") PIDD_PKG_SSH="openssh-clients" ;; - "${PIDD_PM_PACMAN}") PIDD_PKG_SSH="openssh" ;; - *) ;; - esac + if [ -n "${CI_PROJECT_NAMESPACE}" ]; then + PIDD_PROJECT_PATH="${CI_PROJECT_NAMESPACE}" + if [ -n "${CI_PROJECT_NAME}" ]; then + PIDD_PROJECT_NAME="${CI_PROJECT_NAME}" + else + pidd_error_ci "CI_PROJECT_NAME" + fi + else + pidd_error_ci "CI_PROJECT_NAMESPACE" + fi + else + pidd_error_ci "CI_SERVER_FQDN" + fi + else + pidd_error_ci "CI_REGISTRY_PASSWORD" + fi + else + pidd_error_ci "CI_REGISTRY_USER" + fi + else + pidd_error_ci "CI_SERVER_PROTOCOL" + fi + if [ -n "${CI_COMMIT_BRANCH}" ]; then + PIDD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}" + else + pidd_error_ci "CI_COMMIT_BRANCH" + fi + else + # unsupported + pidd_error_ci "ø" + fi + [ -n "${PIDD_PROJECT_ROOT}" ] || pidd_error_ci "PIDD_PROJECT_ROOT" + [ -n "${PIDD_PROJECT_PATH}" ] || pidd_error_ci "PIDD_PROJECT_PATH" + [ -n "${PIDD_PROJECT_NAME}" ] || pidd_error_ci "PIDD_PROJECT_NAME" + [ -n "${PIDD_PROJECT_BRANCH}" ] || pidd_error_ci "PIDD_PROJECT_BRANCH" + # + pidd_split + pidd_echo "PIDD_CA" + pidd_split + pidd_echo "PIDD_PROJECT_ROOT" \ + "PIDD_PROJECT_PATH" "PIDD_PROJECT_NAME" "PIDD_PROJECT_BRANCH" + # TODO move to Python + case "${PIDD_PM}" in + "${PIDD_PM_APK}" | "${PIDD_PM_APT}") PIDD_PKG_SSH="openssh-client" ;; + "${PIDD_PM_DNF}") PIDD_PKG_SSH="openssh-clients" ;; + "${PIDD_PM_PACMAN}") PIDD_PKG_SSH="openssh" ;; + *) ;; + esac } pidd_set_packages_repositories() { - pidd_step "Set packages repositories" - case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}") - case "${PIDD_OS_VERSION}" in - "8") pidd_spr__file="/etc/yum.repos.d/almalinux.repo" ;; - "9") pidd_spr_file="/etc/yum.repos.d/almalinux-baseos.repo" ;; - *) ;; - esac - pidd_sed "${pidd_spr__file}" \ - "|^mirrorlist|# mirrorlist|" \ - "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ - "|^# baseurl|baseurl|" - ;; - "${PIDD_OS_ALPINE}") - pidd_spr__file="/etc/apk/repositories" - pidd_write "${pidd_spr__file}" "\ + pidd_step "Set packages repositories" + case "${PIDD_OS_ID}" in + "${PIDD_OS_ALMA}") + case "${PIDD_OS_VERSION}" in + "8") pidd_spr__file="/etc/yum.repos.d/almalinux.repo" ;; + "9") pidd_spr_file="/etc/yum.repos.d/almalinux-baseos.repo" ;; + *) ;; + esac + pidd_sed "${pidd_spr__file}" \ + "|^mirrorlist|# mirrorlist|" \ + "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ + "|^# baseurl|baseurl|" + ;; + "${PIDD_OS_ALPINE}") + pidd_spr__file="/etc/apk/repositories" + pidd_write "${pidd_spr__file}" "\ ${PIDD_URL_CHOSEN}/v${PIDD_OS_VERSION}/main ${PIDD_URL_CHOSEN}/v${PIDD_OS_VERSION}/community " - ;; - "${PIDD_OS_DEBIAN}") - pidd_spr__file="/etc/apt/sources.list" - pidd_write "${pidd_spr__file}" "\ + ;; + "${PIDD_OS_DEBIAN}") + pidd_spr__file="/etc/apt/sources.list" + pidd_write "${pidd_spr__file}" "\ deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION} main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-backports main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-updates main deb ${PIDD_URL_CHOSEN}-security ${PIDD_OS_VERSION}-security main " - ;; - "${PIDD_OS_ROCKY}") - case "${PIDD_OS_VERSION}" in - "8") pidd_spr__file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;; - "9") pidd_spr__file="/etc/yum.repos.d/rocky.repo" ;; - *) ;; - esac - pidd_sed "${pidd_spr__file}" \ - "|^mirrorlist|# mirrorlist|" \ - "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ - "|^#baseurl|baseurl|" - ;; - "${PIDD_OS_UBUNTU}") - pidd_spr__file="/etc/apt/sources.list" - pidd_write "${pidd_spr__file}" "\ + ;; + "${PIDD_OS_ROCKY}") + case "${PIDD_OS_VERSION}" in + "8") pidd_spr__file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;; + "9") pidd_spr__file="/etc/yum.repos.d/rocky.repo" ;; + *) ;; + esac + pidd_sed "${pidd_spr__file}" \ + "|^mirrorlist|# mirrorlist|" \ + "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ + "|^#baseurl|baseurl|" + ;; + "${PIDD_OS_UBUNTU}") + pidd_spr__file="/etc/apt/sources.list" + pidd_write "${pidd_spr__file}" "\ deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION} main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-backports main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-updates main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-security main " - ;; - *) ;; - esac + ;; + *) ;; + esac } pidd_set_packages_configuration() { - pidd_step "Set packages configuration" - pidd_write "${PIDD_PM_CONF_PATH}" "${PIDD_PM_CONF_TEXT}" - case "${PIDD_OS_ID}" in - "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - export DEBIAN_FRONTEND="noninteractive" - ;; - *) ;; - esac + pidd_step "Set packages configuration" + pidd_write "${PIDD_PM_CONF_PATH}" "${PIDD_PM_CONF_TEXT}" + case "${PIDD_OS_ID}" in + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") + export DEBIAN_FRONTEND="noninteractive" + ;; + *) ;; + esac } # agnostic steps pidd_set_https_verification_off() { - if [ -n "${PIDD_CA}" ] || [ "${PIDD_PM}" = "${PIDD_PM_APT}" ]; then - pidd_step "Set HTTPS verification off" - pidd_mkdir "$(dirname "${PIDD_PM_HTTPS_PATH}")" - pidd_write "${PIDD_PM_HTTPS_PATH}" "${PIDD_PM_HTTPS_TEXT}" - fi + if [ -n "${PIDD_CA}" ] || [ "${PIDD_PM}" = "${PIDD_PM_APT}" ]; then + pidd_step "Set HTTPS verification off" + pidd_mkdir "$(dirname "${PIDD_PM_HTTPS_PATH}")" + pidd_write "${PIDD_PM_HTTPS_PATH}" "${PIDD_PM_HTTPS_TEXT}" + fi } pidd_set_dns_resolving() { - pidd_step "Set DNS resolving" - for pidd_sdr__server in ${PIDD_DNS} ; do - pidd_sdr__text="${pidd_sdr__text}\ + pidd_step "Set DNS resolving" + for pidd_sdr__server in ${PIDD_DNS} ; do + pidd_sdr__text="${pidd_sdr__text}\ nameserver ${pidd_sdr__server} " - done - pidd_write "${PIDD_DNS_FILE}" "${pidd_sdr__text}" + done + pidd_write "${PIDD_DNS_FILE}" "${pidd_sdr__text}" } pidd_update_packages_catalog() { - pidd_step "Update packages catalog" - ${PIDD_PM_UPDATE} || exit + pidd_step "Update packages catalog" + ${PIDD_PM_UPDATE} || exit } pidd_install_packages_tools() { - pidd_step "Install packages tools" - pidd_install_package "${PIDD_PKG_PKG}" + pidd_step "Install packages tools" + pidd_install_package "${PIDD_PKG_PKG}" } pidd_install_ca_certificates() { - pidd_step "Install CA" - pidd_install_package "${PIDD_PKG_CA}" + pidd_step "Install CA" + pidd_install_package "${PIDD_PKG_CA}" } pidd_write_ca_certificates() { - pidd_step "Write CA certificates" - pidd_mkdir "${PIDD_CA_ROOT}" - pidd_wcc__index=1 - eval "pidd_wcc__text=\"\${PIDD_CA_${pidd_wcc__index}}\"" - while [ -n "${pidd_wcc__text}" ] ; do - pidd_wcc__path="${PIDD_CA_ROOT}/${pidd_wcc__index}.crt" - pidd_split - pidd_write \ - "${pidd_wcc__path}" \ - "${pidd_wcc__text}" - pidd_openssl "${pidd_wcc__path}" - pidd_wcc__index=$((pidd_wcc__index+1)) - eval "pidd_wcc__text=\"\${PIDD_CA_${pidd_wcc__index}}\"" - done + pidd_step "Write CA certificates" + pidd_mkdir "${PIDD_CA_ROOT}" + pidd_wcc__index=1 + eval "pidd_wcc__text=\"\${PIDD_CA_${pidd_wcc__index}}\"" + while [ -n "${pidd_wcc__text}" ] ; do + pidd_wcc__path="${PIDD_CA_ROOT}/${pidd_wcc__index}.crt" + pidd_split + pidd_write \ + "${pidd_wcc__path}" \ + "${pidd_wcc__text}" + pidd_openssl "${pidd_wcc__path}" + pidd_wcc__index=$((pidd_wcc__index+1)) + eval "pidd_wcc__text=\"\${PIDD_CA_${pidd_wcc__index}}\"" + done } pidd_update_ca_certificates() { - pidd_step "Update CA certificates" - ${PIDD_CMD_CA} || exit + pidd_step "Update CA certificates" + ${PIDD_CMD_CA} || exit } pidd_set_https_verification_on() { - pidd_step "Set HTTPS verification on" - pidd_rm "${PIDD_PM_HTTPS_PATH}" + pidd_step "Set HTTPS verification on" + pidd_rm "${PIDD_PM_HTTPS_PATH}" } pidd_upgrade_packages() { - pidd_step "Upgrade packages" - ${PIDD_PM_UPGRADE} || exit + pidd_step "Upgrade packages" + ${PIDD_PM_UPGRADE} || exit } pidd_install_git() { - pidd_step "Install Git" - pidd_install_package "${PIDD_PKG_GIT}" + pidd_step "Install Git" + pidd_install_package "${PIDD_PKG_GIT}" } pidd_install_python() { - pidd_step "Install Python" - pidd_install_package "${PIDD_PYTHON_PACKAGE}" - pidd_split - pidd_ln_python "${PIDD_PYTHON_COMMAND}" + pidd_step "Install Python" + pidd_install_package "${PIDD_PYTHON_PACKAGE}" + pidd_split + pidd_ln_python "${PIDD_PYTHON_COMMAND}" } # TODO move to Python pidd_install_rsync() { - pidd_step "Install Rsync" - pidd_install_package "${PIDD_PKG_RSYNC}" + pidd_step "Install Rsync" + pidd_install_package "${PIDD_PKG_RSYNC}" } # TODO move to Python pidd_install_ssh() { - pidd_step "Install SSH" - pidd_install_package "${PIDD_PKG_SSH}" + pidd_step "Install SSH" + pidd_install_package "${PIDD_PKG_SSH}" } pidd_clean_packages_cache() { - pidd_step "Clean packages cache" - ${PIDD_PM_CLEAN} || exit + pidd_step "Clean packages cache" + ${PIDD_PM_CLEAN} || exit } pidd_install_python_modules() { - pidd_step "Install Python modules" - pidd_ipm__root="$(mktemp --directory)" || exit - echo "→ ${pidd_ipm__root}" - for pidd_ipm__repository in "${PIDD_GIT_MAIN}" "${PIDD_GIT_ROOT}" ; do - case "${pidd_ipm__repository}" in - http*) pidd_ipm__url="${pidd_ipm__repository}" ;; - /*) pidd_ipm__url="${PIDD_PROJECT_ROOT}${pidd_ipm__repository}" ;; - *) pidd_ipm__url="\ + pidd_step "Install Python modules" + pidd_ipm__root="$(mktemp --directory)" || exit + echo "→ ${pidd_ipm__root}" + for pidd_ipm__repository in "${PIDD_GIT_MAIN}" "${PIDD_GIT_ROOT}" ; do + case "${pidd_ipm__repository}" in + http*) pidd_ipm__url="${pidd_ipm__repository}" ;; + /*) pidd_ipm__url="${PIDD_PROJECT_ROOT}${pidd_ipm__repository}" ;; + *) pidd_ipm__url="\ ${PIDD_PROJECT_ROOT}/${PIDD_PROJECT_PATH}/${pidd_ipm__repository}" ;; - esac - pidd_ipm__name="$(basename "${pidd_ipm__url}")" - pidd_split - echo "\ + esac + pidd_ipm__name="$(basename "${pidd_ipm__url}")" + pidd_split + echo "\ ${pidd_ipm__url} ↓" - git clone \ - "${pidd_ipm__url}" \ - "${pidd_ipm__root}/${pidd_ipm__name}" \ - || exit - pidd_ipm__path="${pidd_ipm__root}/${pidd_ipm__name}/${pidd_ipm__name}" - echo "\ + git clone \ + "${pidd_ipm__url}" \ + "${pidd_ipm__root}/${pidd_ipm__name}" \ + || exit + pidd_ipm__path="${pidd_ipm__root}/${pidd_ipm__name}/${pidd_ipm__name}" + echo "\ ${pidd_ipm__path} ↓ ${PIDD_PYTHON_PACKAGES}" - cp --recursive "${pidd_ipm__path}" "${PIDD_PYTHON_PACKAGES}" \ - || exit - done - pidd_split - pidd_ls "${PIDD_PYTHON_PACKAGES}" - pidd_split - pidd_rm "${pidd_ipm__root}" + cp --recursive "${pidd_ipm__path}" "${PIDD_PYTHON_PACKAGES}" \ + || exit + done + pidd_split + pidd_ls "${PIDD_PYTHON_PACKAGES}" + pidd_split + pidd_rm "${pidd_ipm__root}" } pidd_write_python_module() { - pidd_step "Write Python module" - for pidd_wpm__variable in \ - OPEN DOWN VERT SPLT __UP SHUT \ - OS_ID OS_VERSION \ - PROJECT_ROOT PROJECT_PATH PROJECT_NAME \ - ; do - pidd_wpm__value="$(pidd_echo "PIDD_${pidd_wpm__variable}")" - pidd_wpm__text="${pidd_wpm__text}${pidd_wpm__value} + pidd_step "Write Python module" + for pidd_wpm__variable in \ + OPEN DOWN VERT SPLT __UP SHUT \ + OS_ID OS_VERSION \ + PROJECT_ROOT PROJECT_PATH PROJECT_NAME \ + ; do + pidd_wpm__value="$(pidd_echo "PIDD_${pidd_wpm__variable}")" + pidd_wpm__text="${pidd_wpm__text}${pidd_wpm__value} " - done - pidd_write "${PIDD_PYTHON_PACKAGES}/env.py" "${pidd_wpm__text} + done + pidd_write "${PIDD_PYTHON_PACKAGES}/env.py" "${pidd_wpm__text} PIDD_STEP = $((PIDD_STEP+1)) " } pidd_switch_to_python() { - pidd_step "Switch to Python" - pidd_stp__name="$(basename "${PIDD_GIT_MAIN}")" - echo "\ + pidd_step "Switch to Python" + pidd_stp__name="$(basename "${PIDD_GIT_MAIN}")" + echo "\ ${PIDD_PATH} ↓ ${PIDD_PYTHON_PACKAGES}/${pidd_stp__name}" - "${PIDD_PYTHON_ALIAS}" -m "${pidd_stp__name}" "${@}" + "${PIDD_PYTHON_ALIAS}" -m "${pidd_stp__name}" "${@}" } # functions pidd_cat() { - pidd_cat__file="${1}" - if [ -n "${pidd_cat__file}" ]; then - pidd_open "${pidd_cat__file}" - cat "${pidd_cat__file}" || exit - pidd_shut "${pidd_cat__file}" - fi + pidd_cat__file="${1}" + if [ -n "${pidd_cat__file}" ]; then + pidd_open "${pidd_cat__file}" + cat "${pidd_cat__file}" || exit + pidd_shut "${pidd_cat__file}" + fi } pidd_echo() { - if [ -n "${1}" ]; then - for pidd_echo__name in "${@}" ; do - pidd_echo__text="" - eval "pidd_echo__text=\"\${${pidd_echo__name}}\"" - echo "${pidd_echo__name} = \"${pidd_echo__text}\"" - done - fi + if [ -n "${1}" ]; then + for pidd_echo__name in "${@}" ; do + pidd_echo__text="" + eval "pidd_echo__text=\"\${${pidd_echo__name}}\"" + echo "${pidd_echo__name} = \"${pidd_echo__text}\"" + done + fi } pidd_error_ci() { - echo "× CI: ${*}" - exit "${PIDD_ERROR_CI}" + echo "× CI: ${*}" + exit "${PIDD_ERROR_CI}" } pidd_error_os() { - pidd_error_os__variable="${1}" - printf "× OS: " - pidd_echo "${pidd_error_os__variable}" - exit "${PIDD_ERROR_OS}" + pidd_error_os__variable="${1}" + printf "× OS: " + pidd_echo "${pidd_error_os__variable}" + exit "${PIDD_ERROR_OS}" } pidd_grep_os() { - pidd_grep_os__variable="${1}" - if [ -n "${pidd_grep_os__variable}" ]; then - grep "^${pidd_grep_os__variable}=" "/etc/os-release" \ - | sed "s|^${pidd_grep_os__variable}=||" \ - | sed "s|^\"\(.*\)\"$|\1|" - fi + pidd_grep_os__variable="${1}" + if [ -n "${pidd_grep_os__variable}" ]; then + grep "^${pidd_grep_os__variable}=" "/etc/os-release" \ + | sed "s|^${pidd_grep_os__variable}=||" \ + | sed "s|^\"\(.*\)\"$|\1|" + fi } pidd_install_package() { - pidd_install_package__name="${1}" - if [ -n "${pidd_install_package__name}" ]; then - ${PIDD_PM_INSTALL} "${pidd_install_package__name}" || exit - fi + pidd_install_package__name="${1}" + if [ -n "${pidd_install_package__name}" ]; then + ${PIDD_PM_INSTALL} "${pidd_install_package__name}" || exit + fi } pidd_ln_python() { - pidd_ln_python__command="${1}" - if [ -n "${pidd_ln_python__command}" ]; then - echo "→ ${PIDD_PYTHON_ALIAS} → ${pidd_ln_python__command}" - ln -f -s "${pidd_ln_python__command}" "/usr/bin/${PIDD_PYTHON_ALIAS}" \ - || exit - fi + pidd_ln_python__command="${1}" + if [ -n "${pidd_ln_python__command}" ]; then + echo "→ ${PIDD_PYTHON_ALIAS} → ${pidd_ln_python__command}" + ln -f -s "${pidd_ln_python__command}" "/usr/bin/${PIDD_PYTHON_ALIAS}" \ + || exit + fi } pidd_ls() { - pidd_ls__path="${1}" - if [ -n "${pidd_ls__path}" ]; then - pidd_open "${pidd_ls__path}" - ls -a -l "${pidd_ls__path}" || exit - pidd_shut "${pidd_ls__path}" - fi + pidd_ls__path="${1}" + if [ -n "${pidd_ls__path}" ]; then + pidd_open "${pidd_ls__path}" + ls -a -l "${pidd_ls__path}" || exit + pidd_shut "${pidd_ls__path}" + fi } pidd_mkdir() { - pidd_mkdir__path="${1}" - if [ -n "${pidd_mkdir__path}" ]; then - echo "→ ${pidd_mkdir__path}" - mkdir --parents "${pidd_mkdir__path}" || exit - fi + pidd_mkdir__path="${1}" + if [ -n "${pidd_mkdir__path}" ]; then + echo "→ ${pidd_mkdir__path}" + mkdir --parents "${pidd_mkdir__path}" || exit + fi } pidd_open() { - echo "${PIDD_OPEN}${*}" + echo "${PIDD_OPEN}${*}" } pidd_openssl() { - pidd_openssl__file="${1}" - if [ -f "${pidd_openssl__file}" ]; then - openssl x509 \ - -in "${pidd_openssl__file}" \ - -noout -text \ - || exit - fi + pidd_openssl__file="${1}" + if [ -f "${pidd_openssl__file}" ]; then + openssl x509 \ + -in "${pidd_openssl__file}" \ + -noout -text \ + || exit + fi } pidd_rm() { - pidd_rm__path="${1}" - if [ -e "${pidd_rm__path}" ]; then - echo "← ${pidd_rm__path}" - rm -r "${pidd_rm__path}" || exit - fi + pidd_rm__path="${1}" + if [ -e "${pidd_rm__path}" ]; then + echo "← ${pidd_rm__path}" + rm -r "${pidd_rm__path}" || exit + fi } pidd_sed() { - pidd_sed__file="${1}" - shift - if [ -f "${pidd_sed__file}" ]; then - pidd_cat "${pidd_sed__file}" - for pidd_sed__regex in "${@}" ; do - sed --in-place "s${pidd_sed__regex}g" "${pidd_sed__file}" \ - && pidd_cat "${pidd_sed__file}" \ - || exit - done - fi + pidd_sed__file="${1}" + shift + if [ -f "${pidd_sed__file}" ]; then + pidd_cat "${pidd_sed__file}" + for pidd_sed__regex in "${@}" ; do + sed --in-place "s${pidd_sed__regex}g" "${pidd_sed__file}" \ + && pidd_cat "${pidd_sed__file}" \ + || exit + done + fi } pidd_shut() { - echo "${PIDD_SHUT}${*}" + echo "${PIDD_SHUT}${*}" } pidd_split() { - echo "${PIDD_SPLT}" + echo "${PIDD_SPLT}" } pidd_step() { - PIDD_STEP=$((PIDD_STEP+1)) - echo "\ + PIDD_STEP=$((PIDD_STEP+1)) + echo "\ ${PIDD_DOWN} ${PIDD_VERT} ${PIDD_STEP} ${*} ${PIDD___UP}" } pidd_write() { - pidd_write__file="${1}" - pidd_write__text="${2}" - if [ -n "${pidd_write__file}" ]; then - [ -f "${pidd_write__file}" ] && pidd_cat "${pidd_write__file}" - echo "→ ${pidd_write__file}" - printf "%s" "${pidd_write__text}" > "${pidd_write__file}" || exit - pidd_cat "${pidd_write__file}" - fi + pidd_write__file="${1}" + pidd_write__text="${2}" + if [ -n "${pidd_write__file}" ]; then + [ -f "${pidd_write__file}" ] && pidd_cat "${pidd_write__file}" + echo "→ ${pidd_write__file}" + printf "%s" "${pidd_write__text}" > "${pidd_write__file}" || exit + pidd_cat "${pidd_write__file}" + fi } # constants From 94087de223318f217e3700da9aa6146a93e84182 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 11:22:38 +0200 Subject: [PATCH 14/30] ; --- pidd.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pidd.sh b/pidd.sh index cbb497a..2f75e36 100644 --- a/pidd.sh +++ b/pidd.sh @@ -520,7 +520,7 @@ pidd_set_https_verification_off() { pidd_set_dns_resolving() { pidd_step "Set DNS resolving" - for pidd_sdr__server in ${PIDD_DNS} ; do + for pidd_sdr__server in ${PIDD_DNS}; do pidd_sdr__text="${pidd_sdr__text}\ nameserver ${pidd_sdr__server} " @@ -548,7 +548,7 @@ pidd_write_ca_certificates() { pidd_mkdir "${PIDD_CA_ROOT}" pidd_wcc__index=1 eval "pidd_wcc__text=\"\${PIDD_CA_${pidd_wcc__index}}\"" - while [ -n "${pidd_wcc__text}" ] ; do + while [ -n "${pidd_wcc__text}" ]; do pidd_wcc__path="${PIDD_CA_ROOT}/${pidd_wcc__index}.crt" pidd_split pidd_write \ @@ -608,7 +608,7 @@ pidd_install_python_modules() { pidd_step "Install Python modules" pidd_ipm__root="$(mktemp --directory)" || exit echo "→ ${pidd_ipm__root}" - for pidd_ipm__repository in "${PIDD_GIT_MAIN}" "${PIDD_GIT_ROOT}" ; do + for pidd_ipm__repository in "${PIDD_GIT_MAIN}" "${PIDD_GIT_ROOT}"; do case "${pidd_ipm__repository}" in http*) pidd_ipm__url="${pidd_ipm__repository}" ;; /*) pidd_ipm__url="${PIDD_PROJECT_ROOT}${pidd_ipm__repository}" ;; @@ -677,7 +677,7 @@ pidd_cat() { pidd_echo() { if [ -n "${1}" ]; then - for pidd_echo__name in "${@}" ; do + for pidd_echo__name in "${@}"; do pidd_echo__text="" eval "pidd_echo__text=\"\${${pidd_echo__name}}\"" echo "${pidd_echo__name} = \"${pidd_echo__text}\"" @@ -766,7 +766,7 @@ pidd_sed() { shift if [ -f "${pidd_sed__file}" ]; then pidd_cat "${pidd_sed__file}" - for pidd_sed__regex in "${@}" ; do + for pidd_sed__regex in "${@}"; do sed --in-place "s${pidd_sed__regex}g" "${pidd_sed__file}" \ && pidd_cat "${pidd_sed__file}" \ || exit From ffcbe5afe0581fc803af772beca79447deb618e6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 11:28:36 +0200 Subject: [PATCH 15/30] + 1 --- pidd.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pidd.sh b/pidd.sh index 2f75e36..70fb363 100644 --- a/pidd.sh +++ b/pidd.sh @@ -555,7 +555,7 @@ pidd_write_ca_certificates() { "${pidd_wcc__path}" \ "${pidd_wcc__text}" pidd_openssl "${pidd_wcc__path}" - pidd_wcc__index=$((pidd_wcc__index+1)) + pidd_wcc__index=$((pidd_wcc__index + 1)) eval "pidd_wcc__text=\"\${PIDD_CA_${pidd_wcc__index}}\"" done } @@ -650,7 +650,7 @@ pidd_write_python_module() { " done pidd_write "${PIDD_PYTHON_PACKAGES}/env.py" "${pidd_wpm__text} -PIDD_STEP = $((PIDD_STEP+1)) +PIDD_STEP = $((PIDD_STEP + 1)) " } @@ -783,7 +783,7 @@ pidd_split() { } pidd_step() { - PIDD_STEP=$((PIDD_STEP+1)) + PIDD_STEP=$((PIDD_STEP + 1)) echo "\ ${PIDD_DOWN} ${PIDD_VERT} ${PIDD_STEP} ${*} From 57a54c31d51cc173618659a245497b106315d834 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 11:32:47 +0200 Subject: [PATCH 16/30] >" --- pidd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidd.sh b/pidd.sh index 70fb363..e657072 100644 --- a/pidd.sh +++ b/pidd.sh @@ -796,7 +796,7 @@ pidd_write() { if [ -n "${pidd_write__file}" ]; then [ -f "${pidd_write__file}" ] && pidd_cat "${pidd_write__file}" echo "→ ${pidd_write__file}" - printf "%s" "${pidd_write__text}" > "${pidd_write__file}" || exit + printf "%s" "${pidd_write__text}" >"${pidd_write__file}" || exit pidd_cat "${pidd_write__file}" fi } From 3a5a67031149f631a1ac3c096c2e2ed60eece6f2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 11:35:40 +0200 Subject: [PATCH 17/30] unindent --- pidd.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pidd.sh b/pidd.sh index e657072..a41c160 100644 --- a/pidd.sh +++ b/pidd.sh @@ -61,14 +61,14 @@ pidd_set_environment_variables() { # set operating system id PIDD_OS_ID="$(pidd_grep_os ID)" case "${PIDD_OS_ID}" in - "almalinux") PIDD_OS_ID="${PIDD_OS_ALMA}" ;; - "alpine") PIDD_OS_ID="${PIDD_OS_ALPINE}" ;; - "arch") PIDD_OS_ID="${PIDD_OS_ARCH}" ;; - "debian") PIDD_OS_ID="${PIDD_OS_DEBIAN}" ;; - "fedora") PIDD_OS_ID="${PIDD_OS_FEDORA}" ;; - "rocky") PIDD_OS_ID="${PIDD_OS_ROCKY}" ;; - "ubuntu") PIDD_OS_ID="${PIDD_OS_UBUNTU}" ;; - *) pidd_error_os "PIDD_OS_ID" ;; + "almalinux") PIDD_OS_ID="${PIDD_OS_ALMA}" ;; + "alpine") PIDD_OS_ID="${PIDD_OS_ALPINE}" ;; + "arch") PIDD_OS_ID="${PIDD_OS_ARCH}" ;; + "debian") PIDD_OS_ID="${PIDD_OS_DEBIAN}" ;; + "fedora") PIDD_OS_ID="${PIDD_OS_FEDORA}" ;; + "rocky") PIDD_OS_ID="${PIDD_OS_ROCKY}" ;; + "ubuntu") PIDD_OS_ID="${PIDD_OS_UBUNTU}" ;; + *) pidd_error_os "PIDD_OS_ID" ;; esac # set operating system version case "${PIDD_OS_ID}" in From 736a0174edcfae786d462af196a2687a78ff2a74 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 11:44:21 +0200 Subject: [PATCH 18/30] cases --- pidd.sh | 81 +++++++++++++++++++++++++++------------------------------ 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/pidd.sh b/pidd.sh index a41c160..ebe94e9 100644 --- a/pidd.sh +++ b/pidd.sh @@ -72,56 +72,53 @@ pidd_set_environment_variables() { esac # set operating system version case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_ARCH}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") - PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ - | sed "s|^\([0-9]\+\)\..*|\1|") - ;; - "${PIDD_OS_ALPINE}") - PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ - | sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|") - ;; - "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - PIDD_OS_VERSION="$(pidd_grep_os VERSION_CODENAME)" - ;; - *) ;; + "${PIDD_OS_ALMA}" | "${PIDD_OS_ARCH}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") + PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ + | sed "s|^\([0-9]\+\)\..*|\1|") ;; + "${PIDD_OS_ALPINE}") + PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ + | sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|") ;; + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") + PIDD_OS_VERSION="$(pidd_grep_os VERSION_CODENAME)" ;; + *) ;; esac # check operating system version case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}") - case "${PIDD_OS_VERSION}" in - "8" | "9") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac + "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}") + case "${PIDD_OS_VERSION}" in + "8" | "9") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac ;; - "${PIDD_OS_ALPINE}") - case "${PIDD_OS_VERSION}" in - "3.18" | "3.19") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac + "${PIDD_OS_ALPINE}") + case "${PIDD_OS_VERSION}" in + "3.18" | "3.19") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac ;; - "${PIDD_OS_ARCH}") - case "${PIDD_OS_VERSION}" in - "20231112" | "20240101") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac + "${PIDD_OS_ARCH}") + case "${PIDD_OS_VERSION}" in + "20231112" | "20240101") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac ;; - "${PIDD_OS_DEBIAN}") - case "${PIDD_OS_VERSION}" in - "bookworm" | "bullseye") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac + "${PIDD_OS_DEBIAN}") + case "${PIDD_OS_VERSION}" in + "bookworm" | "bullseye") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac ;; - "${PIDD_OS_FEDORA}") - case "${PIDD_OS_VERSION}" in - "39" | "40") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac + "${PIDD_OS_FEDORA}") + case "${PIDD_OS_VERSION}" in + "39" | "40") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac ;; - "${PIDD_OS_UBUNTU}") - case "${PIDD_OS_VERSION}" in - "jammy" | "noble") ;; - *) pidd_error_os "PIDD_OS_VERSION" ;; - esac + "${PIDD_OS_UBUNTU}") + case "${PIDD_OS_VERSION}" in + "jammy" | "noble") ;; + *) pidd_error_os "PIDD_OS_VERSION" ;; + esac ;; *) ;; esac From 6e4692cb37dde8002efeae9ab711cc32173d7cfc Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 11:53:40 +0200 Subject: [PATCH 19/30] cases --- pidd.sh | 356 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 178 insertions(+), 178 deletions(-) diff --git a/pidd.sh b/pidd.sh index ebe94e9..d0d0b75 100644 --- a/pidd.sh +++ b/pidd.sh @@ -120,7 +120,7 @@ pidd_set_environment_variables() { *) pidd_error_os "PIDD_OS_VERSION" ;; esac ;; - *) ;; + *) ;; esac pidd_split pidd_echo "PIDD_OS_ID" "PIDD_OS_VERSION" @@ -135,54 +135,54 @@ pidd_set_environment_variables() { pidd_echo "PIDD_DNS_FILE" "PIDD_PKG_CA" "PIDD_PKG_GIT" "PIDD_PYTHON_ALIAS" # set ca command & root case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") - PIDD_CA_ROOT="/etc/pki/ca-trust/source/anchors" - PIDD_CMD_CA="update-ca-trust" + "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") + PIDD_CA_ROOT="/etc/pki/ca-trust/source/anchors" + PIDD_CMD_CA="update-ca-trust" ;; - "${PIDD_OS_ALPINE}") - PIDD_CA_ROOT="/usr/local/share/ca-certificates" - PIDD_CMD_CA="update-ca-certificates" + "${PIDD_OS_ALPINE}") + PIDD_CA_ROOT="/usr/local/share/ca-certificates" + PIDD_CMD_CA="update-ca-certificates" ;; - "${PIDD_OS_ARCH}") - PIDD_CA_ROOT="/etc/ca-certificates/trust-source/anchors" - PIDD_CMD_CA="update-ca-trust" + "${PIDD_OS_ARCH}") + PIDD_CA_ROOT="/etc/ca-certificates/trust-source/anchors" + PIDD_CMD_CA="update-ca-trust" ;; - "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - PIDD_CA_ROOT="/usr/local/share/ca-certificates" - PIDD_CMD_CA="update-ca-certificates" + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") + PIDD_CA_ROOT="/usr/local/share/ca-certificates" + PIDD_CMD_CA="update-ca-certificates" ;; - *) ;; + *) ;; esac pidd_split pidd_echo "PIDD_CA_ROOT" "PIDD_CMD_CA" # set package manager case "${PIDD_OS_ID}" in - "${PIDD_OS_ALPINE}") - PIDD_PM="${PIDD_PM_APK}" + "${PIDD_OS_ALPINE}") + PIDD_PM="${PIDD_PM_APK}" ;; - "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - PIDD_PM="${PIDD_PM_APT}" + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") + PIDD_PM="${PIDD_PM_APT}" ;; - "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") - PIDD_PM="${PIDD_PM_DNF}" + "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") + PIDD_PM="${PIDD_PM_DNF}" ;; - "${PIDD_OS_ARCH}") - PIDD_PM="${PIDD_PM_PACMAN}" + "${PIDD_OS_ARCH}") + PIDD_PM="${PIDD_PM_PACMAN}" ;; - *) ;; + *) ;; esac pidd_split pidd_echo "PIDD_PM" case "${PIDD_PM}" in - "${PIDD_PM_DNF}") - PIDD_PM_CLEAN="dnf clean all" - PIDD_PM_INSTALL="dnf install --assumeyes" - PIDD_PM_QUERY="rpm --query" - PIDD_PM_UPDATE="dnf makecache" - PIDD_PM_UPGRADE="dnf upgrade --assumeyes" - PIDD_PKG_PKG="" - PIDD_PM_CONF_PATH="/etc/dnf/dnf.conf" - PIDD_PM_CONF_TEXT="\ + "${PIDD_PM_DNF}") + PIDD_PM_CLEAN="dnf clean all" + PIDD_PM_INSTALL="dnf install --assumeyes" + PIDD_PM_QUERY="rpm --query" + PIDD_PM_UPDATE="dnf makecache" + PIDD_PM_UPGRADE="dnf upgrade --assumeyes" + PIDD_PKG_PKG="" + PIDD_PM_CONF_PATH="/etc/dnf/dnf.conf" + PIDD_PM_CONF_TEXT="\ [main] best=True clean_requirements_on_remove=True @@ -190,60 +190,60 @@ gpgcheck=1 installonly_limit=3 skip_if_unavailable=False " - PIDD_PM_HTTPS_PATH="/etc/dnf/dnf.conf.d/https.conf" - PIDD_PM_HTTPS_TEXT="\ + PIDD_PM_HTTPS_PATH="/etc/dnf/dnf.conf.d/https.conf" + PIDD_PM_HTTPS_TEXT="\ sslverify=False " ;; - "${PIDD_PM_APK}") - PIDD_PM_CLEAN="apk cache purge" - PIDD_PM_INSTALL="apk add" - PIDD_PM_QUERY="apk info" - PIDD_PM_UPDATE="apk update" - PIDD_PM_UPGRADE="apk upgrade" - PIDD_PKG_PKG="" - PIDD_PM_CONF_PATH="" - PIDD_PM_CONF_TEXT="" - PIDD_PM_HTTPS_PATH="/etc/apk/repositories.d/https" - PIDD_PM_HTTPS_TEXT="\ + "${PIDD_PM_APK}") + PIDD_PM_CLEAN="apk cache purge" + PIDD_PM_INSTALL="apk add" + PIDD_PM_QUERY="apk info" + PIDD_PM_UPDATE="apk update" + PIDD_PM_UPGRADE="apk upgrade" + PIDD_PKG_PKG="" + PIDD_PM_CONF_PATH="" + PIDD_PM_CONF_TEXT="" + PIDD_PM_HTTPS_PATH="/etc/apk/repositories.d/https" + PIDD_PM_HTTPS_TEXT="\ --no-verify " ;; - "${PIDD_PM_PACMAN}") - PIDD_PM_CLEAN="pacman --sync --clean --noconfirm" - PIDD_PM_INSTALL="pacman --sync --noconfirm" - PIDD_PM_QUERY="pacman --query" - PIDD_PM_UPDATE="pacman --sync --refresh" - PIDD_PM_UPGRADE="pacman --sync --sysupgrade --noconfirm" - PIDD_PKG_PKG="" - PIDD_PM_CONF_PATH="" - PIDD_PM_CONF_TEXT="" - PIDD_PM_HTTPS_PATH="/etc/pacman.d/https.conf" - PIDD_PM_HTTPS_TEXT="\ + "${PIDD_PM_PACMAN}") + PIDD_PM_CLEAN="pacman --sync --clean --noconfirm" + PIDD_PM_INSTALL="pacman --sync --noconfirm" + PIDD_PM_QUERY="pacman --query" + PIDD_PM_UPDATE="pacman --sync --refresh" + PIDD_PM_UPGRADE="pacman --sync --sysupgrade --noconfirm" + PIDD_PKG_PKG="" + PIDD_PM_CONF_PATH="" + PIDD_PM_CONF_TEXT="" + PIDD_PM_HTTPS_PATH="/etc/pacman.d/https.conf" + PIDD_PM_HTTPS_TEXT="\ SSLVerify = No " ;; - "${PIDD_PM_APT}") - PIDD_PM_CLEAN="apt-get clean" - PIDD_PM_INSTALL="apt-get install --assume-yes" - PIDD_PM_QUERY="dpkg-query --show" - PIDD_PM_UPDATE="apt-get update" - PIDD_PM_UPGRADE="apt-get upgrade --assume-yes" - PIDD_PKG_PKG="apt-utils" - PIDD_PM_CONF_PATH="/etc/apt/apt.conf.d/apt.conf" - PIDD_PM_CONF_TEXT="\ + "${PIDD_PM_APT}") + PIDD_PM_CLEAN="apt-get clean" + PIDD_PM_INSTALL="apt-get install --assume-yes" + PIDD_PM_QUERY="dpkg-query --show" + PIDD_PM_UPDATE="apt-get update" + PIDD_PM_UPGRADE="apt-get upgrade --assume-yes" + PIDD_PKG_PKG="apt-utils" + PIDD_PM_CONF_PATH="/etc/apt/apt.conf.d/apt.conf" + PIDD_PM_CONF_TEXT="\ Acquire::Check-Valid-Until True; APT::Get::Show-Versions True; APT::Install-Recommends False; APT::Install-Suggests False; Dir::Etc::SourceParts \"\"; " - PIDD_PM_HTTPS_PATH="/etc/apt/apt.conf.d/https" - PIDD_PM_HTTPS_TEXT="\ + PIDD_PM_HTTPS_PATH="/etc/apt/apt.conf.d/https" + PIDD_PM_HTTPS_TEXT="\ Acquire::https::Verify-Peer False; " ;; - *) ;; + *) ;; esac pidd_split pidd_echo "PIDD_PM_CLEAN" \ @@ -252,108 +252,108 @@ Acquire::https::Verify-Peer False; pidd_echo "PIDD_PKG_PKG" "PIDD_PM_CONF_PATH" "PIDD_PM_HTTPS_PATH" # specific case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}") - PIDD_URL_DEFAULT="https://repo.almalinux.org/almalinux" + "${PIDD_OS_ALMA}") + PIDD_URL_DEFAULT="https://repo.almalinux.org/almalinux" ;; - "${PIDD_OS_ALPINE}") - PIDD_URL_DEFAULT="https://dl-cdn.alpinelinux.org/alpine" + "${PIDD_OS_ALPINE}") + PIDD_URL_DEFAULT="https://dl-cdn.alpinelinux.org/alpine" ;; - "${PIDD_OS_ARCH}") - PIDD_URL_DEFAULT="https://geo.mirror.pkgbuild.com" + "${PIDD_OS_ARCH}") + PIDD_URL_DEFAULT="https://geo.mirror.pkgbuild.com" ;; - "${PIDD_OS_DEBIAN}") - PIDD_URL_DEFAULT="http://deb.debian.org/debian" + "${PIDD_OS_DEBIAN}") + PIDD_URL_DEFAULT="http://deb.debian.org/debian" ;; - "${PIDD_OS_FEDORA}") - PIDD_URL_DEFAULT="http://download.example/pub/fedora/linux/releases" + "${PIDD_OS_FEDORA}") + PIDD_URL_DEFAULT="http://download.example/pub/fedora/linux/releases" ;; - "${PIDD_OS_ROCKY}") - PIDD_URL_DEFAULT="http://dl.rockylinux.org/\$contentdir" + "${PIDD_OS_ROCKY}") + PIDD_URL_DEFAULT="http://dl.rockylinux.org/\$contentdir" ;; - "${PIDD_OS_UBUNTU}") - PIDD_URL_DEFAULT="http://archive.ubuntu.com/ubuntu" + "${PIDD_OS_UBUNTU}") + PIDD_URL_DEFAULT="http://archive.ubuntu.com/ubuntu" ;; - *) ;; + *) ;; esac PIDD_URL_CHOSEN="${PIDD_URL_DEFAULT}" case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}") - [ -n "${PIDD_URL_ALMA}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ALMA}" + "${PIDD_OS_ALMA}") + [ -n "${PIDD_URL_ALMA}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ALMA}" ;; - "${PIDD_OS_ALPINE}") - [ -n "${PIDD_URL_ALPINE}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ALPINE}" + "${PIDD_OS_ALPINE}") + [ -n "${PIDD_URL_ALPINE}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ALPINE}" ;; - "${PIDD_OS_ARCH}") - [ -n "${PIDD_URL_ARCH}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ARCH}" + "${PIDD_OS_ARCH}") + [ -n "${PIDD_URL_ARCH}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ARCH}" ;; - "${PIDD_OS_DEBIAN}") - [ -n "${PIDD_URL_DEBIAN}" ] && PIDD_URL_CHOSEN="${PIDD_URL_DEBIAN}" \ - || PIDD_URL_CHOSEN="https://deb.debian.org/debian" + "${PIDD_OS_DEBIAN}") + [ -n "${PIDD_URL_DEBIAN}" ] && PIDD_URL_CHOSEN="${PIDD_URL_DEBIAN}" \ + || PIDD_URL_CHOSEN="https://deb.debian.org/debian" ;; - "${PIDD_OS_FEDORA}") - [ -n "${PIDD_URL_FEDORA}" ] && PIDD_URL_CHOSEN="${PIDD_URL_FEDORA}" \ - || PIDD_URL_CHOSEN="https://rpmfind.net/linux/fedora/linux/releases" + "${PIDD_OS_FEDORA}") + [ -n "${PIDD_URL_FEDORA}" ] && PIDD_URL_CHOSEN="${PIDD_URL_FEDORA}" \ + || PIDD_URL_CHOSEN="https://rpmfind.net/linux/fedora/linux/releases" ;; - "${PIDD_OS_ROCKY}") - [ -n "${PIDD_URL_ROCKY}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ROCKY}" \ - || PIDD_URL_CHOSEN="https://dl.rockylinux.org/\$contentdir" + "${PIDD_OS_ROCKY}") + [ -n "${PIDD_URL_ROCKY}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ROCKY}" \ + || PIDD_URL_CHOSEN="https://dl.rockylinux.org/\$contentdir" ;; - "${PIDD_OS_UBUNTU}") - [ -n "${PIDD_URL_UBUNTU}" ] && PIDD_URL_CHOSEN="${PIDD_URL_UBUNTU}" \ - || PIDD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu" + "${PIDD_OS_UBUNTU}") + [ -n "${PIDD_URL_UBUNTU}" ] && PIDD_URL_CHOSEN="${PIDD_URL_UBUNTU}" \ + || PIDD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu" ;; - *) ;; + *) ;; esac pidd_split pidd_echo "PIDD_URL_DEFAULT" "PIDD_URL_CHOSEN" # set python command & package case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}") - PIDD_PYTHON_COMMAND="python3.11" - PIDD_PYTHON_PACKAGE="python3.11" + "${PIDD_OS_ALMA}" | "${PIDD_OS_ROCKY}") + PIDD_PYTHON_COMMAND="python3.11" + PIDD_PYTHON_PACKAGE="python3.11" ;; - "${PIDD_OS_ALPINE}") - PIDD_PYTHON_COMMAND="python3.11" - PIDD_PYTHON_PACKAGE="python3" + "${PIDD_OS_ALPINE}") + PIDD_PYTHON_COMMAND="python3.11" + PIDD_PYTHON_PACKAGE="python3" ;; - "${PIDD_OS_ARCH}") - PIDD_PYTHON_COMMAND="python3.12" - PIDD_PYTHON_PACKAGE="python" - ;; - "${PIDD_OS_DEBIAN}") - case "${PIDD_OS_VERSION}" in - "bookworm") PIDD_PYTHON_COMMAND="python3.11" ;; - "bullseye") PIDD_PYTHON_COMMAND="python3.9" ;; - *) ;; - esac - PIDD_PYTHON_PACKAGE="python3" - ;; - "${PIDD_OS_FEDORA}") - PIDD_PYTHON_COMMAND="python3.12" - PIDD_PYTHON_PACKAGE="python3" - ;; - "${PIDD_OS_UBUNTU}") - case "${PIDD_OS_VERSION}" in - "noble") PIDD_PYTHON_COMMAND="python3.12" ;; - "jammy") PIDD_PYTHON_COMMAND="python3.10" ;; - *) ;; - esac - PIDD_PYTHON_PACKAGE="python3" + "${PIDD_OS_ARCH}") + PIDD_PYTHON_COMMAND="python3.12" + PIDD_PYTHON_PACKAGE="python" ;; + "${PIDD_OS_DEBIAN}") + case "${PIDD_OS_VERSION}" in + "bookworm") PIDD_PYTHON_COMMAND="python3.11" ;; + "bullseye") PIDD_PYTHON_COMMAND="python3.9" ;; *) ;; + esac + PIDD_PYTHON_PACKAGE="python3" + ;; + "${PIDD_OS_FEDORA}") + PIDD_PYTHON_COMMAND="python3.12" + PIDD_PYTHON_PACKAGE="python3" + ;; + "${PIDD_OS_UBUNTU}") + case "${PIDD_OS_VERSION}" in + "noble") PIDD_PYTHON_COMMAND="python3.12" ;; + "jammy") PIDD_PYTHON_COMMAND="python3.10" ;; + *) ;; + esac + PIDD_PYTHON_PACKAGE="python3" + ;; + *) ;; esac # set python packages case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") - PIDD_PYTHON_PACKAGES="/usr/lib64/${PIDD_PYTHON_COMMAND}/site-packages" + "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") + PIDD_PYTHON_PACKAGES="/usr/lib64/${PIDD_PYTHON_COMMAND}/site-packages" ;; - "${PIDD_OS_ALPINE}" | "${PIDD_OS_ARCH}") - PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_COMMAND}/site-packages" + "${PIDD_OS_ALPINE}" | "${PIDD_OS_ARCH}") + PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_COMMAND}/site-packages" ;; - "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_ALIAS}/dist-packages" + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") + PIDD_PYTHON_PACKAGES="/usr/lib/${PIDD_PYTHON_ALIAS}/dist-packages" ;; - *) ;; + *) ;; esac pidd_split pidd_echo "PIDD_PYTHON_COMMAND" "PIDD_PYTHON_PACKAGE" "PIDD_PYTHON_PACKAGES" @@ -433,64 +433,64 @@ Acquire::https::Verify-Peer False; "PIDD_PROJECT_PATH" "PIDD_PROJECT_NAME" "PIDD_PROJECT_BRANCH" # TODO move to Python case "${PIDD_PM}" in - "${PIDD_PM_APK}" | "${PIDD_PM_APT}") PIDD_PKG_SSH="openssh-client" ;; - "${PIDD_PM_DNF}") PIDD_PKG_SSH="openssh-clients" ;; - "${PIDD_PM_PACMAN}") PIDD_PKG_SSH="openssh" ;; - *) ;; + "${PIDD_PM_APK}" | "${PIDD_PM_APT}") PIDD_PKG_SSH="openssh-client" ;; + "${PIDD_PM_DNF}") PIDD_PKG_SSH="openssh-clients" ;; + "${PIDD_PM_PACMAN}") PIDD_PKG_SSH="openssh" ;; + *) ;; esac } pidd_set_packages_repositories() { pidd_step "Set packages repositories" case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}") - case "${PIDD_OS_VERSION}" in - "8") pidd_spr__file="/etc/yum.repos.d/almalinux.repo" ;; - "9") pidd_spr_file="/etc/yum.repos.d/almalinux-baseos.repo" ;; - *) ;; - esac - pidd_sed "${pidd_spr__file}" \ - "|^mirrorlist|# mirrorlist|" \ - "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ - "|^# baseurl|baseurl|" + "${PIDD_OS_ALMA}") + case "${PIDD_OS_VERSION}" in + "8") pidd_spr__file="/etc/yum.repos.d/almalinux.repo" ;; + "9") pidd_spr_file="/etc/yum.repos.d/almalinux-baseos.repo" ;; + *) ;; + esac + pidd_sed "${pidd_spr__file}" \ + "|^mirrorlist|# mirrorlist|" \ + "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ + "|^# baseurl|baseurl|" ;; - "${PIDD_OS_ALPINE}") - pidd_spr__file="/etc/apk/repositories" - pidd_write "${pidd_spr__file}" "\ + "${PIDD_OS_ALPINE}") + pidd_spr__file="/etc/apk/repositories" + pidd_write "${pidd_spr__file}" "\ ${PIDD_URL_CHOSEN}/v${PIDD_OS_VERSION}/main ${PIDD_URL_CHOSEN}/v${PIDD_OS_VERSION}/community " ;; - "${PIDD_OS_DEBIAN}") - pidd_spr__file="/etc/apt/sources.list" - pidd_write "${pidd_spr__file}" "\ + "${PIDD_OS_DEBIAN}") + pidd_spr__file="/etc/apt/sources.list" + pidd_write "${pidd_spr__file}" "\ deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION} main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-backports main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-updates main deb ${PIDD_URL_CHOSEN}-security ${PIDD_OS_VERSION}-security main " ;; - "${PIDD_OS_ROCKY}") - case "${PIDD_OS_VERSION}" in - "8") pidd_spr__file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;; - "9") pidd_spr__file="/etc/yum.repos.d/rocky.repo" ;; - *) ;; - esac - pidd_sed "${pidd_spr__file}" \ - "|^mirrorlist|# mirrorlist|" \ - "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ - "|^#baseurl|baseurl|" + "${PIDD_OS_ROCKY}") + case "${PIDD_OS_VERSION}" in + "8") pidd_spr__file="/etc/yum.repos.d/Rocky-BaseOS.repo" ;; + "9") pidd_spr__file="/etc/yum.repos.d/rocky.repo" ;; + *) ;; + esac + pidd_sed "${pidd_spr__file}" \ + "|^mirrorlist|# mirrorlist|" \ + "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ + "|^#baseurl|baseurl|" ;; - "${PIDD_OS_UBUNTU}") - pidd_spr__file="/etc/apt/sources.list" - pidd_write "${pidd_spr__file}" "\ + "${PIDD_OS_UBUNTU}") + pidd_spr__file="/etc/apt/sources.list" + pidd_write "${pidd_spr__file}" "\ deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION} main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-backports main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-updates main deb ${PIDD_URL_CHOSEN} ${PIDD_OS_VERSION}-security main " ;; - *) ;; + *) ;; esac } @@ -498,10 +498,10 @@ pidd_set_packages_configuration() { pidd_step "Set packages configuration" pidd_write "${PIDD_PM_CONF_PATH}" "${PIDD_PM_CONF_TEXT}" case "${PIDD_OS_ID}" in - "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - export DEBIAN_FRONTEND="noninteractive" + "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") + export DEBIAN_FRONTEND="noninteractive" ;; - *) ;; + *) ;; esac } @@ -607,9 +607,9 @@ pidd_install_python_modules() { echo "→ ${pidd_ipm__root}" for pidd_ipm__repository in "${PIDD_GIT_MAIN}" "${PIDD_GIT_ROOT}"; do case "${pidd_ipm__repository}" in - http*) pidd_ipm__url="${pidd_ipm__repository}" ;; - /*) pidd_ipm__url="${PIDD_PROJECT_ROOT}${pidd_ipm__repository}" ;; - *) pidd_ipm__url="\ + http*) pidd_ipm__url="${pidd_ipm__repository}" ;; + /*) pidd_ipm__url="${PIDD_PROJECT_ROOT}${pidd_ipm__repository}" ;; + *) pidd_ipm__url="\ ${PIDD_PROJECT_ROOT}/${PIDD_PROJECT_PATH}/${pidd_ipm__repository}" ;; esac pidd_ipm__name="$(basename "${pidd_ipm__url}")" From 3df6f15f0e6f87899b9431b8656550f7c871126d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 12:01:44 +0200 Subject: [PATCH 20/30] seds --- pidd.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pidd.sh b/pidd.sh index d0d0b75..b0f4247 100644 --- a/pidd.sh +++ b/pidd.sh @@ -73,13 +73,16 @@ pidd_set_environment_variables() { # set operating system version case "${PIDD_OS_ID}" in "${PIDD_OS_ALMA}" | "${PIDD_OS_ARCH}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") - PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ - | sed "s|^\([0-9]\+\)\..*|\1|") ;; + PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID | + sed "s|^\([0-9]\+\)\..*|\1|") + ;; "${PIDD_OS_ALPINE}") - PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID \ - | sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|") ;; + PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID | + sed "s|^\([0-9]\+\.[0-9]\+\)\..*|\1|") + ;; "${PIDD_OS_DEBIAN}" | "${PIDD_OS_UBUNTU}") - PIDD_OS_VERSION="$(pidd_grep_os VERSION_CODENAME)" ;; + PIDD_OS_VERSION="$(pidd_grep_os VERSION_CODENAME)" + ;; *) ;; esac # check operating system version From 7a9ed2ee10f2b6c16ecbe853c61078990f456761 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 12:04:00 +0200 Subject: [PATCH 21/30] pidd_sed --- pidd.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pidd.sh b/pidd.sh index b0f4247..f02a429 100644 --- a/pidd.sh +++ b/pidd.sh @@ -767,9 +767,9 @@ pidd_sed() { if [ -f "${pidd_sed__file}" ]; then pidd_cat "${pidd_sed__file}" for pidd_sed__regex in "${@}"; do - sed --in-place "s${pidd_sed__regex}g" "${pidd_sed__file}" \ - && pidd_cat "${pidd_sed__file}" \ - || exit + sed --in-place "s${pidd_sed__regex}g" "${pidd_sed__file}" && + pidd_cat "${pidd_sed__file}" || + exit done fi } From bc7498fba21646b11f4c77426a1f58a1387caf53 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 12:09:07 +0200 Subject: [PATCH 22/30] indents --- pidd.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pidd.sh b/pidd.sh index f02a429..f6e86ad 100644 --- a/pidd.sh +++ b/pidd.sh @@ -717,8 +717,8 @@ pidd_ln_python() { pidd_ln_python__command="${1}" if [ -n "${pidd_ln_python__command}" ]; then echo "→ ${PIDD_PYTHON_ALIAS} → ${pidd_ln_python__command}" - ln -f -s "${pidd_ln_python__command}" "/usr/bin/${PIDD_PYTHON_ALIAS}" \ - || exit + ln -f -s "${pidd_ln_python__command}" "/usr/bin/${PIDD_PYTHON_ALIAS}" || + exit fi } @@ -747,9 +747,9 @@ pidd_openssl() { pidd_openssl__file="${1}" if [ -f "${pidd_openssl__file}" ]; then openssl x509 \ - -in "${pidd_openssl__file}" \ - -noout -text \ - || exit + -in "${pidd_openssl__file}" \ + -noout -text || + exit fi } From db2092a2510e3ddd5e24aa7aebf3c4c57c607dbb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 12:10:28 +0200 Subject: [PATCH 23/30] indents --- pidd.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pidd.sh b/pidd.sh index f6e86ad..8e26891 100644 --- a/pidd.sh +++ b/pidd.sh @@ -700,9 +700,9 @@ pidd_error_os() { pidd_grep_os() { pidd_grep_os__variable="${1}" if [ -n "${pidd_grep_os__variable}" ]; then - grep "^${pidd_grep_os__variable}=" "/etc/os-release" \ - | sed "s|^${pidd_grep_os__variable}=||" \ - | sed "s|^\"\(.*\)\"$|\1|" + grep "^${pidd_grep_os__variable}=" "/etc/os-release" | + sed "s|^${pidd_grep_os__variable}=||" | + sed "s|^\"\(.*\)\"$|\1|" fi } @@ -749,7 +749,7 @@ pidd_openssl() { openssl x509 \ -in "${pidd_openssl__file}" \ -noout -text || - exit + exit fi } From d5468ffde653b57f305d025f30ee5390175393af Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 12:13:33 +0200 Subject: [PATCH 24/30] indent --- pidd.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pidd.sh b/pidd.sh index 8e26891..338f2ba 100644 --- a/pidd.sh +++ b/pidd.sh @@ -641,9 +641,9 @@ ${PIDD_PYTHON_PACKAGES}" pidd_write_python_module() { pidd_step "Write Python module" for pidd_wpm__variable in \ - OPEN DOWN VERT SPLT __UP SHUT \ - OS_ID OS_VERSION \ - PROJECT_ROOT PROJECT_PATH PROJECT_NAME \ + OS_ID OS_VERSION \ + PROJECT_ROOT PROJECT_PATH PROJECT_NAME \ + OPEN DOWN VERT SPLT __UP SHUT \ ; do pidd_wpm__value="$(pidd_echo "PIDD_${pidd_wpm__variable}")" pidd_wpm__text="${pidd_wpm__text}${pidd_wpm__value} From f50afa916f9a473340bb4f82b6be2b76dba71ed3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 12:15:09 +0200 Subject: [PATCH 25/30] indents --- pidd.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pidd.sh b/pidd.sh index 338f2ba..de10291 100644 --- a/pidd.sh +++ b/pidd.sh @@ -621,16 +621,16 @@ ${PIDD_PROJECT_ROOT}/${PIDD_PROJECT_PATH}/${pidd_ipm__repository}" ;; ${pidd_ipm__url} ↓" git clone \ - "${pidd_ipm__url}" \ - "${pidd_ipm__root}/${pidd_ipm__name}" \ - || exit + "${pidd_ipm__url}" \ + "${pidd_ipm__root}/${pidd_ipm__name}" || + exit pidd_ipm__path="${pidd_ipm__root}/${pidd_ipm__name}/${pidd_ipm__name}" echo "\ ${pidd_ipm__path} ↓ ${PIDD_PYTHON_PACKAGES}" - cp --recursive "${pidd_ipm__path}" "${PIDD_PYTHON_PACKAGES}" \ - || exit + cp --recursive "${pidd_ipm__path}" "${PIDD_PYTHON_PACKAGES}" || + exit done pidd_split pidd_ls "${PIDD_PYTHON_PACKAGES}" @@ -643,8 +643,7 @@ pidd_write_python_module() { for pidd_wpm__variable in \ OS_ID OS_VERSION \ PROJECT_ROOT PROJECT_PATH PROJECT_NAME \ - OPEN DOWN VERT SPLT __UP SHUT \ - ; do + OPEN DOWN VERT SPLT __UP SHUT; do pidd_wpm__value="$(pidd_echo "PIDD_${pidd_wpm__variable}")" pidd_wpm__text="${pidd_wpm__text}${pidd_wpm__value} " From c197081d8ea1a76bcf7c5d09fb2fab032ebb2670 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 12:17:39 +0200 Subject: [PATCH 26/30] indents --- pidd.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pidd.sh b/pidd.sh index de10291..1638fb7 100644 --- a/pidd.sh +++ b/pidd.sh @@ -290,20 +290,20 @@ Acquire::https::Verify-Peer False; [ -n "${PIDD_URL_ARCH}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ARCH}" ;; "${PIDD_OS_DEBIAN}") - [ -n "${PIDD_URL_DEBIAN}" ] && PIDD_URL_CHOSEN="${PIDD_URL_DEBIAN}" \ - || PIDD_URL_CHOSEN="https://deb.debian.org/debian" + [ -n "${PIDD_URL_DEBIAN}" ] && PIDD_URL_CHOSEN="${PIDD_URL_DEBIAN}" || + PIDD_URL_CHOSEN="https://deb.debian.org/debian" ;; "${PIDD_OS_FEDORA}") - [ -n "${PIDD_URL_FEDORA}" ] && PIDD_URL_CHOSEN="${PIDD_URL_FEDORA}" \ - || PIDD_URL_CHOSEN="https://rpmfind.net/linux/fedora/linux/releases" + [ -n "${PIDD_URL_FEDORA}" ] && PIDD_URL_CHOSEN="${PIDD_URL_FEDORA}" || + PIDD_URL_CHOSEN="https://rpmfind.net/linux/fedora/linux/releases" ;; "${PIDD_OS_ROCKY}") - [ -n "${PIDD_URL_ROCKY}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ROCKY}" \ - || PIDD_URL_CHOSEN="https://dl.rockylinux.org/\$contentdir" + [ -n "${PIDD_URL_ROCKY}" ] && PIDD_URL_CHOSEN="${PIDD_URL_ROCKY}" || + PIDD_URL_CHOSEN="https://dl.rockylinux.org/\$contentdir" ;; "${PIDD_OS_UBUNTU}") - [ -n "${PIDD_URL_UBUNTU}" ] && PIDD_URL_CHOSEN="${PIDD_URL_UBUNTU}" \ - || PIDD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu" + [ -n "${PIDD_URL_UBUNTU}" ] && PIDD_URL_CHOSEN="${PIDD_URL_UBUNTU}" || + PIDD_URL_CHOSEN="https://ubuntu.mirrors.ovh.net/ubuntu" ;; *) ;; esac From 87feb5579278a7f638278a38f1779044cde78345 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 12:20:16 +0200 Subject: [PATCH 27/30] indents --- pidd.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pidd.sh b/pidd.sh index 1638fb7..bdd213d 100644 --- a/pidd.sh +++ b/pidd.sh @@ -453,9 +453,9 @@ pidd_set_packages_repositories() { *) ;; esac pidd_sed "${pidd_spr__file}" \ - "|^mirrorlist|# mirrorlist|" \ - "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ - "|^# baseurl|baseurl|" + "|^mirrorlist|# mirrorlist|" \ + "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ + "|^# baseurl|baseurl|" ;; "${PIDD_OS_ALPINE}") pidd_spr__file="/etc/apk/repositories" @@ -480,9 +480,9 @@ deb ${PIDD_URL_CHOSEN}-security ${PIDD_OS_VERSION}-security main *) ;; esac pidd_sed "${pidd_spr__file}" \ - "|^mirrorlist|# mirrorlist|" \ - "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ - "|^#baseurl|baseurl|" + "|^mirrorlist|# mirrorlist|" \ + "|${PIDD_URL_DEFAULT}|${PIDD_URL_CHOSEN}|" \ + "|^#baseurl|baseurl|" ;; "${PIDD_OS_UBUNTU}") pidd_spr__file="/etc/apt/sources.list" From d3d54bd2beda22acda941af51d8165412fc34873 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 12:21:45 +0200 Subject: [PATCH 28/30] unsplit --- pidd.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pidd.sh b/pidd.sh index bdd213d..e947824 100644 --- a/pidd.sh +++ b/pidd.sh @@ -551,9 +551,7 @@ pidd_write_ca_certificates() { while [ -n "${pidd_wcc__text}" ]; do pidd_wcc__path="${PIDD_CA_ROOT}/${pidd_wcc__index}.crt" pidd_split - pidd_write \ - "${pidd_wcc__path}" \ - "${pidd_wcc__text}" + pidd_write "${pidd_wcc__path}" "${pidd_wcc__text}" pidd_openssl "${pidd_wcc__path}" pidd_wcc__index=$((pidd_wcc__index + 1)) eval "pidd_wcc__text=\"\${PIDD_CA_${pidd_wcc__index}}\"" From 7fc3f088ccd745da6036c9f38c3002bb45e3e762 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 13:03:46 +0200 Subject: [PATCH 29/30] split --- pidd.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pidd.sh b/pidd.sh index e947824..046b2f7 100644 --- a/pidd.sh +++ b/pidd.sh @@ -72,7 +72,8 @@ pidd_set_environment_variables() { esac # set operating system version case "${PIDD_OS_ID}" in - "${PIDD_OS_ALMA}" | "${PIDD_OS_ARCH}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}") + "${PIDD_OS_ALMA}" | "${PIDD_OS_FEDORA}" | "${PIDD_OS_ROCKY}" | \ + "${PIDD_OS_ARCH}") PIDD_OS_VERSION=$(pidd_grep_os VERSION_ID | sed "s|^\([0-9]\+\)\..*|\1|") ;; From 8e50cb2e15e3ee1cd17b5c0ace28f96982b98b5a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 24 Jun 2024 13:05:27 +0200 Subject: [PATCH 30/30] typo --- pidd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pidd.sh b/pidd.sh index 046b2f7..9aa459f 100644 --- a/pidd.sh +++ b/pidd.sh @@ -450,7 +450,7 @@ pidd_set_packages_repositories() { "${PIDD_OS_ALMA}") case "${PIDD_OS_VERSION}" in "8") pidd_spr__file="/etc/yum.repos.d/almalinux.repo" ;; - "9") pidd_spr_file="/etc/yum.repos.d/almalinux-baseos.repo" ;; + "9") pidd_spr__file="/etc/yum.repos.d/almalinux-baseos.repo" ;; *) ;; esac pidd_sed "${pidd_spr__file}" \