diff --git a/readme.md b/readme.md index c1550fc..7c38b7f 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/simple | +| SPCD_URL_PYTHON | Python repository URL | https://pypi.org | | SPCD_URL_ROCKY | Rocky repository URL | https://dl.rockylinux.org | | SPCD_URL_UBUNTU | Ubuntu repository URL | https://ubuntu.mirrors.ovh.net | @@ -222,9 +222,14 @@ Handle project workflows in a unified way: #### Shell * comment -* drawing characters constants +* display locales + * default + * available + * effective + * selected + * available + * effective * handle errors -* local variables * packages * configure * apk @@ -234,7 +239,11 @@ Handle project workflows in a unified way: * opensuse * codecs repository * disable & enable https +* persist locales * test +* variables + * CA_n + * DNS_n #### Shell → Python @@ -278,5 +287,6 @@ 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 4e3b7a2..1d0592e 100644 --- a/spcd/bootstrap.sh +++ b/spcd/bootstrap.sh @@ -4,6 +4,16 @@ # │ _ │ # ╰───╯ +_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() { @@ -18,14 +28,14 @@ _spcd_fill() { # │ _ │ banner │ # ╰───┴────────╯ -_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_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_add() { if [ -n "${1}" ]; then @@ -43,9 +53,7 @@ _spcd_banner_add() { } _spcd_banner_add_index() { - local label - local level - local value + local level value label while true; do level=$((level + 1)) eval "value=\"\${__SPCD_STEP_${level}_INDEX}\"" @@ -76,9 +84,9 @@ ${__SPCD_BANNER_BOTTOM}" _spcd_banner_open() { _spcd_banner_append \ - "${_SPCD_BANNER_DOWN_AND_RIGHT}" \ + "${_SPCD_BANNER_TOP_LEFT}" \ "${_SPCD_BANNER_VERTICAL}" \ - "${_SPCD_BANNER_UP_AND_RIGHT}" + "${_SPCD_BANNER_BOTTOM_LEFT}" } _spcd_banner_render() { @@ -86,8 +94,7 @@ _spcd_banner_render() { _spcd_banner_add "S" _spcd_banner_add_index # - local level - local value + local level value while true; do level=$((level + 1)) eval "value=\"\${__SPCD_STEP_${level}_LABEL}\"" @@ -102,16 +109,16 @@ _spcd_banner_render() { _spcd_banner_shut() { _spcd_banner_append \ - "${_SPCD_BANNER_DOWN_AND_LEFT}" \ + "${_SPCD_BANNER_TOP_RIGHT}" \ "${_SPCD_BANNER_VERTICAL}" \ - "${_SPCD_BANNER_UP_AND_LEFT}" + "${_SPCD_BANNER_BOTTOM_RIGHT}" } _spcd_banner_split() { _spcd_banner_append \ - "${_SPCD_BANNER_DOWN_AND_HORIZONTAL}" \ + "${_SPCD_BANNER_TOP_MIDDLE}" \ "${_SPCD_BANNER_VERTICAL}" \ - "${_SPCD_BANNER_UP_AND_HORIZONTAL}" + "${_SPCD_BANNER_BOTTOM_MIDDLE}" } _spcd_banner_wipe() { @@ -132,8 +139,8 @@ _SPCD_ERROR_OS=2 # │ _ │ frame │ # ╰───┴───────╯ -_SPCD_FRAME_TOP="╭╴" -_SPCD_FRAME_BOTTOM="╰╴" +_SPCD_FRAME_TOP="${_SPCD_BOX_DOWN_AND_RIGHT}${_SPCD_BOX_LEFT}" +_SPCD_FRAME_BOTTOM="${_SPCD_BOX_UP_AND_RIGHT}${_SPCD_BOX_LEFT}" _spcd_frame_open() { echo "${_SPCD_FRAME_TOP}${1}" @@ -215,7 +222,8 @@ spcd_openssl_x509() { if [ -f "${1}" ]; then openssl x509 \ -in "${1}" \ - -noout -text + -noout -text | + grep "\(After\|Before\|Issuer\|Signature A\|Subject:\)" fi } @@ -246,8 +254,7 @@ spcd_os_mkdir() { spcd_os_printenv() { if [ -n "${1}" ]; then - local name - local text + local name text for name in "${@}"; do eval "text=\"\${${name}}\"" echo "${name} = \"${text}\"" @@ -336,9 +343,7 @@ spcd_txt_get() { } spcd_txt_locale() { - # LANGUAGE - local name - local value + local value name if [ -n "${1}" ]; then value="${1}" else @@ -364,6 +369,43 @@ 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 │ # ╰──────╯ @@ -412,9 +454,7 @@ spcd_step__environment_defaults_print() { "URL_PYTHON" \ "URL_ROCKY" \ "URL_UBUNTU" - local item - local name - local value + local item name value for item in "${@}"; do name="SPCD_${item}" eval "value=\"\${${name}}\"" @@ -1174,32 +1214,20 @@ 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}") - 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_txt_locales "locale.gen" spcd_install_package "locales" ;; "${SPCD_PM_DNF}") - local locale language - for locale in "${@}"; do - language="$(echo "${locale}" | cut -d _ -f 1)" - spcd_install_package "glibc-langpack-${language}" - done + spcd_txt_locales "glibc-langpack-" ;; "${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}" }