diff --git a/templates/OpenRC/files/locale.rc b/templates/OpenRC/files/locale.rc new file mode 100644 index 0000000000..abf7eed433 --- /dev/null +++ b/templates/OpenRC/files/locale.rc @@ -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 +} diff --git a/templates/OpenRC/template b/templates/OpenRC/template index 91c5c180e0..2acfe4f195 100644 --- a/templates/OpenRC/template +++ b/templates/OpenRC/template @@ -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" \ diff --git a/templates/OpenRC/xbps-locale-service.diff b/templates/OpenRC/xbps-locale-service.diff new file mode 100644 index 0000000000..942c98e5dd --- /dev/null +++ b/templates/OpenRC/xbps-locale-service.diff @@ -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: