Compare commits

...

7 commits

Author SHA1 Message Date
7c181c84fb
locale/effective
Some checks failed
/ arch (push) Successful in 2m55s
/ alpine (push) Failing after 8s
/ fedora (push) Successful in 11m11s
/ opensuse (push) Successful in 3m41s
/ alma (push) Successful in 12m43s
/ rocky (push) Successful in 13m27s
/ ubuntu (push) Successful in 6m29s
/ debian (push) Failing after 3m30s
2024-09-03 19:23:04 +02:00
a1809e2094
−tasks/available 2024-09-03 19:18:38 +02:00
56c291ee27
spcd_txt_locales_echo 2024-09-03 19:17:08 +02:00
7d61b7c431
factorize/locales
Some checks failed
/ arch (push) Failing after 8s
/ alpine (push) Failing after 8s
/ fedora (push) Failing after 7s
/ opensuse (push) Failing after 8s
/ alma (push) Failing after 8s
/ rocky (push) Failing after 7s
/ ubuntu (push) Failing after 8s
/ debian (push) Failing after 6s
2024-09-03 18:32:48 +02:00
a0122d5ea3
factorize/dns 2024-09-03 18:19:26 +02:00
095b343fde
factorize/ca 2024-09-03 18:11:51 +02:00
f54b515115
tasks/factorize
Some checks failed
/ arch (push) Failing after 8s
/ alpine (push) Failing after 7s
/ fedora (push) Failing after 8s
/ debian (push) Failing after 7s
/ opensuse (push) Failing after 8s
/ ubuntu (push) Failing after 7s
/ alma (push) Failing after 6s
/ rocky (push) Failing after 9s
2024-09-03 12:24:27 +02:00
2 changed files with 59 additions and 69 deletions

View file

@ -222,13 +222,6 @@ Handle project workflows in a unified way:
#### Shell #### Shell
* comment * comment
* display locales
* default
* available
* effective
* selected
* available
* effective
* handle errors * handle errors
* packages * packages
* configure * configure

View file

@ -200,62 +200,51 @@ _spcd_txt_pick() {
# ╰───────────╯ # ╰───────────╯
spcd_ca() { spcd_ca() {
local index name value
local grep="\(After\|Before\|Issuer\|Signature Algorithm\|Subject:\)" local grep="\(After\|Before\|Issuer\|Signature Algorithm\|Subject:\)"
case "${1}" in local index name value
"list") local root="${2}"
while true; do while true; do
index=$((index + 1)) index=$((index + 1))
name="SPCD_CA_${index}" name="SPCD_CA_${index}"
eval "value=\"\${${name}}\"" eval "value=\"\${${name}}\""
[ -n "${value}" ] || break [ -n "${value}" ] || break
case "${1}" in
"list")
echo "${name} =" echo "${name} ="
echo "${value}" | echo "${value}" |
openssl x509 -noout -text | openssl x509 -noout -text |
grep "${grep}" grep "${grep}"
done ;;
;; "write")
"write")
local root="${2}"
while true; do
index=$((index + 1))
name="SPCD_CA_${index}"
eval "value=\"\${${name}}\""
[ -n "${value}" ] || break
spcd_os_write "${root}/${index}.crt" "${value}" spcd_os_write "${root}/${index}.crt" "${value}"
done ;;
;; *) ;;
*) ;; esac
esac done
} }
spcd_dns() { spcd_dns() {
local index name value local index name text value
case "${1}" in while true; do
"list") index=$((index + 1))
while true; do name="SPCD_DNS_${index}"
index=$((index + 1)) eval "value=\"\${${name}}\""
name="SPCD_DNS_${index}" [ -n "${value}" ] || break
eval "value=\"\${${name}}\"" case "${1}" in
[ -n "${value}" ] || break "list")
spcd_os_printenv "${name}" spcd_os_printenv "${name}"
done ;;
;; "write")
"write")
local text
while true; do
index=$((index + 1))
name="SPCD_DNS_${index}"
eval "value=\"\${${name}}\""
[ -n "${value}" ] || break
text="${text}\ text="${text}\
nameserver ${value} nameserver ${value}
" "
done ;;
*) ;;
esac
done
if [ "${1}" = "write" ]; then
spcd_os_write "/etc/resolv.conf" "${text}" spcd_os_write "/etc/resolv.conf" "${text}"
;; fi
*) ;;
esac
} }
# ╭───────────┬───────╮ # ╭───────────┬───────╮
@ -389,8 +378,9 @@ spcd_txt_get() {
} }
spcd_txt_locale() { spcd_txt_locale() {
local value name
locale locale
spcd_split
local value name
if [ -n "${1}" ]; then if [ -n "${1}" ]; then
value="${1}" value="${1}"
else else
@ -418,41 +408,48 @@ spcd_txt_locale() {
locale locale
} }
spcd_txt_locales_echo() {
case "${1}" in
"LANGUAGE") spcd_os_printenv "LANGUAGE" ;;
*) locale -a ;;
esac
}
spcd_txt_locales() { spcd_txt_locales() {
set -- \ set -- \
"${SPCD_TXT_LOCALE_ENGLISH}" \ "${SPCD_TXT_LOCALE_ENGLISH}" \
"${SPCD_TXT_LOCALE_FRENCH}" "${SPCD_TXT_LOCALE_FRENCH}"
local locale local language locale text
case "${1}" in spcd_txt_locales_echo
"glibc-langpack-") spcd_split
local language for locale in "${@}"; do
for locale in "${@}"; do case "${1}" in
"glibc-langpack-")
language="$(echo "${locale}" | cut -d _ -f 1)" language="$(echo "${locale}" | cut -d _ -f 1)"
spcd_install_package "glibc-langpack-${language}" spcd_install_package "glibc-langpack-${language}"
done ;;
;; "LANGUAGE")
"LANGUAGE")
local text
for locale in "${@}"; do
if [ -n "${text}" ]; then if [ -n "${text}" ]; then
text="${text}:${locale}" text="${text}:${locale}"
else else
text="${locale}" text="${locale}"
fi fi
done ;;
export LANGUAGE="${text}" "locale.gen")
;;
"locale.gen")
local text
for locale in "${@}"; do
text="${text}\ text="${text}\
${locale}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET} ${locale}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
" "
done ;;
spcd_os_write "/etc/locale.gen" "${text}" *) ;;
;; esac
done
case "${1}" in
"LANGUAGE") export LANGUAGE="${text}" ;;
"locale.gen") spcd_os_write "/etc/locale.gen" "${text}" ;;
*) ;; *) ;;
esac esac
spcd_split
spcd_txt_locales_echo
} }
# ╭──────╮ # ╭──────╮