V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m41s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m41s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -25,13 +25,15 @@ guard_sourcing
|
||||
# 0: Successfully executed commands.
|
||||
#######################################
|
||||
do_in_target() {
|
||||
declare var_chroot_target="$1"; shift
|
||||
declare var_chroot_target="$1"
|
||||
shift
|
||||
declare -a ary_chroot_command=("$@")
|
||||
if chroot "${var_chroot_target}" /usr/bin/env -i \
|
||||
HOME=/root \
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin \
|
||||
TERM="${TERM}" \
|
||||
"${ary_chroot_command[@]}"; then
|
||||
"${ary_chroot_command[@]}"
|
||||
then
|
||||
do_log "info" "true" "Success: chroot ${var_chroot_target}: ${ary_chroot_command[*]}"
|
||||
return 0
|
||||
else
|
||||
|
||||
@@ -12,45 +12,51 @@
|
||||
|
||||
guard_sourcing
|
||||
|
||||
###########################################################################################
|
||||
# Set locale and configure keyboard layout
|
||||
#######################################
|
||||
# Set locale and configure keyboard layout.
|
||||
# Globals:
|
||||
# MODULE_ERR
|
||||
# MODULE_TXT
|
||||
# TARGET
|
||||
# locale_country
|
||||
# locale_keyboard_layout
|
||||
# locale_keyboard_xkb_keymap
|
||||
# locale_language
|
||||
# locale_locale
|
||||
# Arguments:
|
||||
# None
|
||||
###########################################################################################
|
||||
# Returns:
|
||||
# 0: Successfully executed commands.
|
||||
#######################################
|
||||
setup_locales() {
|
||||
do_in_target "${TARGET}" apt-get install -y locales
|
||||
|
||||
# TODO: Alternative elif statement to use separately configured variables '{$locale_country}' and '{$locale_language}'.
|
||||
# Give priority to '${locale_locale}' over separately configured variables '{$locale_country}' and '{$locale_language}'.
|
||||
### Give priority to '${locale_locale}' over separately configured variables '{$locale_country}' and '{$locale_language}'.
|
||||
### If 'locale_locale' is not set, build it from 'locale_language' and 'locale_country'.
|
||||
if [[ -n "${locale_language:-}" && -n "${locale_country:-}" && -z "${locale_locale}" ]]; then
|
||||
locale_locale="${locale_language}_${locale_country}.UTF-8"
|
||||
fi
|
||||
|
||||
if [[ -n "${locale_locale}" ]]; then
|
||||
|
||||
# Generate the specified locale
|
||||
### Generate the specified locale
|
||||
do_in_target "${TARGET}" locale-gen "${locale_locale}"
|
||||
do_log "info" "true" "Command: 'locale-gen ${locale_locale}' executed in: '${TARGET}'."
|
||||
|
||||
# Set the standard locale
|
||||
### Set the standard locale
|
||||
do_in_target "${TARGET}" update-locale LANG="${locale_locale}" LC_ALL="${locale_locale}"
|
||||
do_log "info" "true" "Command: 'update-locale LANG=${locale_locale} LC_ALL=${locale_locale}' executed in: '${TARGET}'."
|
||||
|
||||
# Set the keyboard layout for the system (for consoles)
|
||||
### Set the keyboard layout for the system (for consoles)
|
||||
# shellcheck disable=SC2154 # "${locale_keyboard_layout}"
|
||||
sed -i "s/^KEYMAP=.*/KEYMAP=${locale_keyboard_layout}/" "${TARGET}"/etc/default/keyboard
|
||||
do_log "info" "false" "Keyboard layout updated: 'KEYMAP=${locale_keyboard_layout}' -> '${TARGET}/etc/default/keyboard'."
|
||||
|
||||
# Set the X11 keyboard layout (for graphical environments)
|
||||
### Set the X11 keyboard layout (for graphical environments)
|
||||
# shellcheck disable=SC2154 # "${locale_keyboard_xkb_keymap}"
|
||||
do_in_target "${TARGET}" localectl set-x11-keymap "${locale_keyboard_xkb_keymap}"
|
||||
do_log "info" "true" "Command: 'localectl set-x11-keymap ${locale_keyboard_xkb_keymap}' executed in: '${TARGET}'."
|
||||
|
||||
fi
|
||||
|
||||
do_show_footer "${MODULE_TXT}"
|
||||
return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh:
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
|
||||
Reference in New Issue
Block a user