2009-05-07 16:09:01 +00:00
|
|
|
#!/sbin/runscript
|
|
|
|
|
2009-10-10 06:39:39 +00:00
|
|
|
: ${system_locale:=en_US}
|
2009-05-07 16:09:01 +00:00
|
|
|
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
|
2009-10-10 06:39:39 +00:00
|
|
|
if ! $(locale -a|grep -q "${system_locale}.utf8"); then
|
2009-05-07 16:09:01 +00:00
|
|
|
[ ! -d /usr/lib/locale ] && mkdir -p /usr/lib/locale
|
2009-10-10 06:39:39 +00:00
|
|
|
ebegin "Building locale [${system_locale}] [UTF-8]"
|
|
|
|
localedef -i ${system_locale} -f UTF-8 ${system_locale}
|
2009-05-07 16:09:01 +00:00
|
|
|
eend $?
|
|
|
|
fi
|
|
|
|
# Set user defined locale
|
2009-10-10 06:39:39 +00:00
|
|
|
einfo "Setting system locale [${system_locale}] [UTF-8]"
|
|
|
|
echo "export LANG=${system_locale}.UTF-8" >> /etc/profile.d/locale.sh
|
2009-05-07 16:09:01 +00:00
|
|
|
}
|