Compare commits

...

18 commits

Author SHA1 Message Date
781d907b07
tasks
Some checks failed
/ arch (push) Failing after 7s
/ alpine (push) Failing after 8s
/ fedora (push) Failing after 6s
/ opensuse (push) Failing after 6s
/ alma (push) Failing after 7s
/ rocky (push) Failing after 7s
/ ubuntu (push) Failing after 6s
/ debian (push) Failing after 7s
2024-09-05 11:26:32 +02:00
b847d77ae3
musl_locpath
Some checks failed
/ arch (push) Successful in 2m56s
/ alpine (push) Successful in 2m0s
/ fedora (push) Successful in 13m29s
/ opensuse (push) Successful in 3m47s
/ alma (push) Successful in 12m16s
/ rocky (push) Successful in 12m11s
/ ubuntu (push) Successful in 6m37s
/ debian (push) Failing after 4m11s
2024-09-04 22:58:16 +02:00
cf521c52d2
locales/test
Some checks failed
/ arch (push) Successful in 2m47s
/ alpine (push) Successful in 1m58s
/ fedora (push) Successful in 8m0s
/ debian (push) Failing after 5m52s
/ opensuse (push) Successful in 3m34s
/ ubuntu (push) Successful in 10m33s
/ alma (push) Successful in 9m27s
/ rocky (push) Has started running
2024-09-04 22:15:30 +02:00
55ba36326c
locales
Some checks failed
/ arch (push) Successful in 2m47s
/ alpine (push) Successful in 1m46s
/ fedora (push) Successful in 13m0s
/ opensuse (push) Successful in 3m48s
/ alma (push) Successful in 12m26s
/ rocky (push) Successful in 13m3s
/ ubuntu (push) Successful in 6m21s
/ debian (push) Failing after 3m37s
2024-09-04 16:42:40 +02:00
8a3986f2b1
locales/earlier 2024-09-04 16:38:16 +02:00
a9c7fa01a7
print 2024-09-04 16:15:17 +02:00
5d9100a39b
locale/language
Some checks failed
/ arch (push) Successful in 2m44s
/ alpine (push) Successful in 1m45s
/ fedora (push) Successful in 12m51s
/ opensuse (push) Successful in 3m43s
/ alma (push) Successful in 13m6s
/ rocky (push) Successful in 12m19s
/ ubuntu (push) Successful in 6m29s
/ debian (push) Failing after 3m25s
2024-09-04 15:29:43 +02:00
aac5e65650
fix locales 2024-09-04 15:27:21 +02:00
1773608215
rewrite locales 2024-09-04 15:22:03 +02:00
dc51f1eba6
mv 2024-09-04 14:44:39 +02:00
44f68bcca2
transfer language 2024-09-04 14:41:43 +02:00
56b9215ef3
command 2024-09-04 14:26:17 +02:00
84c0885f1f
locale/alpine 2024-09-04 14:25:32 +02:00
d592c30ffd
mv 2024-09-04 14:23:15 +02:00
194ff1b177
rewrite locale 2024-09-04 14:21:28 +02:00
e42561f3c1
locale/split 2024-09-04 14:06:14 +02:00
05ccc94e9c
action,locale
Some checks failed
/ arch (push) Successful in 2m58s
/ alpine (push) Successful in 1m57s
/ fedora (push) Successful in 11m56s
/ opensuse (push) Successful in 3m32s
/ alma (push) Successful in 12m23s
/ rocky (push) Successful in 11m27s
/ ubuntu (push) Successful in 7m2s
/ debian (push) Failing after 3m32s
2024-09-04 13:56:46 +02:00
18de897329
spcd_txt_locale
Some checks failed
/ arch (push) Successful in 2m54s
/ alpine (push) Successful in 2m27s
/ fedora (push) Successful in 11m42s
/ opensuse (push) Successful in 3m41s
/ alma (push) Successful in 12m23s
/ rocky (push) Successful in 11m47s
/ ubuntu (push) Successful in 6m28s
/ debian (push) Failing after 3m37s
2024-09-04 12:07:25 +02:00
2 changed files with 142 additions and 101 deletions

View file

