Browse Source

fedora, debian: make sure that default locale is generated

Otherwise some GUI applications would not start.
Marek Marczykowski-Górecki 9 years ago
parent
commit
b368ffe5c6
2 changed files with 18 additions and 1 deletions
  1. 9 0
      debian/qubes-core-agent.postinst
  2. 9 1
      rpm_spec/core-vm.spec

+ 9 - 0
debian/qubes-core-agent.postinst

@@ -182,6 +182,15 @@ case "${1}" in
         fi
         /usr/lib/qubes/qubes-fix-nm-conf.sh
 
+        # make sure locale is really generated
+        current_locale=`grep 'LANG\|LC_ALL' /etc/default/locale|head -n 1|cut -f 2 -d =`
+        if [ -n "$current_locale" ] && ! locale -a | grep -q "$current_locale"; then
+            base=`echo "$current_locale" | cut -f 1 -d .`
+            charmap=`echo "$current_locale.UTF-8" | cut -f 2 -d .`
+            [ -n "$charmap" ] && charmap="-f $charmap"
+            localedef -i $base $charmap $current_locale
+        fi
+
         # Remove old firmware updates link
         if [ -L /lib/firmware/updates ]; then
             rm -f /lib/firmware/updates

+ 9 - 1
rpm_spec/core-vm.spec

@@ -281,7 +281,15 @@ fi
 # Make sure there is a default locale set so gnome-terminal will start
 if [ ! -e /etc/locale.conf ] || ! grep -q LANG /etc/locale.conf; then
     touch /etc/locale.conf
-    echo "LANG=en_US.utf8" >> /etc/locale.conf
+    echo "LANG=en_US.UTF-8" >> /etc/locale.conf
+fi
+# ... and make sure it is really generated
+current_locale=`grep LANG /etc/locale.conf|cut -f 2 -d =`
+if [ -n "$current_locale" ] && ! locale -a | grep -q "$current_locale"; then
+    base=`echo "$current_locale" | cut -f 1 -d .`
+    charmap=`echo "$current_locale.UTF-8" | cut -f 2 -d .`
+    [ -n "$charmap" ] && charmap="-f $charmap"
+    localedef -i $base $charmap $current_locale
 fi
 %endif