On Wed, Nov 12, 2008 at 07:03:27PM -0600, Dave Lehman wrote:
> New patch, taking into account David's comments about the number of
> fields in crypttab entries. The newline is not an issue since split is
> in fact getting rid of it. As for the shoddy substring code in
> readFstab... While I agree with you in principal, I don't know if it's
> worthwhile at this point to go through and fix it.
New patch looks good to me, except I'd take clumens' suggestion and use
anaconda.rootPath if it's available rather than /mnt/sysimage.
Agreed on the substring code, was just throwing it out there as something for
all of us to think about.
>
> diff --git a/fsset.py b/fsset.py
> index 40eb0d2..c7972ec 100644
> --- a/fsset.py
> +++ b/fsset.py
> @@ -2695,6 +2695,23 @@ def makeDevice(dev):
> device = PartitionDevice(dev, encryption=cryptoDev)
> return device
>
> +def findBackingDevInCrypttab(mappingName):
> + backingDev = None
> + try:
> + lines = open("/mnt/sysimage/etc/crypttab").readlines()
> + except IOError, e:
> + pass
> + else:
> + for line in lines:
> + fields = line.split()
> + if len(fields) < 2:
> + continue
> + if fields[0] == mappingName:
> + backingDev = fields[1]
> + break
> +
> + return backingDev
> +
> # XXX fix RAID
> def readFstab (anaconda):
> def createMapping(dict):
> @@ -2833,6 +2850,39 @@ def readFstab (anaconda):
> if loopIndex.has_key(device):
> (dev, fs) = loopIndex[device]
> device = LoopbackDevice(dev, fs)
> + elif fields[0].startswith("/dev/mapper/luks-"):
> + backingDev = findBackingDevInCrypttab(fields[0][12:])
> + log.debug("device %s has backing device %s" % (fields[0],
> + backingDev))
> + if backingDev is None:
> + log.error("unable to resolve backing device for %s" %
> fields[0]
> + continue
> + elif backingDev.startswith('LABEL='):
> + label = backingDev[6:]
> + if label in labelDupes:
> + showError(label, intf)
> +
> + if labelToDevice.has_key(label):
> + device = makeDevice(labelToDevice[label])
> + else:
> + log.warning ("crypttab file has LABEL=%s, but this
> label "
> + "could not be found on any file
> system", label
> + # bad luck, skip this entry.
> + continue
> + elif backingDev.startswith('UUID='):
> + uuid = backingDev[5:]
> + if uuid in uuidDupes:
> + showError(uuid, intf)
> +
> + if uuidToDevice.has_key(uuid):
> + device = makeDevice(uuidToDevice[uuid])
> + else:
> + log.warning ("crypttab file has UUID=%s, but this
> UUID"
> + "could not be found on any file
> system", uuid)
> + # bad luck, skip this entry.
> + continue
> + else:
> + device = makeDevice(backingDev[5:])
> elif fields[0].startswith('/dev/'):
> # Older installs may have lines starting with things
> like /dev/proc
> # so watch out for that on upgrade.
>
>
> Dave
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list redhat com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
--
David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI
Attachment:
pgpAjRRPdSb6X.pgp
Description: PGP signature