summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-11-07 21:10:44 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-11-07 21:10:44 (GMT)
commitc6127b6661439b1c7fa2240a102cd4dcb02ddba8 (patch)
treec317a4bd6b3acaf78f9b119ba90c185e96cc01a5 /abs/core/LinHES-config
parent5ec18757188fa4a0d90f5f6cf0943fd20bd8be34 (diff)
downloadlinhes_pkgbuild-c6127b6661439b1c7fa2240a102cd4dcb02ddba8.zip
linhes_pkgbuild-c6127b6661439b1c7fa2240a102cd4dcb02ddba8.tar.gz
linhes_pkgbuild-c6127b6661439b1c7fa2240a102cd4dcb02ddba8.tar.bz2
LinHES-config: add support for selecting the lang/country during install.
The lang is then translated to a locale which is then applied to the system by mv_locale. The lang->locale lookup is done inside mv_locale with a static dict. refs #738 refs #100 refs #680
Diffstat (limited to 'abs/core/LinHES-config')
-rwxr-xr-xabs/core/LinHES-config/PKGBUILD11
-rwxr-xr-xabs/core/LinHES-config/mv_install.py2
-rw-r--r--abs/core/LinHES-config/mv_locale.py89
-rw-r--r--abs/core/LinHES-config/mythvantage.cfg1
-rwxr-xr-xabs/core/LinHES-config/systemconfig.py9
5 files changed, 105 insertions, 7 deletions
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 092663d..1fcba1b 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-config
pkgver=2.3
-pkgrel=179
+pkgrel=183
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'
@@ -45,6 +45,7 @@ source=(mv_install.py 09_mythvantge_runit_grub
mv_supplemental.py
mv_vnc.py
mv_fileshare.py
+ mv_locale.py
systemconfig.py
myth_user_call.py
mythvantage.cfg
@@ -99,6 +100,7 @@ build() {
install -m 0755 mv_supplemental.py $MVDIR/bin/
install -m 0755 mv_vnc.py $MVDIR/bin/
install -m 0755 mv_fileshare.py $MVDIR/bin/
+ install -m 0755 mv_locale.py $MVDIR/bin/
install -m 0755 systemconfig.py $MVDIR/bin/
install -m 0755 print_xorg_res.py $MVDIR/bin/
install -m 0755 backend_control.sh $MVDIR/bin/
@@ -125,7 +127,7 @@ build() {
install -o root -g root -D -m 0755 blacklist_pcspkr.conf $startdir/pkg/etc/modprobe.d/blacklist_pcspkr.conf
install -o root -g root -D -m 0755 blacklist_nouveau.conf $startdir/pkg/etc/modprobe.d/blacklist_nouveau.conf
}
-md5sums=('6a9a22b3c3cb74d9f1ac595cf437a7b7'
+md5sums=('ecd120a453dd185fc2b345086bfd62f5'
'f33e1a6f7985091b8d47cbaf7433f90f'
'17677b9e25b8fe3511ad3a139ed91eea'
'2596460462cf6c889cf8f95485537b20'
@@ -161,9 +163,10 @@ md5sums=('6a9a22b3c3cb74d9f1ac595cf437a7b7'
'b4900090d841d3e390cb840cf16afd85'
'f2a19e3e864984ec95ac5ea090cbfa69'
'c9c9390ac12145169dfe9a76896db328'
- 'f48b04d714c93146d8711531c266800a'
+ '882830885b852af5a9a5c6df017504e0'
+ 'c2ef0f1140bd3fbeb44294fdf5415a32'
'2596460462cf6c889cf8f95485537b20'
- '4cba2bb55c6b8e27c57a6171f42d0455'
+ 'dc3c5270691a62600475705f4cb78b56'
'4804aa93aaad3dfcfff08cd9ffd68836'
'0fa6fffd87f350380d45f1f8a5b7babe'
'6ec39b010c0ed8901ea896c7e153d330'
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index 522fc23..877ca67 100755
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -1209,7 +1209,7 @@ def genlocale():
outline = line.replace('#','')
f.write(outline)
- f.close
+ 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)
diff --git a/abs/core/LinHES-config/mv_locale.py b/abs/core/LinHES-config/mv_locale.py
new file mode 100644
index 0000000..e1bc59c
--- /dev/null
+++ b/abs/core/LinHES-config/mv_locale.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os, re
+config_file = "mv_config"
+
+lan_map = {'bg':'bg_BG',
+ 'cs':'cs_CZ',
+ 'da':'da_DK',
+ 'de':'de_DE',
+ 'el':'el_GR',
+ 'en_ca':'en_CA',
+ 'en_gb':'en_US',
+ 'en_GB':'en_US',
+ 'en_us':'en_US',
+ 'es_es':'es_ES',
+ 'es':'es_ES',
+ 'et':'et_EE',
+ 'fi':'fi_FI',
+ 'fr':'fr_FR',
+ 'he':'he_IL',
+ 'hr':'hr_HR',
+ 'hu':'hu_HU',
+ 'it':'it_IT',
+ 'ja':'ja_JP',
+ 'nb':'nb_NO',
+ 'nl':'nl_NL',
+ 'pl':'pl_PL',
+ 'pt_br':'pt_BR',
+ 'pt':'pt_PT',
+ 'ru':'ru_RU',
+ 'sv':'sv_SE',
+ 'zh_cn':'zh_CN',
+ 'zh_hk':'zh_HK' }
+
+
+def genlocale(locale_list):
+ logging.info(" Generating locales")
+ localefile="/etc/locale.gen"
+ 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()
+ cmd = "/usr/sbin/locale-gen"
+ mv_common.runcmd(cmd)
+
+
+def update_locale_conf(locale):
+ logging.info(" Updating /etc/locale.conf")
+ line='''LOCALE="%s"''' %locale
+ try:
+ f = open('/etc/locale.conf',"w")
+ f.write(line)
+ f.write("\n")
+ f.close()
+ except:
+ logging.debug("* couldn't update /etc/locale.conf")
+
+
+def setup_locale(systemconfig):
+ logging.info("____Start of locale/lang config ____")
+
+ if mv_common.read_config(mv_common.module_config,"lang") == False :
+ logging.info("____Skipping of lang, config disabled____")
+ return
+
+ try:
+ language = systemconfig.get("language")
+ except:
+ language = "en_us"
+
+ try:
+ locale = lan_map[language]+".UTF-8"
+ except:
+ locale = "en_US.UTF-8"
+ logging.info(" locale is: %s" %locale)
+
+ genlocale([locale])
+ update_locale_conf(locale)
+
diff --git a/abs/core/LinHES-config/mythvantage.cfg b/abs/core/LinHES-config/mythvantage.cfg
index 8897724..1147d9f 100644
--- a/abs/core/LinHES-config/mythvantage.cfg
+++ b/abs/core/LinHES-config/mythvantage.cfg
@@ -20,4 +20,5 @@ software = True
smolt = True
vnc = True
fileshare = True
+language = True
diff --git a/abs/core/LinHES-config/systemconfig.py b/abs/core/LinHES-config/systemconfig.py
index baaab4f..d9c83b7 100755
--- a/abs/core/LinHES-config/systemconfig.py
+++ b/abs/core/LinHES-config/systemconfig.py
@@ -153,7 +153,8 @@ def main(argv):
"all":False, "dhcp_request":False ,
"func":False, "supplemental":False,
"vnc":False, "fileshare":False,
- "config_xml":False }
+ "config_xml":False,
+ "locale":False }
try:
opts, args = getopt.getopt(argv, 'c:hm:d:', ["help","modules" ] )
except getopt.GetoptError, why:
@@ -205,6 +206,8 @@ def main(argv):
cmdmodule["vnc"] = True
cmdmodule["fileshare"] = True
cmdmodule["config_xml"] = True
+ cmdmodule["locale"] = True
+
##putting this here until I can create the seperate share module
#if cmdmodule["fileshare"]:
@@ -373,7 +376,9 @@ def main(argv):
import mv_fileshare
mv_fileshare.setup_fileshare(systemconfig, data_config)
-
+ if cmdmodule["locale"]:
+ import mv_locale
+ mv_locale.setup_locale(systemconfig)
if __name__ == "__main__":