From 3349f51a23a4be33ccad8e2131bb99dde82c6317 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 30 Apr 2024 13:40:11 +0200 Subject: [PATCH 01/18] ca/deb/mkdir --- cd.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cd.sh b/cd.sh index eb54620..47a94a6 100644 --- a/cd.sh +++ b/cd.sh @@ -197,7 +197,10 @@ local target local text cd_step "Copy CA" case "${CD_OS_NAME}" in - "debian") target="/usr/local/share/ca-certificates" ;; + "debian") + target="/usr/local/share/ca-certificates" + cd_mkdir "${target}" + ;; "alma") target="/etc/pki/ca-trust/source/anchors" ;; *) cd_error_os "cd_copy_ca" ;; esac From 179f2344019b0d65527a0b2dcd45252265fe4ef5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 30 Apr 2024 13:44:12 +0200 Subject: [PATCH 02/18] cat/corner --- cd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cd.sh b/cd.sh index 47a94a6..755d6bb 100644 --- a/cd.sh +++ b/cd.sh @@ -305,7 +305,7 @@ ${1} cd_cat () { if [ -f "${1}" ] ; then - echo " ↙ $(realpath "${1}")" + echo "╭╴$(realpath "${1}")" cat "${1}" || exit fi } From dc52d4f73dbdbbf5061d6f1cdfbcb4347d2867f4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 30 Apr 2024 13:45:05 +0200 Subject: [PATCH 03/18] split --- cd.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cd.sh b/cd.sh index 755d6bb..cc02193 100644 --- a/cd.sh +++ b/cd.sh @@ -268,6 +268,7 @@ local url root="$(mktemp --directory)" || exit echo "${root}" for repository in "${@}" ; do + cd_split url="${CD_PROJECTS_URL}/${repository}" echo -n " ${url} From 338f437861228554bc61005f83cfd1879297fb2e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 30 Apr 2024 13:46:23 +0200 Subject: [PATCH 04/18] mv --- cd.sh | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/cd.sh b/cd.sh index cc02193..fddb122 100644 --- a/cd.sh +++ b/cd.sh @@ -14,11 +14,11 @@ cd_main () { cd_set_dns_resolving ${CD_DNS} cd_set_packages_repositories cd_set_packages_configuration + cd_write_ca_certificates cd_set_https_verification_off cd_update_packages_catalog cd_install_packages_tools cd_install_ca_certificates - cd_write_ca_certificates cd_update_ca_certificates cd_set_https_verification_on cd_update_packages_catalog @@ -151,6 +151,28 @@ Dir::Etc::SourceParts \"\"; esac } +cd_write_ca_certificates () { +local index +local target +local text + cd_step "Copy CA" + case "${CD_OS_NAME}" in + "debian") + target="/usr/local/share/ca-certificates" + cd_mkdir "${target}" + ;; + "alma") target="/etc/pki/ca-trust/source/anchors" ;; + *) cd_error_os "cd_copy_ca" ;; + esac + index=1 + eval "text=\${CD_CA_${index}}" + while [ "${text}" ] ; do + cd_write "${target}/${index}.crt" "${text}" + index=$((index+1)) + eval "text=\${CD_CA_${index}}" + done +} + cd_set_https_verification_off () { cd_step "Set HTTPS verification off" case "${CD_OS_NAME}" in @@ -191,28 +213,6 @@ cd_install_ca_certificates () { cd_install_package "${CD_CA_PACKAGE}" } -cd_write_ca_certificates () { -local index -local target -local text - cd_step "Copy CA" - case "${CD_OS_NAME}" in - "debian") - target="/usr/local/share/ca-certificates" - cd_mkdir "${target}" - ;; - "alma") target="/etc/pki/ca-trust/source/anchors" ;; - *) cd_error_os "cd_copy_ca" ;; - esac - index=1 - eval "text=\${CD_CA_${index}}" - while [ "${text}" ] ; do - cd_write "${target}/${index}.crt" "${text}" - index=$((index+1)) - eval "text=\${CD_CA_${index}}" - done -} - cd_update_ca_certificates () { cd_step "Update CA" case "${CD_OS_NAME}" in From a5177e565bbd60a85485690fe55f456735034bbb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 1 May 2024 20:23:33 +0200 Subject: [PATCH 05/18] count ca --- cd.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cd.sh b/cd.sh index fddb122..707cafa 100644 --- a/cd.sh +++ b/cd.sh @@ -168,6 +168,7 @@ local text eval "text=\${CD_CA_${index}}" while [ "${text}" ] ; do cd_write "${target}/${index}.crt" "${text}" + CD_CA=$((CD_CA+1)) index=$((index+1)) eval "text=\${CD_CA_${index}}" done From f4b875930ed32fd28ce9f6160c16bbd27de88d2d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 1 May 2024 20:26:11 +0200 Subject: [PATCH 06/18] cd_ca/https --- cd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cd.sh b/cd.sh index 707cafa..2b5abdf 100644 --- a/cd.sh +++ b/cd.sh @@ -15,12 +15,12 @@ cd_main () { cd_set_packages_repositories cd_set_packages_configuration cd_write_ca_certificates - cd_set_https_verification_off + [ "${CD_CA}" ] && cd_set_https_verification_off cd_update_packages_catalog cd_install_packages_tools cd_install_ca_certificates cd_update_ca_certificates - cd_set_https_verification_on + [ "${CD_CA}" ] && cd_set_https_verification_on cd_update_packages_catalog cd_upgrade_packages cd_install_git From 1b1d94724bf65f987c6c5ec3c3a4b422b276610f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 1 May 2024 20:33:24 +0200 Subject: [PATCH 07/18] splits --- cd.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cd.sh b/cd.sh index 2b5abdf..6eff02a 100644 --- a/cd.sh +++ b/cd.sh @@ -271,7 +271,7 @@ local url for repository in "${@}" ; do cd_split url="${CD_PROJECTS_URL}/${repository}" - echo -n " + echo -n "\ ${url} ↓ " @@ -288,6 +288,7 @@ ${CD_PYTHON_PACKAGES} "${path}" "${CD_PYTHON_PACKAGES}" \ || exit done + cd_split cd_rm "${root}" } From 5787bf6fcafc176d2aa7292670ae142824f32ae8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 08:38:49 +0200 Subject: [PATCH 08/18] if inside https functions --- cd.sh | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/cd.sh b/cd.sh index 6eff02a..d5a54ae 100644 --- a/cd.sh +++ b/cd.sh @@ -15,12 +15,12 @@ cd_main () { cd_set_packages_repositories cd_set_packages_configuration cd_write_ca_certificates - [ "${CD_CA}" ] && cd_set_https_verification_off + cd_set_https_verification_off cd_update_packages_catalog cd_install_packages_tools cd_install_ca_certificates cd_update_ca_certificates - [ "${CD_CA}" ] && cd_set_https_verification_on + cd_set_https_verification_on cd_update_packages_catalog cd_upgrade_packages cd_install_git @@ -175,20 +175,22 @@ local text } cd_set_https_verification_off () { - cd_step "Set HTTPS verification off" - case "${CD_OS_NAME}" in - "debian") - cd_write "/etc/apt/apt.conf.d/https" "\ + if [ "${CD_CA}" ] ; then + cd_step "Set HTTPS verification off" + case "${CD_OS_NAME}" in + "debian") + cd_write "/etc/apt/apt.conf.d/https" "\ Acquire::https::Verify-Peer False; " - ;; - "alma") - cd_write "/etc/dnf/dnf.conf.d/https.conf" "\ + ;; + "alma") + cd_write "/etc/dnf/dnf.conf.d/https.conf" "\ sslverify=False " - ;; - *) cd_error_os "cd_set_https_verification_off" ;; - esac + ;; + *) cd_error_os "cd_set_https_verification_off" ;; + esac + fi } cd_update_packages_catalog () { @@ -224,12 +226,14 @@ cd_update_ca_certificates () { } cd_set_https_verification_on () { - cd_step "Set HTTPS verification on" - case "${CD_OS_NAME}" in - "debian") cd_rm "/etc/apt/apt.conf.d/https" ;; - "alma") cd_rm "/etc/dnf/dnf.conf.d/https.conf" ;; - *) cd_error_os "cd_set_https_verification_on" ;; - esac + if [ "${CD_CA}" ] ; then + cd_step "Set HTTPS verification on" + case "${CD_OS_NAME}" in + "debian") cd_rm "/etc/apt/apt.conf.d/https" ;; + "alma") cd_rm "/etc/dnf/dnf.conf.d/https.conf" ;; + *) cd_error_os "cd_set_https_verification_on" ;; + esac + fi } cd_upgrade_packages () { From 38d213895037aac4d9fb0a17aef0a2db831eb199 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 09:33:50 +0200 Subject: [PATCH 09/18] cd_ca_root --- cd.sh | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/cd.sh b/cd.sh index d5a54ae..981908d 100644 --- a/cd.sh +++ b/cd.sh @@ -42,10 +42,12 @@ cd_set_environment () { # case "${CD_OS_NAME}" in "debian") + CD_CA_ROOT="/usr/local/share/ca-certificates" CD_PYTHON_PACKAGE="python3" CD_PYTHON_PACKAGES="/usr/lib/python3/dist-packages" ;; "alma") + CD_CA_ROOT="/etc/pki/ca-trust/source/anchors" case "${CD_OS_VERSION}" in "8"|"9") CD_PYTHON_PACKAGE="python3.11" @@ -153,21 +155,13 @@ Dir::Etc::SourceParts \"\"; cd_write_ca_certificates () { local index -local target local text cd_step "Copy CA" - case "${CD_OS_NAME}" in - "debian") - target="/usr/local/share/ca-certificates" - cd_mkdir "${target}" - ;; - "alma") target="/etc/pki/ca-trust/source/anchors" ;; - *) cd_error_os "cd_copy_ca" ;; - esac + cd_mkdir "${CD_CA_ROOT}" index=1 eval "text=\${CD_CA_${index}}" while [ "${text}" ] ; do - cd_write "${target}/${index}.crt" "${text}" + cd_write "${CD_CA_ROOT}/${index}.crt" "${text}" CD_CA=$((CD_CA+1)) index=$((index+1)) eval "text=\${CD_CA_${index}}" From e745890b3305127b3be539b4aafdf3db8bd2b533 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 09:39:17 +0200 Subject: [PATCH 10/18] shrink --- cd.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/cd.sh b/cd.sh index 981908d..8aa2714 100644 --- a/cd.sh +++ b/cd.sh @@ -53,10 +53,10 @@ cd_set_environment () { CD_PYTHON_PACKAGE="python3.11" CD_PYTHON_PACKAGES="/usr/lib64/python3.11/site-packages" ;; - *) cd_error_os "CD_OS_VERSION" ;; + *) cd_error_os "CD_OS_VERSION=${CD_OS_VERSION}" ;; esac ;; - *) cd_error_os "CD_OS_NAME" ;; + *) cd_error_os "CD_OS_NAME=${CD_OS_NAME}" ;; esac # ci / github if [ "${GITHUB_ACTIONS}" ] ; then @@ -131,7 +131,6 @@ deb https://deb.debian.org/debian-security bookworm-security main cd_sed "${file}" "|^m|# m|" "|^# b|b|" cd_cat "${file}" ;; - *) cd_error_os "cd_set_packages_repositories" ;; esac } @@ -149,7 +148,6 @@ Dir::Etc::SourceParts \"\"; " ;; "alma") cd_mkdir "/etc/dnf/dnf.conf.d" ;; - *) cd_error_os "cd_set_packages_configuration" ;; esac } @@ -182,7 +180,6 @@ Acquire::https::Verify-Peer False; sslverify=False " ;; - *) cd_error_os "cd_set_https_verification_off" ;; esac fi } @@ -192,7 +189,6 @@ cd_update_packages_catalog () { case "${CD_OS_NAME}" in "debian") apt-get update || exit ;; "alma") dnf makecache || exit ;; - *) cd_error_os "cd_update_packages_catalog" ;; esac } @@ -201,7 +197,6 @@ cd_install_packages_tools () { case "${CD_OS_NAME}" in "debian") cd_install_package "apt-utils" ;; "alma") echo "TODO" ;; - *) cd_error_os "cd_install_packages_tools" ;; esac } @@ -215,7 +210,6 @@ cd_update_ca_certificates () { case "${CD_OS_NAME}" in "debian") update-ca-certificates || exit ;; "alma") update-ca-trust || exit ;; - *) cd_error_os "cd_update_ca" ;; esac } @@ -225,7 +219,6 @@ cd_set_https_verification_on () { case "${CD_OS_NAME}" in "debian") cd_rm "/etc/apt/apt.conf.d/https" ;; "alma") cd_rm "/etc/dnf/dnf.conf.d/https.conf" ;; - *) cd_error_os "cd_set_https_verification_on" ;; esac fi } @@ -235,7 +228,6 @@ cd_upgrade_packages () { case "${CD_OS_NAME}" in "debian") apt-get upgrade --assume-yes || exit ;; "alma") dnf upgrade --assumeyes || exit ;; - *) cd_error_os "cd_upgrade_packages" ;; esac } @@ -254,7 +246,6 @@ cd_clean_packages_cache () { case "${CD_OS_NAME}" in "debian") apt-get clean || exit ;; "alma") dnf clean all || exit ;; - *) cd_error_os "cd_clean_packages_cache" ;; esac } @@ -325,7 +316,6 @@ cd_install_package () { case "${CD_OS_NAME}" in "debian") apt-get install --assume-yes "${1}" || exit ;; "alma") dnf install --assumeyes "${1}" || exit ;; - *) exit 1 ;; esac fi } From b3adfe318253ee9f02eeaa0b6d013cc254df0cba Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 09:59:17 +0200 Subject: [PATCH 11/18] cd_echo --- cd.sh | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/cd.sh b/cd.sh index 8aa2714..fdddc65 100644 --- a/cd.sh +++ b/cd.sh @@ -33,6 +33,7 @@ cd_main () { # functions cd_set_environment () { +local variable cd_step "Set environment" # CD_CA_PACKAGE="ca-certificates" @@ -42,12 +43,11 @@ cd_set_environment () { # case "${CD_OS_NAME}" in "debian") - CD_CA_ROOT="/usr/local/share/ca-certificates" CD_PYTHON_PACKAGE="python3" CD_PYTHON_PACKAGES="/usr/lib/python3/dist-packages" + CD_CA_ROOT="/usr/local/share/ca-certificates" ;; "alma") - CD_CA_ROOT="/etc/pki/ca-trust/source/anchors" case "${CD_OS_VERSION}" in "8"|"9") CD_PYTHON_PACKAGE="python3.11" @@ -55,6 +55,7 @@ cd_set_environment () { ;; *) cd_error_os "CD_OS_VERSION=${CD_OS_VERSION}" ;; esac + CD_CA_ROOT="/etc/pki/ca-trust/source/anchors" ;; *) cd_error_os "CD_OS_NAME=${CD_OS_NAME}" ;; esac @@ -83,23 +84,16 @@ cd_set_environment () { CD_PROJECTS_URL="${CD_SERVER_URL}/${CD_PROJECTS_GROUP}" CD_PROJECT_URL="${CD_PROJECTS_URL}/${CD_PROJECT_NAME}" # - echo -n "\ -CD_OS_NAME=${CD_OS_NAME} -CD_OS_VERSION=${CD_OS_VERSION} -# -CD_DNS_FILE=${CD_DNS_FILE} -# -CD_PYTHON_COMMAND=${CD_PYTHON_COMMAND} -CD_PYTHON_PACKAGES=${CD_PYTHON_PACKAGES} -# -CD_SERVER_URL=${CD_SERVER_URL} -CD_PROJECTS_GROUP=${CD_PROJECTS_GROUP} -CD_PROJECT_NAME=${CD_PROJECT_NAME} -CD_PROJECT_BRANCH=${CD_PROJECT_BRANCH} -# -CD_PROJECTS_URL=${CD_PROJECTS_URL} -CD_PROJECT_URL=${CD_PROJECT_URL} -" + cd_echo "CD_OS_NAME" "CD_OS_VERSION" + cd_split + cd_echo "CD_DNS_FILE" + cd_split + cd_echo "CD_PYTHON_PACKAGE" "CD_PYTHON_PACKAGES" "CD_CA_ROOT" + cd_split + cd_echo "CD_SERVER_URL" \ + "CD_PROJECTS_GROUP" "CD_PROJECT_NAME" "CD_PROJECT_BRANCH" + cd_split + cd_echo "CD_PROJECTS_URL" "CD_PROJECT_URL" } cd_set_dns_resolving () { @@ -302,6 +296,15 @@ cd_cat () { fi } +cd_echo () { +local name + if [ "${1}" ] ; then + for name in "${@}" ; do + eval "echo ${name}=\${${name}}" + done + fi +} + cd_error_ci () { echo "× CI: ${1}" exit 1 From 0cb9952b32689ed525b24e2ba816f1f824b000e4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 10:19:18 +0200 Subject: [PATCH 12/18] cd_nop --- cd.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/cd.sh b/cd.sh index fdddc65..a0f90ba 100644 --- a/cd.sh +++ b/cd.sh @@ -8,7 +8,7 @@ cd \ rwx \ " -# steps +# main cd_main () { cd_set_environment cd_set_dns_resolving ${CD_DNS} @@ -30,7 +30,7 @@ cd_main () { cd_execute_python_module ${CD_PYTHON_MODULES} } -# functions +# steps cd_set_environment () { local variable @@ -43,6 +43,10 @@ local variable # case "${CD_OS_NAME}" in "debian") + case "${CD_OS_VERSION}" in + "bookworm"|"bullseye") cd_nop ;; + *) cd_error_os "CD_OS_VERSION=${CD_OS_VERSION}" ;; + esac CD_PYTHON_PACKAGE="python3" CD_PYTHON_PACKAGES="/usr/lib/python3/dist-packages" CD_CA_ROOT="/usr/local/share/ca-certificates" @@ -114,10 +118,10 @@ local file case "${CD_OS_NAME}" in "debian") cd_write "/etc/apt/sources.list" "\ -deb https://deb.debian.org/debian bookworm main -deb https://deb.debian.org/debian bookworm-backports main -deb https://deb.debian.org/debian bookworm-updates main -deb https://deb.debian.org/debian-security bookworm-security main +deb https://deb.debian.org/debian ${CD_OS_VERSION} main +deb https://deb.debian.org/debian ${CD_OS_VERSION}-backports main +deb https://deb.debian.org/debian ${CD_OS_VERSION}-updates main +deb https://deb.debian.org/debian-security ${CD_OS_VERSION}-security main " ;; "alma") @@ -287,7 +291,7 @@ ${1} "${CD_PYTHON_COMMAND}" -m "${1}" "${CD_STEP}" "${self}" } -# tools +# functions cd_cat () { if [ -f "${1}" ] ; then @@ -330,6 +334,10 @@ cd_mkdir () { fi } +cd_nop () { + true +} + cd_rm () { if [ -e "${1}" ] ; then echo "← $(realpath "${1}")" @@ -377,5 +385,5 @@ local text="${2}" fi } -# main +# run cd_main From c356baee6de36204ef1ef753917dd61ab504becb Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 10:27:18 +0200 Subject: [PATCH 13/18] dns --- cd.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index a0f90ba..930e37e 100644 --- a/cd.sh +++ b/cd.sh @@ -1,8 +1,10 @@ #! /usr/bin/env sh -[ "${CD_DNS}" ] || CD_DNS="\ +# defaults +CD_DEFAULT_DNS="\ 9.9.9.9 \ " + CD_PYTHON_MODULES="\ cd \ rwx \ @@ -11,7 +13,7 @@ rwx \ # main cd_main () { cd_set_environment - cd_set_dns_resolving ${CD_DNS} + cd_set_dns_resolving cd_set_packages_repositories cd_set_packages_configuration cd_write_ca_certificates @@ -102,9 +104,11 @@ local variable cd_set_dns_resolving () { local server +local servers local text="" cd_step "Set DNS resolving" - for server in "${@}" ; do + "${CD_DNS}" && servers="${CD_DNS}" || servers="${CD_DEFAULT_DNS}" + for server in ${servers} ; do text="${text}nameserver ${server} " done From e891d90b4360902a102c7805f149fc53e1ee5ddf Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 10:28:34 +0200 Subject: [PATCH 14/18] nop --- cd.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index 930e37e..ccc0d49 100644 --- a/cd.sh +++ b/cd.sh @@ -338,9 +338,7 @@ cd_mkdir () { fi } -cd_nop () { - true -} +cd_nop () { true ; } cd_rm () { if [ -e "${1}" ] ; then From efac9b8463b7454b812b79e17683ac6805629be7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 10:29:43 +0200 Subject: [PATCH 15/18] cd_write --- cd.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cd.sh b/cd.sh index ccc0d49..ca22d36 100644 --- a/cd.sh +++ b/cd.sh @@ -380,9 +380,7 @@ cd_write () { local file="${1}" local text="${2}" if [ "${file}" ] ; then - echo -n "${text}" \ - > "${file}" \ - || exit + echo -n "${text}" > "${file}" || exit cd_cat "${file}" fi } From 82e2249bbfc6c072cca870729342d732f8e010c0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 10:33:34 +0200 Subject: [PATCH 16/18] cd_error_os --- cd.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cd.sh b/cd.sh index ca22d36..4ef96ea 100644 --- a/cd.sh +++ b/cd.sh @@ -47,7 +47,7 @@ local variable "debian") case "${CD_OS_VERSION}" in "bookworm"|"bullseye") cd_nop ;; - *) cd_error_os "CD_OS_VERSION=${CD_OS_VERSION}" ;; + *) cd_error_os "CD_OS_VERSION" ;; esac CD_PYTHON_PACKAGE="python3" CD_PYTHON_PACKAGES="/usr/lib/python3/dist-packages" @@ -59,11 +59,11 @@ local variable CD_PYTHON_PACKAGE="python3.11" CD_PYTHON_PACKAGES="/usr/lib64/python3.11/site-packages" ;; - *) cd_error_os "CD_OS_VERSION=${CD_OS_VERSION}" ;; + *) cd_error_os "CD_OS_VERSION" ;; esac CD_CA_ROOT="/etc/pki/ca-trust/source/anchors" ;; - *) cd_error_os "CD_OS_NAME=${CD_OS_NAME}" ;; + *) cd_error_os "CD_OS_NAME" ;; esac # ci / github if [ "${GITHUB_ACTIONS}" ] ; then @@ -317,8 +317,11 @@ cd_error_ci () { echo "× CI: ${1}" exit 1 } + cd_error_os () { - echo "× OS: ${1}" +local variable="${1}" + echo -n "× OS: " + cd_echo "${variable}" exit 2 } From 082f231b60477f8e9a2139bd150f57fb359954f4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 10:57:24 +0200 Subject: [PATCH 17/18] fix --- cd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cd.sh b/cd.sh index 4ef96ea..8d3a52c 100644 --- a/cd.sh +++ b/cd.sh @@ -107,7 +107,7 @@ local server local servers local text="" cd_step "Set DNS resolving" - "${CD_DNS}" && servers="${CD_DNS}" || servers="${CD_DEFAULT_DNS}" + [ "${CD_DNS}" ] && servers="${CD_DNS}" || servers="${CD_DEFAULT_DNS}" for server in ${servers} ; do text="${text}nameserver ${server} " From 15bd46e9aad2db8cd9a63d6210a0ab4973be4dc9 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 2 May 2024 10:58:02 +0200 Subject: [PATCH 18/18] variables --- readme.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/readme.md b/readme.md index 95f9c4b..f2dcd3e 100644 --- a/readme.md +++ b/readme.md @@ -9,6 +9,12 @@ * [X] ForgeJo / Gitea / GitHub * [X] GitLab +## How + +### Variables + +| CD_DNS | Space separated servers | + ## Tasks * use constants for OS names