diff --git a/pym/install/install.py b/pym/install/install.py index ef952b8..c6b3497 100644 --- a/pym/install/install.py +++ b/pym/install/install.py @@ -21,6 +21,8 @@ import time from os import path from random import choice import string +import glob +import shutil from time import sleep from calculate.core.server.func import MethodsInterface from calculate.lib.utils.files import (pathJoin, @@ -543,3 +545,14 @@ class Install(MethodsInterface): """ distr.close() return True + + def drop_xorg_logs(self): + """ + Сбросить логи загрузки xorg сервера + """ + for fn in glob.glob("/var/log/Xorg.*.log"): + new_name = "%s.old" % fn + if path.exists(new_name): + os.unlink(new_name) + shutil.move(fn, new_name) + return True diff --git a/pym/install/utils/cl_setup.py b/pym/install/utils/cl_setup.py index 9b47d32..2e2b9e4 100644 --- a/pym/install/utils/cl_setup.py +++ b/pym/install/utils/cl_setup.py @@ -42,8 +42,17 @@ class ClSetupVideoAction(Action): failedMessage = __("Failed to configure the video settings!") interruptMessage = __("Configuration manually interrupted") - addon_tasks = [ + prev_tasks = [ # проверить и настроить параметры для nvidia драйвера + {'name': 'drop_xorg_log', + 'method': 'Install.drop_xorg_logs()', + 'condition': lambda Get: ( + Get('os_install_x11_video_drv_prev') + != Get('os_install_x11_video_drv')) + }, + ] + + addon_tasks = [ {'name': 'check_video', 'message': __("Checking the video driver"), 'method': 'Install.checkVideoDriver()', @@ -81,7 +90,7 @@ class ClSetupVideoAction(Action): def __init__(self): # список задач для действия - self.tasks = [ + self.tasks = self.prev_tasks + [ {'name': 'apply_templates', 'message': self.templateTaskMessage, # наложить шаблоны на текущий дистрибутив, включая clt шаблоны @@ -98,6 +107,7 @@ class ClSetupSystemAction(ClSetupVideoAction): """ Объект настройки всех параметров системы """ + prev_tasks = [] templateTaskMessage = __("The system is being configured") successMessage = __("System configured!") failedMessage = __("Failed to configure the system!") @@ -108,6 +118,7 @@ class ClSetupAudioAction(ClSetupSystemAction): Действие для настройки аудио параметров """ addon_tasks = [] + prev_tasks = [] templateTaskMessage = __("The audio settings are being configured") successMessage = __("Audio settings configured!") failedMessage = __("Failed to configure the audio parameters!") @@ -118,6 +129,7 @@ class ClSetupLocaleAction(ClSetupSystemAction): Действие для настройки языковых параметров """ addon_tasks = [] + prev_tasks = [] templateTaskMessage = \ __("The localization and time options are being configured") successMessage = __("System configured!") @@ -152,6 +164,7 @@ class ClSetupBootAction(ClSetupSystemAction): successMessage = __("Boot parameters configured!") failedMessage = __("Failed to configure the boot parameters!") + prev_tasks = [] addon_tasks = [ # установить загрузчик {'name': 'prepare_bootloader', diff --git a/pym/install/variables/X11.py b/pym/install/variables/X11.py index 7e30518..f98bad0 100644 --- a/pym/install/variables/X11.py +++ b/pym/install/variables/X11.py @@ -253,6 +253,12 @@ class VariableOsInstallX11VideoDrv(VideoVariable): return "" +class VariableOsInstallX11VideoDrvPrev(VariableOsInstallX11VideoDrv): + """ + Предыдущее значение os_install_x11_videodrv + """ + + class VariableHrVideoId(ReadonlyVariable): """ BusID of video card