diff options
author | Roger Leigh <rleigh@debian.org> | 2013-05-12 00:24:18 +0100 |
---|---|---|
committer | Roger Leigh Roger Leigh rleigh@debian.org <mika@grml.org> | 2014-09-25 08:47:40 +0200 |
commit | be18fee1bd52f4616aa6107fad5a0457a18b3293 (patch) | |
tree | 905bef844fdc2903b2e05f73f316d131005ea3cf /scripts/functions | |
parent | a8c7c8a674046d7f7430150c4a2fc8f4174a8fd7 (diff) |
resolve_device: Canonicalise symbolic links to real device nodes
Canonicalise device names to match util-linux mount behaviour.
This ensures that "mount -a" in mountall does not try to mount
/usr a second time (which it will attempt if the mounted device
does not match the canonical device name). This also fixes a
longstanding annoyance with the output of mount and df using long
UUIDs rather than short device names.
Note that resolve_device may be called more than one; it's done
during options parsing for ROOT, and again immediately
prior to mounting. This is because during options parsing the
device node does not exist, but we still need to construct a
path into /dev from the LABEL or UUID.
Rebased and ETC handling dropped by Michael Prokop <mika@debian.org>
Diffstat (limited to 'scripts/functions')
-rw-r--r-- | scripts/functions | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/functions b/scripts/functions index 3ba5a27..a4eef8f 100644 --- a/scripts/functions +++ b/scripts/functions @@ -495,6 +495,8 @@ resolve_device() { DEV="/dev/disk/by-uuid/${DEV#UUID=}" ;; esac + # Only canonicalise if a valid file, in case $DEV isn't a filename + [ -e "$DEV" ] && DEV=$(readlink -f "$DEV") echo "$DEV" } |