|
|
|
@ -22,9 +22,11 @@ import time
|
|
|
|
|
import stat
|
|
|
|
|
from calculate.core.server.gen_pid import search_worked_process2
|
|
|
|
|
from calculate.core.setup_package import ChainProgressTemplate
|
|
|
|
|
from calculate.lib.datavars import DataVars
|
|
|
|
|
from calculate.lib.cl_template import templateFunction
|
|
|
|
|
from calculate.lib.datavars import DataVars, Variable
|
|
|
|
|
from calculate.lib.utils.colortext import (TextState, get_color_print,
|
|
|
|
|
convert_console_to_xml)
|
|
|
|
|
convert_console_to_xml)
|
|
|
|
|
from calculate.lib.utils.common import CmdlineParams
|
|
|
|
|
from calculate.lib.utils.files import (
|
|
|
|
|
pathJoin, PercentProgress, getProgPath, process, STDOUT, removeDir,
|
|
|
|
|
makeDirectory, writeFile, readLinesFile, chmod, chown, FilePermission,
|
|
|
|
@ -1207,28 +1209,54 @@ class Builder(Update):
|
|
|
|
|
self.printWARNING(str(e))
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def _get_default_params(self, drvs):
|
|
|
|
|
"""
|
|
|
|
|
Получить параметры загрузки для системы LiveHDD
|
|
|
|
|
"""
|
|
|
|
|
proprietary = ["nvidia", "fglrx"]
|
|
|
|
|
video = self.clVars.Get('cl_builder_x11_video_drv')
|
|
|
|
|
locale = self.clVars.Get('cl_builder_locale_lang')
|
|
|
|
|
timezone = self.clVars.Get('cl_builder_timezone')
|
|
|
|
|
params = ["%s:%s" % (CmdlineParams.Locale, locale),
|
|
|
|
|
"%s:%s" % (CmdlineParams.Timezone, timezone)]
|
|
|
|
|
resolution = self.clVars.Get('cl_builder_x11_resolution')
|
|
|
|
|
if resolution and resolution != "auto":
|
|
|
|
|
params.append("%s:%s" % (CmdlineParams.Resolution, resolution))
|
|
|
|
|
if video != "default" and (
|
|
|
|
|
video not in proprietary or Variable.isTrue(drvs)):
|
|
|
|
|
params.append("%s:%s" % (CmdlineParams.Video, video))
|
|
|
|
|
current_video = self.clVars.Get('os_x11_video_drv')
|
|
|
|
|
if current_video == video and video != "default":
|
|
|
|
|
composite = self.clVars.Get('cl_builder_x11_composite')
|
|
|
|
|
params.append("%s:%s" % (CmdlineParams.Composite, composite))
|
|
|
|
|
return ",".join(params)
|
|
|
|
|
|
|
|
|
|
def create_iso_grub_cfg(self, dn):
|
|
|
|
|
gc = GrubCommand()
|
|
|
|
|
content = []
|
|
|
|
|
for label, iso, splash in self.clVars.ZipVars(
|
|
|
|
|
for label, iso, splash, drvs in self.clVars.ZipVars(
|
|
|
|
|
'cl_builder_image_label',
|
|
|
|
|
'cl_builder_image_iso',
|
|
|
|
|
'cl_builder_image_splash'):
|
|
|
|
|
'cl_builder_image_splash',
|
|
|
|
|
'cl_builder_image_drivers'):
|
|
|
|
|
default_params = self._get_default_params(drvs)
|
|
|
|
|
entry = (
|
|
|
|
|
"menuentry '%(label)s' {\n"
|
|
|
|
|
"\tset isofile=%(iso)s\n"
|
|
|
|
|
"\tloopback loop $isofile\n"
|
|
|
|
|
"\tlinux (loop)/boot/vmlinuz root=live "
|
|
|
|
|
"iso-scan/filename=$isofile quiet %(splash)s\n"
|
|
|
|
|
"iso-scan/filename=$isofile quiet %(splash)s "
|
|
|
|
|
"calculate=%(defs)s\n"
|
|
|
|
|
"\tinitrd (loop)/boot/initrd\n}\n\n" % {
|
|
|
|
|
'label': label,
|
|
|
|
|
'iso': gc.get_relpath(iso),
|
|
|
|
|
'splash': 'splash=silent,theme:calculate console=tty1'
|
|
|
|
|
'splash': templateFunction.splash_cmd(splash),
|
|
|
|
|
'defs': default_params
|
|
|
|
|
})
|
|
|
|
|
content.append(entry)
|
|
|
|
|
fn_grubcfg = path.join(dn, 'grub.cfg')
|
|
|
|
|
try:
|
|
|
|
|
write_content = ("\n".join(content)).strip()+"\n"
|
|
|
|
|
write_content = ("\n".join(content)).strip() + "\n"
|
|
|
|
|
if write_content.strip():
|
|
|
|
|
with writeFile(fn_grubcfg) as f:
|
|
|
|
|
f.write(write_content)
|
|
|
|
@ -1245,7 +1273,7 @@ class Builder(Update):
|
|
|
|
|
try:
|
|
|
|
|
os.unlink(cfg_fn)
|
|
|
|
|
except OSError:
|
|
|
|
|
raise BuilderError(_("Failed to remove %s")%cfg_fn)
|
|
|
|
|
raise BuilderError(_("Failed to remove %s") % cfg_fn)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def setup_package(self, package):
|
|
|
|
|