29 lines
666 B
Plaintext
29 lines
666 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
|
|
[ -z "$LOCALE" ] && LOCALE="en_US"
|
|
|
|
# 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
|
|
einfo "Setting system locale [$LOCALE] [UTF-8]"
|
|
echo "export LANG=$LOCALE.UTF-8" >> /etc/profile.d/locale.sh
|
|
}
|