diff --git a/pym/install/variables/system.py b/pym/install/variables/system.py index 6c355e1..3b78078 100644 --- a/pym/install/variables/system.py +++ b/pym/install/variables/system.py @@ -23,7 +23,7 @@ from calculate.lib.datavars import (Variable, VariableError, ReadonlyVariable, DataVarsError, VariableInterface) from calculate.install.fs_manager import FileSystemManager from calculate.lib.utils.files import (readFile, getProgPath, process, - readLinesFile) + readLinesFile, readFileEx) from calculate.lib.utils.common import (getPasswdUsers, getUserGroups, getGroups, CmdlineParams) from calculate.lib.utils.common import getValueFromConfig, getValueFromCmdLine @@ -978,6 +978,35 @@ class FlashUncompatible(VariableInterface): return "" +class VariableClInstallUpdatePkgSet(Variable): + """ + При установке системы создать сценарии запуска cl-update в конце + первой загрузки + """ + type = "bool" + opt = ["--update-pkg","-K"] + + def system_has_ip(self): + return bool(self.Get('os_net_ip')) + + def custom_set_has_packages(self): + install_short = self.Get('os_install_linux_shortname') + now_short = self.Get('os_linux_shortname') + setfile = "/etc/portage/sets/custom.{}".format(now_short.lower()) + if readFileEx(setfile, grab=True) and install_short == now_short: + return True + return False + + def get(self): + if self.system_has_ip() and self.custom_set_has_packages(): + return "on" + return "off" + + def init(self): + self.help = _("update packages at first boot") + self.label = _("Update packages at first boot") + + try: import calculate.update.variables.update as update diff --git a/pym/install/wsdl_install.py b/pym/install/wsdl_install.py index 5708589..cf2da08 100644 --- a/pym/install/wsdl_install.py +++ b/pym/install/wsdl_install.py @@ -140,7 +140,8 @@ class Wsdl(WsdlBase): normal=('cl_install_autocheck_set', 'cl_install_autocheck_interval', 'cl_install_cleanpkg_set', - 'cl_install_other_set'))], + 'cl_install_other_set'), + expert=('cl_install_update_pkg_set',))], # действие выводит информацию перед запуском 'brief': {'next': __("Run"), 'image': 'finish',