95rootfs-block: fix missing root when label contains slash

It is not clearly documented, but apparently fsck
(or, probably, getmntent) is using backslash as
escape character.

Label containing slash is converted to \x2f but '\'
is eaten by fsck later. Escape '\' before writing
into fstab.

v2:
- fix sed expression
- use printf instead of echo because echo eats '\' as well

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
master
Andrey Borzenkov 2010-11-07 00:46:53 +03:00 committed by Harald Hoyer
parent 161da365e2
commit 0e08f1de8d
1 changed files with 3 additions and 1 deletions

View File

@ -106,7 +106,9 @@ if [ -n "$root" -a -z "${root%%block:*}" ]; then
done
fi

echo ${root#block:} "$NEWROOT" "$rootfs" ${rflags},${rootopts} 1 1 > /etc/fstab
# backslashes are treated as escape character in fstab
esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g')
printf "%s $NEWROOT $rootfs ${rflags},${rootopts} 1 1\n" "$esc_root" > /etc/fstab

if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then
info "Checking filesystems"