From 97e474609dc2d182a1634ef19004c02b4700533e Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Mon, 13 Sep 2010 16:23:30 +0000 Subject: [PATCH] Add variable cl_install_autoupdate_set. --- pym/cl_fill_install.py | 11 +++++++++++ pym/cl_install.py | 10 ++-------- pym/cl_install_cmd.py | 27 +++++++-------------------- pym/cl_vars_install.py | 5 ++++- scripts/cl-install | 4 +--- 5 files changed, 25 insertions(+), 32 deletions(-) diff --git a/pym/cl_fill_install.py b/pym/cl_fill_install.py index 59b8e41..e11269b 100644 --- a/pym/cl_fill_install.py +++ b/pym/cl_fill_install.py @@ -1033,6 +1033,8 @@ class fillVars(object, glob_attr): def getFieldByField(self,resField,field,value, firstPrefix="os_disk", secondPrefix="os_disk"): + """Get value of field specified by 'firstPrefix_resField', + by field specified by 'secondPrefix_resField==value'""" res = filter(lambda x: x[1] == value, zip(self.clVars.Get('%s_%s'%(firstPrefix,resField)), self.clVars.Get('%s_%s'%(secondPrefix,field)))) or\ @@ -1052,3 +1054,12 @@ class fillVars(object, glob_attr): return self.Get('os_device_dev')[0] else: return "" + + def get_cl_install_autoupdate_set(self): + if self.Get('cl_install_system_action') == "up": + if self.Get('os_install_linux_system') == 'desktop': + return "on" + else: + return "off" + else: + return self.Get('cl_autoupdate_set') diff --git a/pym/cl_install.py b/pym/cl_install.py index f0adf92..e841600 100644 --- a/pym/cl_install.py +++ b/pym/cl_install.py @@ -1163,19 +1163,12 @@ class cl_install(color_print): disk['systemId'] = None return True - def setAutoUpdate(self): - if self.clVars.Get('os_install_linux_system') == 'desktop': - self.clVars.Set('cl_autoupdate_set','on',force=True) - else: - self.clVars.Set('cl_autoupdate_set','off',force=True) - return True - def setInstallOptions(self, listDisks, listBinds, listSwaps, listUsers, mbrDisk): """Set install options (set users, disks and mbr""" if self.setUsers(listUsers) and \ self.setDisks(listDisks,listBinds,listSwaps) and \ - self.setMBR(mbrDisk) and self.setAutoUpdate(): + self.setMBR(mbrDisk): return self.createListOptions() else: return False @@ -1422,6 +1415,7 @@ class cl_install(color_print): self.startMessage = "" def setupOpenGL(self): + """Setup opengl for current video driver""" defaultGL = "xorg-x11" pathGlModules = path.join(self.clVars.Get('cl_chroot_path'), 'usr/lib/opengl') diff --git a/pym/cl_install_cmd.py b/pym/cl_install_cmd.py index 4631b43..69a8b8c 100644 --- a/pym/cl_install_cmd.py +++ b/pym/cl_install_cmd.py @@ -112,7 +112,8 @@ class install_cmd(share_cmd): check_values=self.checkOpts) self.logicObj = cl_install() # names incompatible options with --live - self.optionsLiveIncompatible = ["d", "b", "mbr", "w", "f", "s"] + self.optionsLiveIncompatible = ["type","d", "b", "mbr", + "w", "f", "s","install","uninstall","build","u"] def _getNamesAllSetOptions(self): """Get list set options""" @@ -246,13 +247,14 @@ class install_cmd(share_cmd): return False return True + def setAction(self,live): + """Set action by configuration or install system""" + self.logicObj.clVars.Set('cl_action', + "merge" if live else "system",True) + def checkAndSetInstallOptions(self,diskOptions, swapOptions, bindOptions, usersOptions): """Check and set disk, swap and bind cmd options""" - if self.optobj.values.live: - self.logicObj.clVars.Set('cl_action','merge',True) - else: - self.logicObj.clVars.Set('cl_action','system',True) if self.optobj.values.s: self.logicObj.setLinuxName(self.optobj.values.s.upper()) if self.optobj.values.build: @@ -380,18 +382,3 @@ class install_cmd(share_cmd): return True else: return False - - def setAutoupdate(self, optObj): - """Установка переменных""" - if optObj.set: - for vals in optObj.set: - for val in vals.split(','): - k,o,v = val.partition('=') - if k == "cl_autoupdate_set": - if self.logicObj.clVars.exists(k): - if not self.logicObj.clVars.SetWriteVar(k,v): - return False - else: - self.printERROR(_('variable %s not found')%k) - return False - return True diff --git a/pym/cl_vars_install.py b/pym/cl_vars_install.py index 924bd6c..92ffb67 100644 --- a/pym/cl_vars_install.py +++ b/pym/cl_vars_install.py @@ -299,4 +299,7 @@ class Data: os_scratch = {} # (on or off) autoupdate config from install program - cl_autoupdate_set = {'mode':'w','value': "off"} + cl_autoupdate_set = {'value': "off"} + + # (on or off) autoupdate config from install program for install + cl_install_autoupdate_set = {'mode':'w','value': "off"} diff --git a/scripts/cl-install b/scripts/cl-install index bfb76d5..fa55fc1 100644 --- a/scripts/cl-install +++ b/scripts/cl-install @@ -47,13 +47,11 @@ if __name__ == "__main__": if not install.setVars(options): sys.exit(1) # check and set installed options + install.setAction(options.live) if not options.live: if not install.checkAndSetInstallOptions(options.d,options.w,options.b, options.u): sys.exit(1) - # refresh autoupdate - if not install.setAutoupdate(options): - sys.exit(1) # print variables if options.v or options.filter or options.xml: install.printVars(options)