29 lines
660 B
Plaintext
29 lines
660 B
Plaintext
|
#!/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" >> /etc/profile.d/locale.sh
|
||
|
}
|