about summary refs log tree commit diff
path: root/dracut/locale.sh
blob: c56cec0e2bc000d6a4acd7a084948d020a5b8a53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

# Regen locales if it's set in the kernel cmdline.

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh

LOCALE=$(getarg locale.LANG)
[ -z "$LOCALE" ] && LOCALE="en_US.UTF-8"

# Create new user and remove password. We'll use autologin by default.
sed -e "s,^\#\($LOCALE.*\),\1," -i $NEWROOT/etc/default/libc-locales
chroot $NEWROOT xbps-reconfigure -f glibc-locales >/dev/null 2>&1

# also enable this locale in newroot.
echo "LANG=$LOCALE" > $NEWROOT/etc/locale.conf
echo "LC_COLLATE=C" >> $NEWROOT/etc/locale.conf

# set keymap too.
KEYMAP=$(getarg vconsole.keymap)
[ -z "$KEYMAP" ] && KEYMAP="us"
sed -e "s,^KEYMAP=.*,KEYMAP=$KEYMAP," -i $NEWROOT/etc/vconsole.conf