You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
6.9 KiB
165 lines
6.9 KiB
12 years ago
|
#-*- coding: utf-8 -*-
|
||
|
|
||
11 years ago
|
# Copyright 2010-2013 Calculate Ltd. http://www.calculate-linux.org
|
||
12 years ago
|
#
|
||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
# you may not use this file except in compliance with the License.
|
||
|
# You may obtain a copy of the License at
|
||
|
#
|
||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||
|
#
|
||
|
# Unless required by applicable law or agreed to in writing, software
|
||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
# See the License for the specific language governing permissions and
|
||
|
# limitations under the License.
|
||
|
|
||
|
import sys
|
||
11 years ago
|
from calculate.core.server.func import Action,Tasks
|
||
12 years ago
|
from calculate.lib.cl_lang import setLocalTranslate,getLazyLocalTranslate
|
||
|
from calculate.lib.utils.files import FilesError
|
||
11 years ago
|
from calculate.lib.utils.portage import isPkgInstalled
|
||
12 years ago
|
from calculate.install.install import (MigrationError, TemplatesError,
|
||
|
InstallError,
|
||
|
AutopartitionError, DistributiveError)
|
||
|
|
||
|
setLocalTranslate('cl_install3',sys.modules[__name__])
|
||
|
__ = getLazyLocalTranslate(_)
|
||
|
|
||
11 years ago
|
class ClSetupVideoAction(Action):
|
||
12 years ago
|
"""
|
||
11 years ago
|
Действие для настройки параметров видео
|
||
12 years ago
|
"""
|
||
|
# ошибки, которые отображаются без подробностей
|
||
|
native_error = (FilesError,MigrationError, TemplatesError,
|
||
|
InstallError, AutopartitionError, DistributiveError)
|
||
11 years ago
|
|
||
11 years ago
|
templateTaskMessage = __("Video settings are being configured")
|
||
11 years ago
|
successMessage = __("Video settings configured!")
|
||
|
failedMessage = __("Failed to configure the video settings!")
|
||
12 years ago
|
interruptMessage = __("Configuration manually interrupted")
|
||
|
|
||
11 years ago
|
addon_tasks = [
|
||
|
# проверить и настроить параметры для nvidia драйвера
|
||
|
{'name':'check_video',
|
||
|
'message':__("Checking the video driver"),
|
||
|
'method':'Install.checkVideoDriver()',
|
||
11 years ago
|
'condition': lambda:isPkgInstalled('xorg-server')
|
||
11 years ago
|
},
|
||
|
{'name':'setup_opengl',
|
||
|
'message':__("Configuring OpenGL"),
|
||
|
'method':'Install.setupOpenGL()',
|
||
11 years ago
|
'condition': lambda:isPkgInstalled('xorg-server')
|
||
11 years ago
|
},
|
||
|
{'name':'reboot',
|
||
|
'warning':__("To apply the changes, reboot the system"),
|
||
|
'condition': lambda dv:(dv.Get('os_x11_video_drv') != \
|
||
|
dv.Get('os_install_x11_video_drv') and \
|
||
|
(dv.Get('os_x11_video_drv') in dv.Get('os_x11_kms_video_drv') \
|
||
|
or dv.Get('os_install_x11_video_drv') \
|
||
|
in dv.Get('os_x11_kms_video_drv')))
|
||
|
},
|
||
|
{'name':'restart',
|
||
|
'warning':__("To apply the changes, restart the X server"),
|
||
|
'condition': lambda dv:(dv.Get('os_x11_video_drv') !=
|
||
|
dv.Get('os_install_x11_video_drv') and
|
||
|
(not dv.Get('os_x11_video_drv') in
|
||
|
dv.Get('os_x11_kms_video_drv') and
|
||
|
not dv.Get('os_install_x11_video_drv')
|
||
|
in dv.Get('os_x11_kms_video_drv')))
|
||
|
}
|
||
|
]
|
||
|
|
||
12 years ago
|
def __init__(self):
|
||
|
# список задач для дейсвия
|
||
|
self.tasks = [
|
||
|
{'name':'apply_templates',
|
||
|
'message':self.templateTaskMessage,
|
||
|
# наложить шаблоны на текущий дистрибутив, включая clt шаблоны
|
||
|
# без использования фильтров по clt шаблонам
|
||
11 years ago
|
'method':'Install.applyTemplates(cl_source,cl_template_clt_set,'\
|
||
|
'cl_merge_set,None)',
|
||
12 years ago
|
}]
|
||
|
# выполнить дополнительные задачи
|
||
|
self.tasks.extend(self.addon_tasks)
|
||
11 years ago
|
Action.__init__(self)
|
||
12 years ago
|
|
||
11 years ago
|
|
||
|
class ClSetupSystemAction(ClSetupVideoAction):
|
||
|
"""
|
||
|
Объект настройки всех параметров системы
|
||
|
"""
|
||
11 years ago
|
templateTaskMessage = __("The system is being configured")
|
||
11 years ago
|
successMessage = __("System configured!")
|
||
|
failedMessage = __("Failed to configure the system!")
|
||
|
|
||
11 years ago
|
class ClSetupAudioAction(ClSetupSystemAction):
|
||
12 years ago
|
"""
|
||
|
Действие для настройки аудио параметров
|
||
|
"""
|
||
11 years ago
|
addon_tasks = []
|
||
11 years ago
|
templateTaskMessage = __("The audio settings are being configured")
|
||
12 years ago
|
successMessage = __("Audio settings configured!")
|
||
|
failedMessage = __("Failed to configure the audio parameters!")
|
||
|
|
||
11 years ago
|
class ClSetupLocaleAction(ClSetupSystemAction):
|
||
12 years ago
|
"""
|
||
|
Действие для настройки языковых параметров
|
||
|
"""
|
||
11 years ago
|
addon_tasks = []
|
||
12 years ago
|
templateTaskMessage = \
|
||
11 years ago
|
__("The localization and time options are being configured")
|
||
12 years ago
|
successMessage = __("System configured!")
|
||
|
failedMessage = __("Failed to configure the system!")
|
||
|
|
||
11 years ago
|
class ClSetupNetworkAction(ClSetupSystemAction):
|
||
12 years ago
|
"""
|
||
|
Действие для настройки аудио параметров
|
||
|
"""
|
||
11 years ago
|
addon_tasks = []
|
||
11 years ago
|
templateTaskMessage = __("The network settings are being configured")
|
||
12 years ago
|
successMessage = __("Network settings configured!")
|
||
|
failedMessage = __("Failed to configure the network settings!")
|
||
|
|
||
11 years ago
|
class ClSetupUsersAction(ClSetupSystemAction):
|
||
12 years ago
|
"""
|
||
|
Действие для настройки пользовательских параметров
|
||
|
"""
|
||
11 years ago
|
addon_tasks = []
|
||
11 years ago
|
templateTaskMessage = __("The user settings are being configured")
|
||
12 years ago
|
successMessage = __("User settings configured!")
|
||
|
failedMessage = __("Failed to configure the user settings!")
|
||
|
|
||
11 years ago
|
class ClSetupBootAction(ClSetupSystemAction):
|
||
12 years ago
|
"""
|
||
|
Действие для настройки параметров загрузки
|
||
|
"""
|
||
11 years ago
|
templateTaskMessage = __("The boot parameters are being configured")
|
||
12 years ago
|
successMessage = __("Boot parameters configured!")
|
||
|
failedMessage = __("Failed to configure the boot parameters!")
|
||
|
|
||
11 years ago
|
addon_tasks = [
|
||
|
# установить загрузчик
|
||
|
{'name':'prepare_bootloader',
|
||
|
'message':_("Installing the bootloader"),
|
||
|
'method':'Install.prepareBoot(cl_image)',
|
||
11 years ago
|
'condition':(lambda Get:(Get('os_install_mbr') or
|
||
|
Get('os_install_uefi_set') == 'on') and
|
||
11 years ago
|
Get('os_root_type') != 'livecd' and
|
||
|
Get('os_install_scratch') == 'off')
|
||
|
},
|
||
|
{'name':'no_scratch',
|
||
10 years ago
|
'warning':_("The builder mode is no longer supported"),
|
||
11 years ago
|
'condition':lambda Get:Get('os_install_scratch') == 'on'
|
||
11 years ago
|
},
|
||
|
# изменить IO планировщик
|
||
|
{'name':'change_ioscheduler',
|
||
|
'message':_("Changing the I/O scheduler"),
|
||
|
'method':'Install.changeScheduler(os_install_kernel_scheduler)',
|
||
11 years ago
|
'condition':(lambda dv:dv.Get('os_root_type') != 'livecd' and
|
||
|
dv.Select('os_disk_parent',
|
||
11 years ago
|
where='os_disk_mount',
|
||
|
eq='/',limit=1))
|
||
|
},
|
||
|
]
|