diff --git a/readme.md b/readme.md index 7c38b7f..c1550fc 100644 --- a/readme.md +++ b/readme.md @@ -142,7 +142,7 @@ Handle project workflows in a unified way: | SPCD_URL_EPEL | EPEL repository URL | https://dl.fedoraproject.org | | SPCD_URL_FEDORA | Fedora repository URL | https://rpmfind.net | | SPCD_URL_OPENSUSE | OpenSUSE repository URL | https://download.opensuse.org | -| SPCD_URL_PYTHON | Python repository URL | https://pypi.org | +| SPCD_URL_PYTHON | Python repository URL | https://pypi.org/simple | | SPCD_URL_ROCKY | Rocky repository URL | https://dl.rockylinux.org | | SPCD_URL_UBUNTU | Ubuntu repository URL | https://ubuntu.mirrors.ovh.net | @@ -222,14 +222,9 @@ Handle project workflows in a unified way: #### Shell * comment -* display locales - * default - * available - * effective - * selected - * available - * effective +* drawing characters constants * handle errors +* local variables * packages * configure * apk @@ -239,11 +234,7 @@ Handle project workflows in a unified way: * opensuse * codecs repository * disable & enable https -* persist locales * test -* variables - * CA_n - * DNS_n #### Shell → Python @@ -287,6 +278,5 @@ Handle project workflows in a unified way: * automate versions fetching * handle openh264 repositories -* tex * translate to french * try to support nix diff --git a/spcd/bootstrap.sh b/spcd/bootstrap.sh index 1d0592e..4e3b7a2 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -4,16 +4,6 @@ # │ _ │ # ╰───╯ -_SPCD_BOX_DOWN_AND_HORIZONTAL="┬" -_SPCD_BOX_DOWN_AND_LEFT="╮" -_SPCD_BOX_DOWN_AND_RIGHT="╭" -_SPCD_BOX_HORIZONTAL="─" -_SPCD_BOX_LEFT="╴" -_SPCD_BOX_UP_AND_HORIZONTAL="┴" -_SPCD_BOX_UP_AND_LEFT="╯" -_SPCD_BOX_UP_AND_RIGHT="╰" -_SPCD_BOX_VERTICAL="│" - _SPCD_CMD_SUM="sha512sum" _spcd_fill() { @@ -28,14 +18,14 @@ _spcd_fill() { # │ _ │ banner │ # ╰───┴────────╯ -_SPCD_BANNER_BOTTOM_LEFT="${_SPCD_BOX_UP_AND_RIGHT}" -_SPCD_BANNER_BOTTOM_MIDDLE="${_SPCD_BOX_UP_AND_HORIZONTAL}" -_SPCD_BANNER_BOTTOM_RIGHT="${_SPCD_BOX_UP_AND_LEFT}" -_SPCD_BANNER_HORIZONTAL="${_SPCD_BOX_HORIZONTAL}" -_SPCD_BANNER_TOP_LEFT="${_SPCD_BOX_DOWN_AND_RIGHT}" -_SPCD_BANNER_TOP_MIDDLE="${_SPCD_BOX_DOWN_AND_HORIZONTAL}" -_SPCD_BANNER_TOP_RIGHT="${_SPCD_BOX_DOWN_AND_LEFT}" -_SPCD_BANNER_VERTICAL="${_SPCD_BOX_VERTICAL}" +_SPCD_BANNER_DOWN_AND_HORIZONTAL="┬" +_SPCD_BANNER_DOWN_AND_LEFT="╮" +_SPCD_BANNER_DOWN_AND_RIGHT="╭" +_SPCD_BANNER_HORIZONTAL="─" +_SPCD_BANNER_UP_AND_HORIZONTAL="┴" +_SPCD_BANNER_UP_AND_LEFT="╯" +_SPCD_BANNER_UP_AND_RIGHT="╰" +_SPCD_BANNER_VERTICAL="│" _spcd_banner_add() { if [ -n "${1}" ]; then @@ -53,7 +43,9 @@ _spcd_banner_add() { } _spcd_banner_add_index() { - local level value label + local label + local level + local value while true; do level=$((level + 1)) eval "value=\"\${__SPCD_STEP_${level}_INDEX}\"" @@ -84,9 +76,9 @@ ${__SPCD_BANNER_BOTTOM}" _spcd_banner_open() { _spcd_banner_append \ - "${_SPCD_BANNER_TOP_LEFT}" \ + "${_SPCD_BANNER_DOWN_AND_RIGHT}" \ "${_SPCD_BANNER_VERTICAL}" \ - "${_SPCD_BANNER_BOTTOM_LEFT}" + "${_SPCD_BANNER_UP_AND_RIGHT}" } _spcd_banner_render() { @@ -94,7 +86,8 @@ _spcd_banner_render() { _spcd_banner_add "S" _spcd_banner_add_index # - local level value + local level + local value while true; do level=$((level + 1)) eval "value=\"\${__SPCD_STEP_${level}_LABEL}\"" @@ -109,16 +102,16 @@ _spcd_banner_render() { _spcd_banner_shut() { _spcd_banner_append \ - "${_SPCD_BANNER_TOP_RIGHT}" \ + "${_SPCD_BANNER_DOWN_AND_LEFT}" \ "${_SPCD_BANNER_VERTICAL}" \ - "${_SPCD_BANNER_BOTTOM_RIGHT}" + "${_SPCD_BANNER_UP_AND_LEFT}" } _spcd_banner_split() { _spcd_banner_append \ - "${_SPCD_BANNER_TOP_MIDDLE}" \ + "${_SPCD_BANNER_DOWN_AND_HORIZONTAL}" \ "${_SPCD_BANNER_VERTICAL}" \ - "${_SPCD_BANNER_BOTTOM_MIDDLE}" + "${_SPCD_BANNER_UP_AND_HORIZONTAL}" } _spcd_banner_wipe() { @@ -139,8 +132,8 @@ _SPCD_ERROR_OS=2 # │ _ │ frame │ # ╰───┴───────╯ -_SPCD_FRAME_TOP="${_SPCD_BOX_DOWN_AND_RIGHT}${_SPCD_BOX_LEFT}" -_SPCD_FRAME_BOTTOM="${_SPCD_BOX_UP_AND_RIGHT}${_SPCD_BOX_LEFT}" +_SPCD_FRAME_TOP="╭╴" +_SPCD_FRAME_BOTTOM="╰╴" _spcd_frame_open() { echo "${_SPCD_FRAME_TOP}${1}" @@ -222,8 +215,7 @@ spcd_openssl_x509() { if [ -f "${1}" ]; then openssl x509 \ -in "${1}" \ - -noout -text | - grep "\(After\|Before\|Issuer\|Signature A\|Subject:\)" + -noout -text fi } @@ -254,7 +246,8 @@ spcd_os_mkdir() { spcd_os_printenv() { if [ -n "${1}" ]; then - local name text + local name + local text for name in "${@}"; do eval "text=\"\${${name}}\"" echo "${name} = \"${text}\"" @@ -343,7 +336,9 @@ spcd_txt_get() { } spcd_txt_locale() { - local value name + # LANGUAGE + local name + local value if [ -n "${1}" ]; then value="${1}" else @@ -369,43 +364,6 @@ spcd_txt_locale() { done } -spcd_txt_locales() { - set -- \ - "${SPCD_TXT_LOCALE_ENGLISH}" \ - "${SPCD_TXT_LOCALE_FRENCH}" - local locale - case "${1}" in - "glibc-langpack-") - local language - for locale in "${@}"; do - language="$(echo "${locale}" | cut -d _ -f 1)" - spcd_install_package "glibc-langpack-${language}" - done - ;; - "LANGUAGE") - local text - for locale in "${@}"; do - if [ -n "${text}" ]; then - text="${text}:${locale}" - else - text="${locale}" - fi - done - export LANGUAGE="${text}" - ;; - "locale.gen") - local text - for locale in "${@}"; do - text="${text}\ -${locale}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET} -" - done - spcd_os_write "/etc/locale.gen" "${text}" - ;; - *) ;; - esac -} - # ╭──────╮ # │ step │ # ╰──────╯ @@ -454,7 +412,9 @@ spcd_step__environment_defaults_print() { "URL_PYTHON" \ "URL_ROCKY" \ "URL_UBUNTU" - local item name value + local item + local name + local value for item in "${@}"; do name="SPCD_${item}" eval "value=\"\${${name}}\"" @@ -1214,20 +1174,32 @@ spcd_step__packages_verify_https() { spcd_step__packages_install_locales() { spcd_step "Install locales" + set -- \ + "${SPCD_TXT_LOCALE_ENGLISH}" \ + "${SPCD_TXT_LOCALE_FRENCH}" case "${SPCD_PM}" in "${SPCD_PM_APK}") spcd_install_package "musl-locales" ;; "${SPCD_PM_APT}") - spcd_txt_locales "locale.gen" + local locale text + for locale in "${@}"; do + text="${text}\ +${locale}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET} +" + done + spcd_os_write "/etc/locale.gen" "${text}" spcd_install_package "locales" ;; "${SPCD_PM_DNF}") - spcd_txt_locales "glibc-langpack-" + local locale language + for locale in "${@}"; do + language="$(echo "${locale}" | cut -d _ -f 1)" + spcd_install_package "glibc-langpack-${language}" + done ;; "${SPCD_PM_PACMAN}") spcd_install_package "glibc-locales" ;; "${SPCD_PM_ZYPPER}") spcd_install_package "glibc-locale" ;; *) ;; esac - spcd_txt_locales "LANGUAGE" spcd_txt_locale "${SPCD_TXT_LOCALE}" }