Re: [PATCH] Add --root-device to upgrade in ks.cfg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The idea is right, but some relatively cosmetic things to better fit in
with the rest of the code base.

On Fri, 2008-12-12 at 16:14 +0200, Alexander Todorov wrote:
> diff --git a/upgrade.py b/upgrade.py
> index 4aee58c..2fb6ef6 100644
> --- a/upgrade.py
> +++ b/upgrade.py
> @@ -128,9 +128,29 @@ def findRootParts(anaconda):
>      if anaconda.id.rootParts is None:
>          anaconda.id.rootParts = findExistingRoots(anaconda)
>  
> +    root_device = None
> +    # ks.cfg can pass device as raw device, label or uuid
> +    if (anaconda.id.ksdata is not None) and
> anaconda.id.ksdata.upgrade and (anaconda.id.ksdata.upgrade.root_device
> is not None):
> +        root_device=anaconda.id.ksdata.upgrade.root_device
> +
> +        if root_device.startswith("LABEL="):
> +           root_device = root_device[6:]
> +
> +        if root_device.startswith("UUID="):
> +           root_device = root_device[5:]
> +
> +        # strip both kind of quotes. we can pass UUID="ID"
> +        root_device = root_device.strip('"')
> +        root_device = root_device.strip("'")

This isn't quite right -- label and uuid are separate and if one is
specified, we need to check with exactly what they requested...

>      anaconda.id.upgradeRoot = []
>      for (dev, fs, meta, label) in anaconda.id.rootParts:

Which probably means that we should include the uuid in what we store as
the rootParts.  ie, a first patch would be to update partedUtils.py's
findExistingRootPartitions to have rootParts as a tuple of dev, fs,
release string, label and uuid and then all callers to handle the five
tuple

> -        anaconda.id.upgradeRoot.append( (dev, fs) )
> +        if (root_device is not None):
> +            uuid = isys.readFSUuid(dev)
> +            if (root_device == dev) or (root_device == label) or
> (root_device == uuid):                
> +                anaconda.id.upgradeRoot.append( (dev, fs) )
> +        else:
> +            anaconda.id.upgradeRoot.append( (dev, fs) )

And then here we would need to check if dev == root_device or "LABEL=%s"
%(label,) == root_device or "UUID=%s" %(uuid,) == root_device instead of
making the assumption that stripping off is okay

Jeremy

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux