~ubuntu-branches/ubuntu/karmic/cryptsetup/karmic

« back to all changes in this revision

Viewing changes to debian/initramfs/cryptroot-hook

  • Committer: Bazaar Package Importer
  • Author(s): TJ
  • Date: 2009-02-16 23:00:00 UTC
  • Revision ID: james.westby@ubuntu.com-20090216230000-mtixiq3n2o6mwbvm
Tags: 2:1.0.6-7ubuntu5
debian/initramfs/cryptroot-hook: fix support for UUID and LABEL correlation
between fstab and crypttab (LP: #287879).

Show diffs side-by-side

added added

removed removed

Lines of Context:
280
280
}
281
281
 
282
282
canonical_device() {
283
 
        local dev altdev
 
283
        local dev altdev original
284
284
        dev="$1"
285
285
 
286
286
        altdev="${dev#LABEL=}"
293
293
                dev="/dev/disk/by-uuid/$altdev"
294
294
        fi
295
295
 
 
296
        original=$dev
296
297
        if [ -h "$dev" ]; then
297
298
                dev=$(readlink -e "$dev")
298
299
        fi
301
302
        if [ "$altdev" != "$dev" ]; then
302
303
                echo "$altdev"
303
304
                return 0
 
305
        elif [ "x${original%/dev/disk/by-*/*}" = "x" ]; then
 
306
                # support crypttab UUID/LABEL entries
 
307
                # this is a /dev/disk/by-*/ path so return just the 'basename'
 
308
                echo "${original##/dev/disk/by-*/}"
 
309
                return 0
304
310
        fi
305
311
 
306
312
        return 1