|
|
|
@ -19,7 +19,9 @@ from os import path
|
|
|
|
|
import os
|
|
|
|
|
import re
|
|
|
|
|
from calculate.install.variables.kernel import KernelConfig
|
|
|
|
|
from calculate.lib.utils.dracut import Dracut
|
|
|
|
|
from calculate.lib.utils.portage import getSquashList
|
|
|
|
|
from calculate.lib.variables.system import VariableOsRootType, RootType
|
|
|
|
|
from .action import Actions
|
|
|
|
|
from calculate.install import distr
|
|
|
|
|
from calculate.lib.utils.device import getUdevDeviceInfo, humanreadableSize
|
|
|
|
@ -701,8 +703,6 @@ class VariableClBuilderImageFilename(Variable):
|
|
|
|
|
metavalue = "IMAGE"
|
|
|
|
|
untrusted = True
|
|
|
|
|
|
|
|
|
|
flash_base_dn = '/run/initramfs/live/iso'
|
|
|
|
|
flash_iso_base_dn = '/run/initramfs/isoscan/iso'
|
|
|
|
|
default_base_dn = '/var/calculate/linux'
|
|
|
|
|
|
|
|
|
|
def init(self):
|
|
|
|
@ -724,10 +724,8 @@ class VariableClBuilderImageFilename(Variable):
|
|
|
|
|
build_id = self.Get('cl_builder_id')
|
|
|
|
|
base_dn = self.default_base_dn
|
|
|
|
|
|
|
|
|
|
if self.Get('os_root_type') == 'livecd':
|
|
|
|
|
if self.Get('cl_flash_set') == 'on':
|
|
|
|
|
base_dn = self.flash_base_dn
|
|
|
|
|
# TODO: для iso-scan из flash
|
|
|
|
|
if self.Get('os_root_type_ext') in RootType.RebuildAvailable:
|
|
|
|
|
base_dn = self.Get('cl_builder_flash_repository')
|
|
|
|
|
if build_id:
|
|
|
|
|
imagename = self._isoname()
|
|
|
|
|
return path.join(base_dn, imagename)
|
|
|
|
@ -1215,10 +1213,44 @@ class VariableClBuilderRescratchSet(ReadonlyVariable):
|
|
|
|
|
type = "bool"
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
if self.Get('cl_flash_set') == 'on':
|
|
|
|
|
if self.Get('os_root_type_ext') in RootType.RebuildAvailable:
|
|
|
|
|
isoimage = self.Get('cl_builder_image_filename')
|
|
|
|
|
var = VariableClBuilderImageFilename
|
|
|
|
|
if (isoimage.startswith(var.flash_base_dn) or
|
|
|
|
|
isoimage.startswith(var.flash_iso_base_dn)):
|
|
|
|
|
flash_rep = self.Get('cl_builder_flash_repository')
|
|
|
|
|
isoimage_dir = path.dirname(isoimage)
|
|
|
|
|
if isoimage_dir == flash_rep:
|
|
|
|
|
return "on"
|
|
|
|
|
return "off"
|
|
|
|
|
|
|
|
|
|
class VariableClBuilderFlashRepository(ReadonlyVariable):
|
|
|
|
|
"""
|
|
|
|
|
Хранилище по умолчанию для iso образов на flash
|
|
|
|
|
"""
|
|
|
|
|
suffix = "iso"
|
|
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
|
return path.join(self.Get('cl_builder_flash_path'), "iso")
|
|
|
|
|
|
|
|
|
|
class VariableClBuilderFlashPath(ReadonlyVariable):
|
|
|
|
|
"""
|
|
|
|
|
Путь, куда подключена flash (загрузка либо с флешки, либо с iso)
|
|
|
|
|
"""
|
|
|
|
|
def get(self):
|
|
|
|
|
root_type_ext = self.Get('os_root_type_ext')
|
|
|
|
|
if root_type_ext == RootType.LiveFlash:
|
|
|
|
|
return Dracut.IsoLive
|
|
|
|
|
if root_type_ext == RootType.IsoScan:
|
|
|
|
|
return Dracut.IsoScanPath
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
class VariableClBuilderFlashUuid(ReadonlyVariable):
|
|
|
|
|
"""
|
|
|
|
|
UUID flash, используется для перестроения меню
|
|
|
|
|
"""
|
|
|
|
|
def get(self):
|
|
|
|
|
flash_path = self.Get('cl_builder_flash_path')
|
|
|
|
|
dev = isMount(flash_path)
|
|
|
|
|
if dev:
|
|
|
|
|
return self.select(
|
|
|
|
|
'install.os_disk_uuid',
|
|
|
|
|
install_os_disk_dev=dev, limit=1)
|
|
|
|
|
return ""
|
|
|
|
|