summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaximilian attems <maks@debian.org>2009-02-17 18:00:16 +0100
committermaximilian attems <maks@debian.org>2009-02-17 18:06:45 +0100
commit70ff74f8b3d378d7153f9211bbe0e73713a87259 (patch)
treeeaab138d50fb5db89faf67ef6beeda2040151003
parent29dd116363aeaac22c54e1aef24020b6d26674af (diff)
downloadinitramfs-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-xinit29
1 files changed, 28 insertions, 1 deletions
diff --git a/init b/init
index 072d82c..7f549b1 100755
--- a/init
+++ b/init
@@ -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=}"