Fix action variables

master3.3
Mike Hiretsky 12 years ago
parent 79a5e5dc0b
commit f008a086bf

@ -196,11 +196,15 @@ class Install(color_print):
dirsFiles = self.clTempl.applyTemplates()
try:
if self.clTempl.getWarning():
self.printWARNING(self.clTempl.getWarning())
if self.clTempl.getError():
self.printERROR(self.clTempl.getError())
return False
except AttributeError:
pass
for file in dirsFiles[1]:
self.printSUCCESS(file)
return dirsFiles
def applyTemplatesFlash(self,directory):

@ -360,6 +360,7 @@ class Wsdl:
dv.importInstall()
dv.flIniFile()
dv.Set('cl_action','merge',True)
dv.Set('cl_live','off')
dv.addGroup(None,
normal=("cl_live",),
expert=('cl_templates_locate',),

@ -17,79 +17,92 @@
import os
import sys
from os import path
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
from calculate.lib.datavars import (Variable,VariableError,ReadonlyVariable,
ActionVariable)
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_install3',sys.modules[__name__])
class VariableAcInstallMerge(ReadonlyVariable):
class VariableAcInstallMergePreinst(ActionVariable):
"""
Action variable which has value "up" by default and not flash installation
Action variable which has value "on"
in ebuild phase preinst or reconfigure system
"""
def get(self):
actionsMap = {'merge':'up',
'system':'up'}
cl_action = self.Get('cl_action')
if cl_action == 'system' and \
self.Get('os_install_root_type') == 'flash':
return ""
if self.Get('cl_live') == "on":
return ""
return actionsMap.get(cl_action,'')
def action(self,cl_action):
if cl_action == "system" or cl_action == "merge" and \
(self.Get('cl_ebuild_phase') == 'preinst' or
self.Get('cl_live') == 'off'):
return "on"
return "off"
class VariableAcInstallMerge(ActionVariable):
"""
Action variable which has value "on"
in configure system, install system hdd, and postinst ebuild phase
only not chroot
"""
nonchroot,postinst = True,True
def action(self,cl_action):
if cl_action in ("system","merge") and \
self.Get('os_install_root_type') != 'flash' and \
self.Get('os_install_pxe') == 'off':
return "on"
return "off"
class VariableAcInstallSystem(ReadonlyVariable):
class VariableAcInstallDisk(ActionVariable):
"""
Action variable which has value "up" for installation on hdd
Action variable which has value "on" for installation on hdd
"""
def get(self):
if self.Get('cl_action') == 'system' and \
def action(self,cl_action):
if cl_action == 'system' and \
self.Get('os_install_root_type') != "flash" and \
self.Get('os_install_pxe') != "on":
return "up"
return "on"
else:
return ""
return "off"
class VariableAcInstallFlash(ReadonlyVariable):
class VariableAcInstallFlash(ActionVariable):
"""
Action variable which has value "up" for USB flash
Action variable which has value "on" for USB flash
"""
def get(self):
clAction = self.Get('cl_action')
if clAction == 'system' \
def action(self,cl_action):
if cl_action == 'system' \
and self.Get('os_install_root_type') == 'flash':
return "up"
return ""
return "on"
return "off"
class VariableAcInstallLive(ReadonlyVariable):
"""
Action which "up" value describe dinamic templates
"""
def get(self):
if self.Get('ac_install_merge') == "up" and \
self.Get('ac_install_pxe') != "up" and \
self.Get('cl_chroot_status') == "off" or \
self.Get('cl_live') == 'on':
return "up"
else:
return ""
value = "off"
class VariableAcInstallPxe(ReadonlyVariable):
class VariableAcInstallPxe(ActionVariable):
"""
Action variable which has value "up" for PXE installation
Action variable which has value "on" for PXE installation
"""
def get(self):
clAction = self.Get('cl_action')
if clAction == 'system' and self.Get('os_install_pxe') == 'on':
return "up"
return ""
def action(self,cl_action):
if cl_action == 'system' and self.Get('os_install_pxe') == 'on':
return "on"
return "off"
class VariableAcInstallConfigure(ReadonlyVariable):
class VariableAcInstallConfigure(ActionVariable):
"""
Action variable which has value "up" for configuration
"""
def get(self):
clAction = self.Get('cl_action')
def action(self,cl_action):
clSetup = self.Get('cl_setup')
if clAction == "merge" and clSetup:
return "up"
return ""
if cl_action == "merge" and clSetup:
return "on"
return "off"
class VariableAcInstallMergePrerm(ActionVariable):
"""
Action variable which has value "up" on prerm ebuild phase
"""
nonchroot = True
def action(self,cl_action):
if cl_action == "merge" and self.Get('cl_ebuild_phase') == 'prerm':
return "on"
return "off"

@ -518,7 +518,7 @@ class VariableClLive(Variable):
"""
Apply live templates
"""
value = "off"
value = "on"
type = "bool"
opt = ['--live']

Loading…
Cancel
Save