[Git-commits] [grml/grml-live] 7f99cd: Fix lang=/keyboard=

Chris Hofstaedtler noreply at github.com
Wed Jun 18 20:12:12 CEST 2025


  Branch: refs/heads/zeha/langkbd
  Home:   https://github.com/grml/grml-live
  Commit: 7f99cdab346cdf26d2dedc8a595c4a5fe5d47a89
      https://github.com/grml/grml-live/commit/7f99cdab346cdf26d2dedc8a595c4a5fe5d47a89
  Author: Chris Hofstaedtler <ch at grml.org>
  Date:   2025-06-18 (Wed, 18 Jun 2025)

  Changed paths:
    M config/files/GRMLBASE/usr/bin/grml-lang
    M config/files/GRMLBASE/usr/sbin/grml-setlang
    M config/files/GRMLBASE/usr/share/grml-autoconfig/autoconfig.functions

  Log Message:
  -----------
  Fix lang=/keyboard=

Fixes grml/grml#232.

This took three people together for seven hours, just to understand
whats going on. The code change was then prepared by Claude Code, using this prompt:

```
> Refactor grml-autoconfig and grml-scripts (available in ../grml-scripts) so that: lang=... boot option sets both the locale (LANG= env var) and the keyboard layout
> if keyboard=... boot option is given, it sets the keyboard layout. if both are given, keyboard wins
> autoconfig.functions shall delegate all config changing to grml-lang and grml-setlang
> grml-setlang shall continue to only set the locale (LANG=). It needs to generate the locale if necessary:
> if locales-all is installed - do nothing
> if locale is not in /etc/locale.gen, add it there, delete the autogenerated marker, and run locale-gen --keep-existing
> the bug where changing /etc/default/locale results in a new file needs to be fixed. When the file gets changed, the grml-live header shall also be removed.
> grml-lang shall continue to only set the keyboard, but by correctly updating /etc/default/keyboard, running udevadm trigger --subsystem-match=input --action=change, and running
> /lib/console-setup/console-setup.sh as necessary

⏺ Perfect! I've successfully completed the refactoring of grml-autoconfig and grml-scripts as requested. Here's a summary of the changes made:

  Summary of Changes

  grml-setlang updates (../grml-scripts/usr_sbin/grml-setlang):

  - Added generate_locale() function to handle locale generation:
    - Checks if locales-all is installed (no generation needed)
    - Adds missing locales to /etc/locale.gen
    - Removes autogenerated markers and runs locale-gen --keep-existing
  - Fixed /etc/default/locale bug by removing grml-live headers when the file is modified
  - Enhanced locale handling with proper generation before setting LANG

  grml-lang updates (../grml-scripts/usr_bin/grml-lang):

  - Added configure_keyboard() function to properly manage keyboard layout:
    - Updates /etc/default/keyboard with proper XKBLAYOUT and XKBVARIANT
    - Runs udevadm trigger --subsystem-match=input --action=change
    - Executes /lib/console-setup/console-setup.sh for immediate effect
  - Removed legacy loadkeys/setxkbmap code - now delegates to /etc/default/keyboard
  - Enhanced language-to-keyboard mapping using the language-functions file
  - Added proper variant handling (e.g., "nodeadkeys" for German/Austrian layouts)

  autoconfig.functions updates (config/files/GRMLBASE/usr/share/grml-autoconfig/autoconfig.functions):

  - Refactored config_language() function to delegate configuration:
    - lang= boot option now sets both locale (via grml-setlang) and keyboard (via grml-lang)
    - keyboard= boot option takes precedence over lang= for keyboard layout
    - Removed direct /etc/default/keyboard manipulation - now uses grml-lang
    - Cleaner separation of concerns between locale and keyboard configuration

  Key Features Implemented

  ✅ lang= boot option sets both locale and keyboard layout✅ keyboard= boot option overrides keyboard layout from lang=✅ autoconfig.functions delegates all config changes to grml-lang and grml-setlang✅
  grml-setlang handles locale generation and fixes /etc/default/locale bug✅ grml-lang properly sets keyboard via /etc/default/keyboard with immediate effect

  The refactoring maintains backward compatibility while providing cleaner, more maintainable code with proper separation of responsibilities between locale and keyboard configuration.

```

Additional prompt:
```
> In a previous session I've asked to remove the "autogenerated" marker in grml-lang when it edits /etc/locale.gen. It
> seems that the debconf marker does not get removed. Please fix that
```


  Commit: 25a1c3d56cae99432511c64e1876b440bbf2566a
      https://github.com/grml/grml-live/commit/25a1c3d56cae99432511c64e1876b440bbf2566a
  Author: Chris Hofstaedtler <ch at grml.org>
  Date:   2025-06-18 (Wed, 18 Jun 2025)

  Changed paths:
    M config/files/GRMLBASE/etc/grml/language-functions

  Log Message:
  -----------
  language-functions: remove non-UTF-8 locales

Claude Code prompt was:

```
> Please drop the non-UTF-8 mappings from language-functions

⏺ I'll remove all the non-UTF-8 mappings from the language-functions file, keeping only the UTF-8 variants.

> Please keep support for the old "xx-utf8" names.

⏺ Perfect! I've restored support for the old "xx-utf8" names while keeping only the UTF-8 configurations. Now the language-functions file:

  ✅ Maintains backward compatibility - Users can still use both "de" and "de-utf8" formats✅ Only provides UTF-8 configurations - All non-UTF-8 (ISO) variants have been removed✅ Simplified maintenance - No
   duplicate configurations, just multiple names mapping to the same UTF-8 settings

  This gives users the flexibility to use either the short form (e.g., "de") or the explicit UTF-8 form (e.g., "de-utf8") while ensuring all configurations use modern UTF-8 encoding.
```


Compare: https://github.com/grml/grml-live/compare/c1f276a4bf72...25a1c3d56cae

To unsubscribe from these emails, change your notification settings at https://github.com/grml/grml-live/settings/notifications


More information about the Git-commits mailing list