diff --git a/readme.md b/readme.md index b0915df..da899c0 100644 --- a/readme.md +++ b/readme.md @@ -240,7 +240,6 @@ Handle project workflows in a unified way: * locales * persist * test -* workspace variable #### Shell → Python diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index c0061ce..b6eaf31 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -397,12 +397,12 @@ spcd_txt_get() { esac } -# ╭─────────────────╮ -# │ e = environment │ -# ╰─────────────────╯ +# ╭──────────╮ +# │ s = step │ +# ╰──────────╯ # ╭───┬───────────╮ -# │ e │ constants │ +# │ s │ constants │ # ╰───┴───────────╯ SPCD_OS_ALMA="alma" @@ -420,9 +420,9 @@ SPCD_PM_DNF="dnf" SPCD_PM_PACMAN="pacman" SPCD_PM_ZYPPER="zypper" -# ╭───┬───────────╮ -# │ e │ functions │ -# ╰───┴───────────╯ +# ╭───┬─────────────╮ +# │ s │ environment │ +# ╰───┴─────────────╯ spcd_step__environment_print() { spcd_ca "list" @@ -836,68 +836,10 @@ spcd_python_pip() { fi } -# ╭───┬──────────────────────────────╮ -# │ f │ ca = certificate authorities │ -# ╰───┴──────────────────────────────╯ - -spcd_f_ca_install() { - spcd_step "Install package" - spcd_f_pm_pkg_install "ca-certificates" -} - -spcd_f_ca_update() { - spcd_step "Update certificates" - case "${SPCD_OS_ID}" in - "${SPCD_OS_ARCH}" | \ - "${SPCD_OS_ALMA}" | \ - "${SPCD_OS_FEDORA}" | \ - "${SPCD_OS_ROCKY}") - spcd_run update-ca-trust - ;; - "${SPCD_OS_ALPINE}" | \ - "${SPCD_OS_DEBIAN}" | \ - "${SPCD_OS_OPENSUSE}" | \ - "${SPCD_OS_UBUNTU}") - spcd_run update-ca-certificates - ;; - *) ;; - esac -} - -spcd_f_ca_write() { - spcd_step "Write certificates" - local root - case "${SPCD_OS_ID}" in - "${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}") - root="/etc/pki/ca-trust/source/anchors" - ;; - "${SPCD_OS_ALPINE}" | "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") - root="/usr/local/share/ca-certificates" - ;; - "${SPCD_OS_ARCH}") - root="/etc/ca-certificates/trust-source/anchors" - ;; - "${SPCD_OS_OPENSUSE}") - root="/etc/pki/trust/anchors" - ;; - *) ;; - esac - spcd_os_mkdir "${root}" - spcd_ca "write" "${root}" -} - # ╭───┬──────────────────────╮ # │ f │ pm = package manager │ # ╰───┴──────────────────────╯ -spcd_f_pm_install() { - spcd_step "Install tools" - case "${SPCD_PM}" in - "${SPCD_PM_APT}") spcd_f_pm_pkg_install "apt-utils" ;; - *) ;; - esac -} - # ╭───┬────┬───────╮ # │ f │ pm │ https │ # ╰───┴────┴───────╯ @@ -1170,10 +1112,6 @@ ${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET} esac } -# ╭───┬──────╮ -# │ s = step │ -# ╰───┴──────╯ - # ╭───┬─────╮ # │ s │ dns │ # ╰───┴─────╯ @@ -1368,6 +1306,75 @@ Dir::Etc::SourceParts \"\"; esac } +spcd_step__packages_install_tools() { + spcd_step "Install tools" + case "${SPCD_PM}" in + "${SPCD_PM_APT}") spcd_f_pm_pkg_install "apt-utils" ;; + *) ;; + esac +} + +spcd_step__packages_install_locales() { + spcd_step_in "Locales" + spcd_step "Install" + spcd_f_txt_locales "install" + spcd_step "Set" + spcd_f_txt_locale "set" "${SPCD_TXT_LOCALE}" + spcd_step "Show" + spcd_f_txt_locale "show" + spcd_step_out +} + +# ╭───┬────╮ +# │ s │ ca │ +# ╰───┴────╯ + +spcd_step__ca_install_package() { + spcd_step "Install package" + spcd_f_pm_pkg_install "ca-certificates" +} + +spcd_step__ca_write_certificates() { + spcd_step "Write certificates" + local root + case "${SPCD_OS_ID}" in + "${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}") + root="/etc/pki/ca-trust/source/anchors" + ;; + "${SPCD_OS_ALPINE}" | "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") + root="/usr/local/share/ca-certificates" + ;; + "${SPCD_OS_ARCH}") + root="/etc/ca-certificates/trust-source/anchors" + ;; + "${SPCD_OS_OPENSUSE}") + root="/etc/pki/trust/anchors" + ;; + *) ;; + esac + spcd_os_mkdir "${root}" + spcd_ca "write" "${root}" +} + +spcd_step__ca_update_certificates() { + spcd_step "Update certificates" + case "${SPCD_OS_ID}" in + "${SPCD_OS_ARCH}" | \ + "${SPCD_OS_ALMA}" | \ + "${SPCD_OS_FEDORA}" | \ + "${SPCD_OS_ROCKY}") + spcd_run update-ca-trust + ;; + "${SPCD_OS_ALPINE}" | \ + "${SPCD_OS_DEBIAN}" | \ + "${SPCD_OS_OPENSUSE}" | \ + "${SPCD_OS_UBUNTU}") + spcd_run update-ca-certificates + ;; + *) ;; + esac +} + # ╭───┬──────────╮ # │ s │ packages │ # ╰───┴──────────╯ @@ -1578,22 +1585,14 @@ spcd_main() { spcd_step__packages_set_configuration spcd_f_pm_https_trust spcd_f_pm_pkg_update - spcd_f_pm_install - # locales - spcd_step_in "Locales" - spcd_step "Install" - spcd_f_txt_locales "install" - spcd_step "Set" - spcd_f_txt_locale "set" "${SPCD_TXT_LOCALE}" - spcd_step "Show" - spcd_f_txt_locale "show" - spcd_step_out + spcd_step__packages_install_tools + spcd_step__packages_install_locales spcd_step_out # ca spcd_step_in "CA" - spcd_f_ca_install - spcd_f_ca_write - spcd_f_ca_update + spcd_step__ca_install_package + spcd_step__ca_write_certificates + spcd_step__ca_update_certificates spcd_step_out # packages spcd_step_in "Packages"