@ -221,6 +221,7 @@ Handle project workflows in a unified way:
#### Shell #### Shell
* command to echo & run
* comment * comment
* handle errors * handle errors
* packages * packages
@ -235,7 +236,10 @@ Handle project workflows in a unified way:
* opensuse * opensuse
* opensuse * opensuse
* disable & enable https * disable & enable https
* persist locales * locales
* persist
* restrict LC_* variables set for alpine
* test LC_* variables
* test * test
#### Shell → Python #### Shell → Python

View file

@ -377,81 +377,6 @@ spcd_txt_get() {
esac esac
} }
spcd_txt_locale() {
locale
spcd_split
local value name
if [ -n "${1}" ]; then
value="${1}"
else
value="${_SPCD_TXT_LOCALE_DEFAULT}"
fi
value="${value}.${_SPCD_TXT_CHARSET}"
set -- \
"LANG" \
"LC_CTYPE" \
"LC_NUMERIC" \
"LC_TIME" \
"LC_COLLATE" \
"LC_MONETARY" \
"LC_MESSAGES" \
"LC_PAPER" \
"LC_NAME" \
"LC_ADDRESS" \
"LC_TELEPHONE" \
"LC_MEASUREMENT" \
"LC_IDENTIFICATION"
for name in "${@}"; do
export "${name}=${value}"
done
spcd_split
locale
}
spcd_txt_locales_echo() {
case "${1}" in
"LANGUAGE") spcd_os_printenv "LANGUAGE" ;;
*) locale -a ;;
esac
}
spcd_txt_locales() {
set -- \
"${SPCD_TXT_LOCALE_ENGLISH}" \
"${SPCD_TXT_LOCALE_FRENCH}"
local language locale text
spcd_txt_locales_echo
spcd_split
for locale in "${@}"; do
case "${1}" in
"glibc-langpack-")
language="$(echo "${locale}" | cut -d _ -f 1)"
spcd_install_package "glibc-langpack-${language}"
;;
"LANGUAGE")
if [ -n "${text}" ]; then
text="${text}:${locale}"
else
text="${locale}"
fi
;;
"locale.gen")
text="${text}\
${locale}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
"
;;
*) ;;
esac
done
case "${1}" in
"LANGUAGE") export LANGUAGE="${text}" ;;
"locale.gen") spcd_os_write "/etc/locale.gen" "${text}" ;;
*) ;;
esac
spcd_split
spcd_txt_locales_echo
}
# ╭──────╮ # ╭──────╮
# │ step │ # │ step │
# ╰──────╯ # ╰──────╯
@ -479,7 +404,7 @@ SPCD_PM_ZYPPER="zypper"
# │ step │ environment │ # │ step │ environment │
# ╰──────┴─────────────╯ # ╰──────┴─────────────╯
spcd_step__environment_defaults_print() { spcd_step__environment_print() {
spcd_ca "list" spcd_ca "list"
spcd_dns "list" spcd_dns "list"
set -- \ set -- \
@ -936,6 +861,128 @@ spcd_query_package() {
esac esac
} }
spcd_txt_locale() {
local action="${1}"
local chosen="${2}"
set -- \
"LANG" \
"LC_CTYPE" \
"LC_NUMERIC" \
"LC_TIME" \
"LC_COLLATE" \
"LC_MONETARY" \
"LC_MESSAGES"
case "${SPCD_OS_ID}" in
"${SPCD_OS_ALPINE}") ;;
*)
set -- \
"${@}" \
"LANGUAGE" \
"LC_PAPER" \
"LC_NAME" \
"LC_ADDRESS" \
"LC_TELEPHONE" \
"LC_MEASUREMENT" \
"LC_IDENTIFICATION"
;;
esac
local name
case "${action}" in
"list")
if ! locale; then
for name in "${@}"; do
spcd_os_printenv "${name}"
done
fi
;;
"set")
spcd_txt_locale "list"
spcd_split
local locale long
if [ -n "${chosen}" ]; then
locale="${chosen}"
else
locale="${_SPCD_TXT_LOCALE_DEFAULT}"
fi
long="${locale}.${_SPCD_TXT_CHARSET}"
for name in "${@}"; do
if [ "${name}" != "LANGUAGE" ]; then
export "${name}=${long}"
else
export "${name}=$(spcd_txt_locales language "${chosen}")"
fi
done
spcd_split
spcd_txt_locale "list"
;;
*) ;;
esac
}
spcd_txt_locales() {
local action="${1}"
local chosen="${2}"
set -- \
"${SPCD_TXT_LOCALE_ENGLISH}" \
"${SPCD_TXT_LOCALE_FRENCH}"
local name
case "${action}" in
"install")
spcd_txt_locales "list"
spcd_split
case "${SPCD_PM}" in
"${SPCD_PM_APK}")
spcd_install_package "musl-locales"
export MUSL_LOCPATH="/usr/share/i18n/locales/musl"
;;
"${SPCD_PM_APT}")
local text
for name in "${@}"; do
text="${text}\
${name}.${_SPCD_TXT_CHARSET} ${_SPCD_TXT_CHARSET}
"
done
spcd_os_write "/etc/locale.gen" "${text}"
spcd_install_package "locales"
;;
"${SPCD_PM_DNF}")
local language
for name in "${@}"; do
language="$(echo "${name}" | 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_split
spcd_txt_locales "list"
;;
"language")
local text
if [ -n "${chosen}" ]; then
text="${chosen}"
fi
for name in "${@}"; do
if [ "${name}" != "${chosen}" ]; then
if [ -n "${text}" ]; then
text="${text}:${name}"
else
text="${name}"
fi
fi
done
;;
"list")
if ! locale --all-locales; then
echo "No locales yet!"
fi
;;
*) ;;
esac
}
# ╭──────┬─────╮ # ╭──────┬─────╮
# │ step │ dns │ # │ step │ dns │
# ╰──────┴─────╯ # ╰──────┴─────╯
@ -1178,6 +1225,17 @@ spcd_step__packages_install_tools() {
esac esac
} }
spcd_step__packages_install_locales() {
spcd_step_in "Locales"
spcd_step "Install"
spcd_txt_locales "install"
spcd_step "Set"
spcd_txt_locale "set" "${SPCD_TXT_LOCALE}"
spcd_step "Test"
date
spcd_step_out
}
# ╭──────┬────╮ # ╭──────┬────╮
# │ step │ ca │ # │ step │ ca │
# ╰──────┴────╯ # ╰──────┴────╯
@ -1241,25 +1299,6 @@ spcd_step__packages_verify_https() {
fi fi
} }
spcd_step__packages_install_locales() {
spcd_step "Install locales"
case "${SPCD_PM}" in
"${SPCD_PM_APK}") spcd_install_package "musl-locales" ;;
"${SPCD_PM_APT}")
spcd_txt_locales "locale.gen"
spcd_install_package "locales"
;;
"${SPCD_PM_DNF}")
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}"
}
spcd_step__packages_upgrade_system() { spcd_step__packages_upgrade_system() {
spcd_step "Upgrade system" spcd_step "Upgrade system"
case "${SPCD_PM}" in case "${SPCD_PM}" in
@ -1459,15 +1498,13 @@ ${SPCD_PYTHON_ALIAS} / ${name}"
spcd_main() { spcd_main() {
# environment # environment
spcd_txt_locale
#
spcd_step_in "Environment" spcd_step_in "Environment"
spcd_step_in "Defaults" spcd_step_in "Defaults"
spcd_step "Print defined" spcd_step "Print defined"
spcd_step__environment_defaults_print spcd_step__environment_print
spcd_step__environment_defaults_set spcd_step__environment_defaults_set
spcd_step "Print effective" spcd_step "Print effective"
spcd_step__environment_defaults_print spcd_step__environment_print
spcd_step_out spcd_step_out
spcd_step__environment_set_variables spcd_step__environment_set_variables
spcd_step__environment_list_workspace spcd_step__environment_list_workspace
@ -1481,6 +1518,7 @@ spcd_main() {
spcd_step__packages_trust_https spcd_step__packages_trust_https
spcd_step__packages_update_catalog spcd_step__packages_update_catalog
spcd_step__packages_install_tools spcd_step__packages_install_tools
spcd_step__packages_install_locales
spcd_step_out spcd_step_out
# ca # ca
spcd_step_in "CA" spcd_step_in "CA"
@ -1491,7 +1529,6 @@ spcd_main() {
# packages # packages
spcd_step_in "Packages" spcd_step_in "Packages"
spcd_step__packages_verify_https spcd_step__packages_verify_https
spcd_step__packages_install_locales
spcd_step__packages_update_catalog spcd_step__packages_update_catalog
spcd_step__packages_upgrade_system spcd_step__packages_upgrade_system
spcd_step__packages_install_dos2unix spcd_step__packages_install_dos2unix