void-packages/templates/OpenRC/files/locale.rc

29 lines
666 B
Plaintext
Raw Normal View History

#!/sbin/runscript
description="Sets a system locale"
depend()
{
need localmount termencoding
after bootmisc
keyword noopenvz noprefix nouml novserver noxenu
}
start()
{
: >/etc/profile.d/locale.sh
chmod 755 /etc/profile.d/locale.sh
# Check if requested locale was already created
if ! $(locale -a|grep -q $LOCALE.utf8); then
[ ! -d /usr/lib/locale ] && mkdir -p /usr/lib/locale
ebegin "Building locale [$LOCALE] [UTF-8]"
localedef -i $LOCALE -f UTF-8 $LOCALE
eend $?
fi
# Set user defined locale
[ -z "$LOCALE" ] && LOCALE="en_US"
einfo "Setting system locale [$LOCALE] [UTF-8]"
echo "export LANG=$LOCALE.UTF-8" >> /etc/profile.d/locale.sh
}