[blivet 1/3] Write a fs label for HFS+ ESP
Vratislav Podzimek
vpodzime at redhat.com
Tue Jul 22 07:15:49 UTC 2014
On Mon, 2014-07-21 at 09:05 -0700, Brian C. Lane wrote:
> 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 | 7 +++++++
> blivet/formats/fslabeling.py | 11 +++++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
> index 06d12d5..78566f2 100644
> --- a/blivet/formats/fs.py
> +++ b/blivet/formats/fs.py
> @@ -1293,6 +1293,7 @@ class HFSPlus(FS):
> _mkfs = "mkfs.hfsplus"
> _fsck = "fsck.hfsplus"
> _packages = ["hfsplus-tools"]
> + _labelfs = fslabeling.HFSPlusLabeling()
> _formattable = True
> _mountType = "hfsplus"
> _minSize = Size("1 MiB")
> @@ -1306,6 +1307,7 @@ register_device_format(HFSPlus)
> class MacEFIFS(HFSPlus):
> _type = "macefi"
> _name = N_("Linux HFS+ ESP")
> + _labelfs = fslabeling.HFSPlusLabeling()
> _udevTypes = []
> _minSize = 50
>
> @@ -1314,6 +1316,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..ef5b4ae 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]
>
> +class HFSPlusLabeling(FSLabeling):
> +
> + default_label = property(lambda s: "Untitled")
> + label_app = property(lambda s: None)
> +
> + def labelFormatOK(self, label):
> + return ':' not in label and 0 < len(label) < 129
> +
> + def labelingArgs(self, label):
> + return ["-v", label]
> +
> class NTFSLabeling(FSLabeling):
>
> default_label = property(lambda s: "")
These all look good to me.
--
Vratislav Podzimek
Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list