OpenRC: add a locale service to set system locale.

--HG--
extra : convert_revision : c218ac3f09ddf1be616bf208d4438364a5eaef73
This commit is contained in:
Juan RP 2009-05-07 16:09:01 +00:00
parent ed579c9c86
commit 38567c4b37
3 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,28 @@
#!/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
}

View file

@ -2,6 +2,7 @@
pkgname=OpenRC
version=20090507
wrksrc=openrc
patch_files="xbps-locale-service.diff"
distfiles="http://ftp.gnu.org/gnu/openrc/openrc-$version.tar.bz2"
build_style=gnu_makefile
short_desc="Universal init system"
@ -27,6 +28,9 @@ Add_dependency full sysvinit
pre_configure()
{
# Install the "locale" service
cp ${FILESDIR}/locale.rc ${wrksrc}/init.d/locale.in
# Fix path for kbd stuff.
for f in init.d/consolefont.in conf.d/consolefont; do
sed -i -e "s|/usr/share/consolefonts|/lib/kbd/consolefonts|g" \

View file

@ -0,0 +1,21 @@
Installs a "locale" service into the "boot" runlevel, to set
a the system locale.
--- runlevels/Makefile.Linux.orig 2009-05-07 15:48:37.075825332 +0000
+++ runlevels/Makefile.Linux 2009-05-07 15:48:52.008557039 +0000
@@ -1,3 +1,3 @@
SYSINIT+= devfs dmesg
-BOOT+= hwclock keymaps modules mtab procfs termencoding
+BOOT+= hwclock keymaps modules mtab procfs termencoding locale
SHUTDOWN+= killprocs mount-ro
--- init.d/Makefile.Linux.orig 2009-05-07 15:55:26.156910483 +0000
+++ init.d/Makefile.Linux 2009-05-07 15:55:35.682853819 +0000
@@ -2,7 +2,7 @@ NET_LO= net.lo
SRCS+= devfs.in dmesg.in hwclock.in consolefont.in keymaps.in killprocs.in \
modules.in mount-ro.in mtab.in numlock.in procfs.in sysfs.in \
- termencoding.in
+ termencoding.in locale.in
.SUFFIXES: .Linux.in
.Linux.in: