From 8af79359c21b5f07981975c34a7d51ab063b249d Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Fri, 2 Sep 2011 14:06:59 -0500
Subject: LinHes-config: during the install copy over the locale archive file. 
 Generating locales during install takes to long, so the locales are generated
 during the creation of the iso refs #782 closes #782

---
 abs/core/LinHES-config/PKGBUILD      |  4 ++--
 abs/core/LinHES-config/mv_install.py | 31 ++++++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index f8d1eaa..96771e2 100644
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=8
+pkgrel=9
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
 pkgdesc="Install and configure your system"
 depends=('bc' 'libstatgrab'  'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
@@ -101,7 +101,7 @@ build() {
     install -m 0755 issue $startdir/pkg/etc/issue
 
 }
-md5sums=('81872a7465943266e1bad177b0873b0a'
+md5sums=('6259677916192a92d1adf47b276f7829'
          '16b98fcb3753ef6cfc35075c326d30e4'
          'e36da536dd651ef182e7642337889e77'
          '985891a43f7c4c983eb2a362162f1a0f'
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index e89602b..cc4e4a6 100755
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -37,7 +37,6 @@ def update_db(value, data):
     except  MySQLdb.Error,  e:
         logging.debug("Unable to update database with %s, %s", data, value)
 
-
 def progress(pgnum):
     progressline = str(pgnum) + "% complete"
     logging.debug("Progress: %s",  pgnum)
@@ -497,6 +496,8 @@ def copy_it(install_type):
             os.makedirs(mp)
         except OSError:
             logging.debug("     __Could not create %s", mp)
+    #copy of locale
+    cp_and_log("/usr/lib/locale/locale-archive", data_config.MOUNTPOINT+"/usr/lib/locale/locale-archive")
 #   General fixup
     cmd = "chmod 777 %s/tmp" %(data_config.MOUNTPOINT)
     runcmd(cmd)
@@ -727,6 +728,32 @@ def grub_it():
     except:
         logging.debug("Couldn't open grub file")
 
+def genlocale():
+    return
+    logging.info("Generating locales")
+    locale_list=[ "en_US ISO-8859-1", "en_US.UTF-8 UTF-8" , "de_DE.UTF-8", "da_DK.utf8", "en_DK.utf8", "it_IT.utf8", "de_DE.UTF-8"]
+    #locale_list=['UTF-8', 'en_US ISO-8859-1']
+
+    localefile="%s/etc/locale.gen" %data_config.MOUNTPOINT
+    f = open(localefile)
+    lines = f.readlines()
+    f.close()
+
+    f = open(localefile,'w')
+
+    for line in lines:
+        outline = line
+        for locale in locale_list:
+            #print locale, line
+            if locale in line:
+                outline = line.replace('#','')
+        f.write(outline)
+
+    f.close
+    #cp_and_log("/tmp/locale.gen.new", data_config.MOUNTPOINT+"/etc/locale.gen")
+    cmd = "chroot " + data_config.MOUNTPOINT +" /usr/sbin/locale-gen"
+    runcmd(cmd)
+
 def fix_permissions():
     logging.info("Fixing permissions")
     SE = os.environ["TEMPLATES"]+"/settings/syssettings"
@@ -1009,6 +1036,7 @@ def full_install(hostoptions):
     update_status(msg)
     progress(98)
     grub_it()
+    genlocale()
     special_hardware_check()
 #   Configuring the system
     logging.info("______Configuring system________")
@@ -1274,6 +1302,7 @@ def upgrade(hostoptions):
     fstab_it("upgrade")
     time.sleep(1)
     grub_it()
+    genlocale()
     time.sleep(1)
     #needed to get around a bug with pacman
     special_hardware_check()
-- 
cgit v0.12