|
|
|
@ -987,23 +987,6 @@ class FormatBtrfs(FormatProcessGeneric):
|
|
|
|
|
def param(self):
|
|
|
|
|
return "-f", self.get_label(), self.dev
|
|
|
|
|
|
|
|
|
|
class FormatBtrfsCompressed(FormatBtrfs):
|
|
|
|
|
|
|
|
|
|
def postaction(self):
|
|
|
|
|
try:
|
|
|
|
|
if self.purpose != "boot" and self.compression:
|
|
|
|
|
Btrfs(self.dev).compression = self.compression
|
|
|
|
|
if self.purpose == "root":
|
|
|
|
|
# disable btrfs compression for /boot directory in root partition
|
|
|
|
|
# and usr/share/grub for unicode.pf2
|
|
|
|
|
for dn in ("boot", "usr/share/grub", "var/calculate/linux"):
|
|
|
|
|
Btrfs(self.dev).set_compression(dn, "")
|
|
|
|
|
if self.purpose == "calculate":
|
|
|
|
|
Btrfs(self.dev).set_compression("linux", "")
|
|
|
|
|
|
|
|
|
|
except BtrfsError as e:
|
|
|
|
|
raise DistributiveError(
|
|
|
|
|
_("Failed to set btrfs compression for {}").format(self.dev))
|
|
|
|
|
|
|
|
|
|
class PartitionDistributive(Distributive):
|
|
|
|
|
format_map = {
|
|
|
|
@ -1020,7 +1003,7 @@ class PartitionDistributive(Distributive):
|
|
|
|
|
'ntfs': FormatNtfs,
|
|
|
|
|
'uefi': FormatUefi,
|
|
|
|
|
'btrfs': FormatBtrfs,
|
|
|
|
|
'btrfs-compress': FormatBtrfsCompressed,
|
|
|
|
|
'btrfs-compress': FormatBtrfs,
|
|
|
|
|
'swap': FormatSwap
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1123,13 +1106,16 @@ class PartitionDistributive(Distributive):
|
|
|
|
|
|
|
|
|
|
def convertToDirectory(self):
|
|
|
|
|
"""Convert partition to directory by mounting"""
|
|
|
|
|
mapFS = {'btrfs-compress': 'btrfs'}
|
|
|
|
|
mapOpts = {'btrfs-compress': ' -o compress=%s' % self.compression}
|
|
|
|
|
mdirectory = self.mdirectory
|
|
|
|
|
for child in self.childs:
|
|
|
|
|
if isinstance(child, DirectoryDistributive) and \
|
|
|
|
|
mdirectory in child.directory:
|
|
|
|
|
return child
|
|
|
|
|
mdirectory = self._getMntDirectory(mdirectory)
|
|
|
|
|
self._mountPartition(self.partition, mdirectory)
|
|
|
|
|
self._mountPartition(self.partition, mdirectory,
|
|
|
|
|
mapOpts.get(self.fileSystem,""))
|
|
|
|
|
dirObj = DirectoryDistributive(mdirectory, parent=self)
|
|
|
|
|
if self.multipartition:
|
|
|
|
|
mulipartDataNotBind = filter(lambda x: x[2] != "bind",
|
|
|
|
@ -1139,10 +1125,10 @@ class PartitionDistributive(Distributive):
|
|
|
|
|
realMountPoint = None
|
|
|
|
|
if fileSystem != "swap":
|
|
|
|
|
realMountPoint = pathJoin(mdirectory, mountPoint)
|
|
|
|
|
mapFS = {'btrfs-compress': 'btrfs'}
|
|
|
|
|
self._mountPartition(
|
|
|
|
|
dev, realMountPoint,
|
|
|
|
|
"-t %s" % mapFS.get(fileSystem,fileSystem))
|
|
|
|
|
"-t %s" % mapFS.get(fileSystem,fileSystem) +
|
|
|
|
|
mapOpts.get(fileSystem,""))
|
|
|
|
|
partObj = PartitionDistributive(dev, flagRemoveDir=False,
|
|
|
|
|
fileSystem=fileSystem,
|
|
|
|
|
isFormat=isFormat,
|
|
|
|
|