Re: [PATCH] dracut: setup English locales for Dracut build script

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

 



On 06/18/2010 01:38 PM, Amadeusz Żołnowski wrote:
Dracut rely upon programs' output like ldd's "not a dynamic executable".
Assume user sets up Polish locales and then ldd prints
"nie jest dynamicznym programem wykonywalnym".  The patch prevents this.
---
  dracut |   15 +++++++++++++++
  1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/dracut b/dracut
index 3be4989..1437625 100755
--- a/dracut
+++ b/dracut
@@ -71,6 +71,17 @@ Creates initial ramdisk images for preloading modules
  "
  }

+# Change locales and language leaving existing suffix (.utf8 or similar).
+# $1 = language (e.g. en_US)
+change_locales() {
+    local lang=(${LANG/./ })
+    lang[0]=$1
+    lang=${lang[@]}
+    LANG=${lang/ /.}
+    LC_ALL=${LANG}
+    export LANG LC_ALL
+}
+
  while (($#>  0)); do
      case $1 in
  	-f|--force) force=yes;;
@@ -107,6 +118,10 @@ done

  PATH=/sbin:/bin:/usr/sbin:/usr/bin
  export PATH
+# We rely upon programs' output like ldd's "not found", so we have to
+# set up English locales.
+change_locales en_US
+

  [[ $debug ]]&&  {
      export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';

Hmm, we probably should prefix every call to an app, where we parse the output with LANG=C like this:

LANG=C ldd $file | grep -q "not found"
--
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