[PATCH v2] dracut: 10i18n: add support for custom locale definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Andrei.

Thanks very for much for reviewing the patch...

On Sat, 16/04/2016 at 09.00 +0300, Andrei Borzenkov wrote:
> 16.04.2016 01:07, Guido Trentalancia пишет:
> > Compile and install locale definitions using localedef from GNU
> > libc. The
> > resulting locale definitions archive contains at most two different
> > locale
> > definitions, therefore its size is relatively small.
> > 
> 
> On many distributions sources for locale definitions are in separate
> packages that are not installed by default. You need at least error
> checks and some alternative way to gather the same information.

Good point, I have now included a check to make sure that the localedef
executable is available on the system (please see the new patch version
reported below)...

I don't know exactly what you mean by "some alternative way to gather
the same information", however if you mean copying the locale archive
from the one installed on the system, I am against that, as it is
usually very large, while the one we generate here is rather small and
should be usually compatible with the initram filesystem size
constraint.

/usr/lib/locale-archive (system-wide): 101,997,312 bytes
average locale-archive generated ad-hoc by localedef for initramfs:
1,629,568

... there is a size factor of about 63 !
---
Compile and install locale definitions using localedef from GNU libc. The
resulting locale definitions archive contains at most two different locale
definitions, therefore its size is relatively small.

Signed-off-by: Guido Trentalancia <guido@xxxxxxxxxxxxxxxx>
---
 modules.d/10i18n/module-setup.sh |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- dracut-git/modules.d/10i18n/module-setup.sh	2016-04-12 15:59:43.174765608 +0200
+++ dracut-044-10i18n-add-support-for-custom-locale-definitions/modules.d/10i18n/module-setup.sh	2016-04-16 15:59:51.254099707 +0200
@@ -212,6 +219,16 @@ install() {
             print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
         fi
 
+        [[ $LC_ALL || $LANG ]] && inst_dir /usr/lib/locale
+
+        # Generate locale definitions for LC_ALL
+        [ $LC_ALL ] && LC_ALL_LOCALE=`echo $LC_ALL | awk -F. '{ print $1 }'` && LC_ALL_CHARMAP=`echo $LC_ALL | awk -F. '{ print $2 }'`
+        [[ $LC_ALL && $LC_ALL_LOCALE && $LC_ALL_CHARMAP ]] && command -v localedef > /dev/null && localedef --prefix="${initdir}" -i $LC_ALL_LOCALE -f $LC_ALL_CHARMAP $LC_ALL
+
+        # Generate locale definitions for LANG
+        [ $LANG ] && LANG_LOCALE=`echo $LANG | awk -F. '{ print $1 }'` && LANG_CHARMAP=`echo $LANG | awk -F. '{ print $2 }'`
+        [[ $LANG && $LANG_LOCALE && $LANG_CHARMAP ]] && command -v localedef > /dev/null && localedef --prefix="${initdir}" -i $LANG_LOCALE -f $LANG_CHARMAP $LANG
+
         if dracut_module_included "systemd" && [[ -f ${VCONFIG_CONF} ]]; then
             inst_simple ${VCONFIG_CONF}
         else


--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux