[blivet/f21/master] Write a fs label for HFS+ ESP
Anne Mulhern
amulhern at redhat.com
Mon Jul 21 14:36:58 UTC 2014
----- Original Message -----
> From: "Brian C. Lane" <bcl at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Friday, July 18, 2014 8:31:12 PM
> Subject: [blivet/f21/master] Write a fs label for HFS+ ESP
>
> Now that we have the ability to set the filesystem label, take advantage
> of it to set the HFS+ ESP label to "Linux HFS+ ESP" so that it matches
> the partition name and will show up in the OSX file browser.
> ---
> blivet/formats/fs.py | 8 ++++++++
> blivet/formats/fslabeling.py | 11 +++++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
> index 06d12d5..8724334 100644
> --- a/blivet/formats/fs.py
> +++ b/blivet/formats/fs.py
> @@ -1293,6 +1293,8 @@ class HFSPlus(FS):
> _mkfs = "mkfs.hfsplus"
> _fsck = "fsck.hfsplus"
> _packages = ["hfsplus-tools"]
> + _labelfs = fslabeling.HFSLabeling()
> + _maxLabelChars = 128
I think that _maxLabelChars field is no longer used,
so you could just remove it wherever it occurs in devices.
> _formattable = True
> _mountType = "hfsplus"
> _minSize = Size("1 MiB")
> @@ -1306,6 +1308,7 @@ register_device_format(HFSPlus)
> class MacEFIFS(HFSPlus):
> _type = "macefi"
> _name = N_("Linux HFS+ ESP")
> + _labelfs = fslabeling.HFSPlusLabeling()
> _udevTypes = []
> _minSize = 50
>
> @@ -1314,6 +1317,11 @@ class MacEFIFS(HFSPlus):
> return (isinstance(platform.platform, platform.MacEFI) and
> self.utilsAvailable)
>
> + def __init__(self, **kwargs):
> + if "label" not in kwargs:
> + kwargs["label"] = self._name
> + super(MacEFIFS, self).__init__(**kwargs)
> +
> register_device_format(MacEFIFS)
>
>
> diff --git a/blivet/formats/fslabeling.py b/blivet/formats/fslabeling.py
> index f8d7b42..ea9ab48 100644
> --- a/blivet/formats/fslabeling.py
> +++ b/blivet/formats/fslabeling.py
> @@ -125,6 +125,17 @@ class HFSLabeling(FSLabeling):
> def labelingArgs(self, label):
> return ["-l", label]
> spec
> +class HFSPlusLabeling(FSLabeling):
> +
> + default_label = property(lambda s: "Untitled")
You could set up a test for the new class pretty easily.
At the bottom of labeling_test.py there are a bunch of tiny classes
that extend some testing classes. You just have to pick the correct
class to extend for HFSPlusLabeling,
which since there is no label_app is just LabelingAsRoot and fill in a couple
of fields as appropriate.
> + label_app = property(lambda s: None)
> +
> + def labelFormatOK(self, label):
> + return ':' not in label and len(label) < 129 and len(label) > 0
> +
> + def labelingArgs(self, label):
> + return ["-v", label]
> +
> class NTFSLabeling(FSLabeling):
>
> default_label = property(lambda s: "")
> --
> 1.9.3
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
>
- mulhern
More information about the anaconda-patches
mailing list