diff --git a/pym/install/distr.py b/pym/install/distr.py index f45e172..76cbc03 100644 --- a/pym/install/distr.py +++ b/pym/install/distr.py @@ -907,6 +907,10 @@ class FormatExt4(FormatExt2): format_util = "/sbin/mkfs.ext4" +class FormatExfat(FormatProcessGeneric): + format_util = "/sbin/mkfs.exfat" + + class FormatJfs(FormatProcessGeneric): format_util = "/sbin/mkfs.jfs" @@ -1000,6 +1004,7 @@ class PartitionDistributive(Distributive): 'ext2': FormatExt2, 'ext3': FormatExt3, 'ext4': FormatExt4, + 'exfat': FormatExfat, 'jfs': FormatJfs, 'f2fs': FormatF2FS, 'reiserfs': FormatReiserfs, diff --git a/pym/install/install.py b/pym/install/install.py index 8ba5fa9..ebd2094 100644 --- a/pym/install/install.py +++ b/pym/install/install.py @@ -226,14 +226,17 @@ class Install(MethodsInterface): raise DistributiveError( _("Failed to write the master boot record\n%s") % dd_process.read()) - target.close() - # выполнить установку syslinux загрузчика install_root_dev = self.clVars.Get('os_install_root_dev') - syslinux_process = process("/usr/bin/syslinux", - install_root_dev, stderr=STDOUT) + mount_path = target.convertToDirectory() + syslinux_process = process("/usr/bin/extlinux", '--install', + mount_path.directory, stderr=STDOUT) if syslinux_process.failed(): raise DistributiveError(_("Failed to install syslinux\n%s") % syslinux_process.read()) + target.close() + # выполнить установку syslinux загрузчика + + # установить загрузочный раздел активным return self.setActivePartition(self.clVars.Get('os_install_root_dev')) diff --git a/pym/install/variables/disk.py b/pym/install/variables/disk.py index 7f5429b..4368743 100644 --- a/pym/install/variables/disk.py +++ b/pym/install/variables/disk.py @@ -2522,6 +2522,7 @@ class VariableOsInstallFormatSingleSet(Variable): opt = ["--format"] untrusted = True value = "off" + check_after = ["cl_target_fs"] def init(self): self.label = _("Format the USB Flash") @@ -2529,7 +2530,8 @@ class VariableOsInstallFormatSingleSet(Variable): def must_be_formatted(self, dev): fs = self.select('os_disk_format', os_disk_dev=dev, limit=1) - if fs != "vfat": + new_fs = self.Get('cl_target_fs') + if fs != new_fs: return True return False @@ -2549,8 +2551,8 @@ class VariableOsInstallFormatSingleSet(Variable): "contains the current system")) else: if self.must_be_formatted(dev): - raise VariableError( - _("{device} must be formatted").format(device=dev)) + self.value = 'on' + value = 'on' if dev: try: with FlashDistributive(dev) as f: diff --git a/pym/install/variables/distr.py b/pym/install/variables/distr.py index fee129d..3ccb4f0 100644 --- a/pym/install/variables/distr.py +++ b/pym/install/variables/distr.py @@ -25,6 +25,7 @@ from calculate.lib.datavars import (Variable, VariableError, ReadonlyVariable, from calculate.lib.utils.common import (getSupportArch, getTupleVersion, cmpVersion, cmp) from calculate.lib.utils.files import listDirectory, pathJoin +from calculate.lib.utils.grub import GrubCommand from calculate.lib.variables.linux import Linux from ..distr import (Distributive, PartitionDistributive, DirectoryDistributive, DefaultMountPath, @@ -522,6 +523,7 @@ class VariableClTarget(ReadonlyVariable): Target distributive """ type = "object" + filesystem = "cl_target_fs" def get(self): listVars = ['os_install_disk_dev', 'os_install_disk_mount', @@ -535,9 +537,10 @@ class VariableClTarget(ReadonlyVariable): flashLabel = "{short}-{build}".format( short="CL", build=self.Get('os_install_linux_build')) disk = self.Get('os_install_disk_single') - fileSystem = "vfat" + fileSystem = self.Get(self.filesystem) or 'ntfs' + #fileSystem = "vfat" systemId = FileSystemManager.supportFS.get( - 'vfat', {}).get('msdos', '0b') + fileSystem, {}).get('msdos', '0b') isFormat = self.GetBool('os_install_format_single_set') partTable = self.select('os_disk_part', os_disk_dev=disk, limit=1) @@ -598,6 +601,26 @@ class VariableClTarget(ReadonlyVariable): return target +class VariableClTargetFs(Variable): + type = 'choice' + opt = ['--fs'] + disk = 'os_install_disk_single' + value = 'auto' + + def init(self): + self.label = _("File system on flash device") + self.help = _("Create new FS on flash device(formating req)") + + def get(self): + if self.value != 'auto': + return self.value + return 'ntfs' + + def choice(self): + return ['vfat', 'btrfs', 'ntfs', 'ext4', + 'ext3', 'ext2', 'xfs'] + + class VariableClImageNewOnly(Variable): """ Distributive image filename diff --git a/pym/install/wsdl_install.py b/pym/install/wsdl_install.py index 5d93250..f6ba6f8 100644 --- a/pym/install/wsdl_install.py +++ b/pym/install/wsdl_install.py @@ -173,7 +173,8 @@ class Wsdl(WsdlBase): lambda group: group(_("Flash install"), normal=('cl_image_filename', 'os_install_disk_single', - 'os_install_format_single_set'), + 'os_install_format_single_set', + 'cl_target_fs'), next_label=_("Run"))], 'brief': {'next': __("Run"), 'name': __("Start installing")}},