diff options
author | maximilian attems <maks@debian.org> | 2009-02-17 18:00:16 +0100 |
---|---|---|
committer | maximilian attems <maks@debian.org> | 2009-02-17 18:06:45 +0100 |
commit | 70ff74f8b3d378d7153f9211bbe0e73713a87259 (patch) | |
tree | eaab138d50fb5db89faf67ef6beeda2040151003 | |
parent | 29dd116363aeaac22c54e1aef24020b6d26674af (diff) | |
download | initramfs-tools-70ff74f8b3d378d7153f9211bbe0e73713a87259.tar.gz initramfs-tools-70ff74f8b3d378d7153f9211bbe0e73713a87259.zip |
Fix boot with LABEL containting one or several '/'
As there is no /dev/disk/by-label//, we need to follow udev
on escape the '/' character with \x2f
don't rely on sed, as we might not have it in initramfs.
(closes: #489008)
Reported-by: Josh Triplett <josh@freedesktop.org>
Tested-by: Andres Salomon <dilinger@debian.org>
thanks for dilinger to pushing the first easy solution to a complete,
so we don't have to revisit the case.
-rwxr-xr-x | init | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -62,7 +62,34 @@ for x in $(cat /proc/cmdline); do ROOT=${x#root=} case $ROOT in LABEL=*) - ROOT="/dev/disk/by-label/${ROOT#LABEL=}" + ROOT="${ROOT#LABEL=}" + + # support / in LABEL= paths (escape to \x2f) + case "${ROOT}" in + *[/]*) + if [ -x "$(command -v sed)" ]; then + ROOT="$(echo ${ROOT} | sed 's,/,\\x2f,g')" + else + if [ "${ROOT}" != "${ROOT#/}" ]; then + ROOT="\x2f${ROOT#/}" + fi + if [ "${ROOT}" != "${ROOT%/}" ]; then + ROOT="${ROOT%/}\x2f" + fi + IFS='/' + newroot= + for s in $ROOT; do + if [ -z "${newroot}" ]; then + newroot="${s}" + else + newroot="${newroot}\\x2f${s}" + fi + done + unset IFS + ROOT="${newroot}" + fi + esac + ROOT="/dev/disk/by-label/${ROOT}" ;; UUID=*) ROOT="/dev/disk/by-uuid/${ROOT#UUID=}" |