From c55a7c90aefc79122e000a67ac04f297b9721455 Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Fri, 21 Jul 2023 14:50:27 +0200 Subject: [PATCH] move vconsole into localize script --- usr/bin/archboot-localize.sh | 31 +++++++++++++ usr/bin/archboot-vconsole.sh | 74 ------------------------------- usr/lib/archboot/login.sh | 5 +-- usr/lib/archboot/update/update.sh | 7 +-- 4 files changed, 34 insertions(+), 83 deletions(-) delete mode 100755 usr/bin/archboot-vconsole.sh diff --git a/usr/bin/archboot-localize.sh b/usr/bin/archboot-localize.sh index 4ba89af5d..a54d4cfe3 100755 --- a/usr/bin/archboot-localize.sh +++ b/usr/bin/archboot-localize.sh @@ -36,10 +36,41 @@ _localize() { sleep 3 } +_vconsole_font() { + # Terminus font size detection + if grep -q '^FONT=.*32' /etc/vconsole.conf; then + _FONT="ter-v32n" + else + _FONT="ter-v16n" + fi +} + +_vconsole_keymap() { + _KEYMAPS="us de es fr pt be bg br ca cz dk et fi gr hu it l lv mk nl no pl ro ru sk sr sv uk" + _LOW_LOCALE="$(echo ${_LOCALE} | tr A-Z a-z)" + _KEYMAP="" + for i in _KEYMAPS; do + echo $i | grep -q "${_LOW_LOCALE}" && _KEYMAP="${i}" + [[ -n ${_KEYMAP} ]] && break + done +} + +_vconsole() { + _dialog --infobox "Setting vconsole font ${_FONT} and keymap ${_KEYMAP}..." 3 80 + echo KEYMAP="${_KEYMAP}" > /etc/vconsole.conf + echo FONT="${_FONT}" >> /etc/vconsole.conf + systemctl restart systemd-vconsole-setup + sleep 3 + return 0 +} + _check while [[ -z ${_LOCALE} ]]; do _localize_menu done +_vconsole_font +_vconsole_keymap +_vconsole _localize _cleanup # vim: set ts=4 sw=4 et: diff --git a/usr/bin/archboot-vconsole.sh b/usr/bin/archboot-vconsole.sh deleted file mode 100755 index 00d8001a8..000000000 --- a/usr/bin/archboot-vconsole.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-2.0-only -# written by Tobias Powalowski -. /usr/lib/archboot/basic-common.sh -_TITLE="Archboot ${_RUNNING_ARCH} | Basic Setup | Vconsole Configuration" -_LIST_MAPS="localectl list-keymaps --no-pager" - -_vconsole() { - _dialog --infobox "Setting vconsole font ${_FONT} and keymap ${_KEYMAP}..." 3 80 - echo KEYMAP="${_KEYMAP}" > /etc/vconsole.conf - echo FONT="${_FONT}" >> /etc/vconsole.conf - systemctl restart systemd-vconsole-setup - sleep 3 - _dialog --infobox "Vconsole configuration completed successfully." 3 50 - sleep 3 - return 0 -} - -_vconsole_font() { - # Terminus font size detection - if grep -q '^FONT=.*32' /etc/vconsole.conf; then - _FONT="ter-v32n" - else - _FONT="ter-v16n" - fi -} - -_vconsole_keymap() { - _CONTINUE="" - while [[ -z "${_CONTINUE}" ]]; do - # get list of 2 sign locale - # ${KEYMAP} | grep -v '...' | grep "^[a-z]" - _KEYMAPS="us English de German es Spanish fr French pt Portuguese OTHER More" - _OTHER_KEYMAPS="be Belarusian bg Bulgarian br Brazil ca Canada cz Czech dk Dansk et Estonian fi Finnish gr Greek hu Hungarian it Italian lt Lithuanian lv Latvian mk Macedonian nl Dutch no Norwegian pl Polish ro Romanian ru Russian sk Slovak sr Serbian sv Swedish uk Ukrainian" - #shellcheck disable=SC2086 - if _dialog --cancel-label "Exit" --title " Keymap Region " --menu "" 12 40 6 ${_KEYMAPS} 2>${_ANSWER}; then - _KEYMAP=$(cat ${_ANSWER}) - _CONTINUE="1" - if [[ "${_KEYMAP}" == "OTHER" ]]; then - _CONTINUE="" - #shellcheck disable=SC2086 - if _dialog --cancel-label "Back" --title " Keymap Region " --menu "" 17 40 11 ${_OTHER_KEYMAPS} 2>${_ANSWER}; then - _KEYMAP=$(cat ${_ANSWER}) - _CONTINUE=1 - fi - fi - else - _abort - fi - if [[ -n "${_CONTINUE}" ]]; then - _KEYMAPS="" - for i in $(${_LIST_MAPS} | grep "^${_KEYMAP}" | grep -v 'olpc' | grep -v 'mobii' | grep -v 'alt' | grep -v '^carpalx' | grep -v 'defkey' | grep -v 'mac' | grep -v 'amiga' | grep -v 'sun' | grep -v 'atari'); do - _KEYMAPS="${_KEYMAPS} ${i} -" - done - #shellcheck disable=SC2086 - if _dialog --cancel-label "Back" --title " Keymap Layout " --menu "" 13 40 7 ${_KEYMAPS} 2>${_ANSWER}; then - #shellcheck disable=SC2086 - _KEYMAP=$(cat ${_ANSWER}) - _CONTINUE=1 - else - _CONTINUE="" - fi - fi - done -} - -_check -while true; do - _vconsole_font - _vconsole_keymap - _vconsole && break -done -_cleanup -# vim: set ts=4 sw=4 et: diff --git a/usr/lib/archboot/login.sh b/usr/lib/archboot/login.sh index 0c1c010f2..ecfcba2ad 100644 --- a/usr/lib/archboot/login.sh +++ b/usr/lib/archboot/login.sh @@ -179,14 +179,11 @@ if [[ -e /usr/bin/setup ]]; then # wait on user interaction! _enter_shell # Basic Setup: - # glibc locale, vconsole, network, clock, pacman + # localization, network, clock, pacman if ! [[ -e /.localize ]]; then localize source /etc/locale.conf fi - if ! [[ -e /.vconsole ]]; then - vconsole - fi if [[ ! -e /.network ]]; then network fi diff --git a/usr/lib/archboot/update/update.sh b/usr/lib/archboot/update/update.sh index b48bd2aa4..f5597aea0 100644 --- a/usr/lib/archboot/update/update.sh +++ b/usr/lib/archboot/update/update.sh @@ -36,7 +36,7 @@ usage () { echo -e "\e[1m-----------------------------------------\e[m" echo -e " \e[1m-help\e[m This message." if [[ ! -e "/var/cache/pacman/pkg/archboot.db" || -e "/usr/bin/setup" ]]; then - echo -e " \e[1m-update\e[m Update scripts: setup, quickinst, clock, vconsole and helpers." + echo -e " \e[1m-update\e[m Update scripts: setup, quickinst, network, clock and helpers." fi # latest image if [[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -gt 2000000 && ! -e "/.full_system" && ! -e "/var/cache/pacman/pkg/archboot.db" ]]; then @@ -103,7 +103,7 @@ _download_latest() { # helper binaries echo -e "\e[1mStep 2/4:\e[m Downloading latest scripts..." # main binaries - BINS="quickinst setup vconsole clock launcher localize network pacsetup update copy-mountpoint rsync-backup restore-usbstick" + BINS="quickinst setup clock launcher localize network pacsetup update copy-mountpoint rsync-backup restore-usbstick" for i in ${BINS}; do [[ -e "${_BIN}/${i}" ]] && wget -q "${_SOURCE}${_BIN}/archboot-${i}.sh?inline=false" -O "${_BIN}/${i}" done @@ -409,10 +409,7 @@ _new_environment() { cp /etc/{locale.gen,locale.conf} "${_C_DIR}"/etc cp /.localize "${_C_DIR}"/ ${_NSPAWN} "${_C_DIR}" /bin/bash -c "locale-gen" &>"${_NO_LOG}" - fi - if [[ -e '/.vconsole' ]]; then cp /etc/vconsole.conf "${_C_DIR}"/etc - cp /.vconsole "${_C_DIR}"/ : >"${_C_DIR}"/.vconsole-run fi if [[ -e '/.clock' ]]; then