Add two options -l --timezone for images.

master
Mike Hiretsky 13 years ago
parent abdce588f9
commit 5c4016dbc7

@ -817,3 +817,20 @@ class cl_builder(color_print):
self.clVars.Set('cl_builder_live_set',"on",True)
else:
self.clVars.Set('cl_builder_live_set',"off",True)
def setTimezone(self,timezone):
"""Set timezone"""
if not path.exists(path.join("/usr/share/zoneinfo",timezone)) or \
timezone.startswith('/usr/share/zoneinfo'):
self.printERROR(_("%s timezone is wrong")%timezone)
return False
else:
self.clVars.Set('os_builder_clock_timezone',timezone,force=True)
return True
def setAllLocaleByLang(self,lang):
"""Set all locale variable by specified lang"""
if not lang in self.clVars.Get('os_lang'):
return False
self.clVars.Set('os_builder_locale_lang',lang, True)
return True

@ -17,7 +17,7 @@
from cl_builder import cl_builder, __app__, __version__
from cl_opt import opt
from cl_share_cmd import share_cmd
from cl_vars_share import varsShare
from cl_vars_share import varsShare,clLocale
from cl_utils import _toUNICODE, getSquashList
import os
from os import path
@ -64,6 +64,15 @@ CMD_OPTIONS = [{'shortOption':"p",
{'longOption':'noisohybrid',
'help':_("create the iso image without isohybrid")
},
{'longOption':'lang',
'shortOption':'l',
'optVal':"LANG",
'help':_("language by default")
},
{'longOption':'timezone',
'optVal':"TIMEZONE",
'help':_("timezone by default")
},
{'longOption':"set"},
{'shortOption':"f",
'longOption':"force",
@ -169,6 +178,8 @@ class image_cmd(share_cmd):
if args and args[0] == "squash":
self.logicObj.clVars.Set('cl_builder_iso_path','/mnt/flash',True)
self.logicObj.setTimezone(values.timezone)
self.logicObj.setLang(values.l)
self.optobj.checkVarSyntax(values)
return (values, args)

@ -154,6 +154,10 @@ class Data:
cl_builder_image_path = {}
cl_builder_live_set = {'value':'off'}
os_builder_locale_lang = {'mode':'w','value':''}
os_builder_clock_timezone = {'mode':'w','value':''}
# lib vars
cl_chroot_path = {}
cl_env_path = {}

Loading…
Cancel
Save