Safer code

loop_file=$(awk '$2=="/" && $4~"loop" {print $1}' /etc/fstab)
if [ -f "$loop_file" ]; then 
    dev_mountpoint=$(awk '"'${loop_file}'"~"^"$2 && $2!="/" {print $1";"$2}' 
/proc/mounts|tail -n 1)
    host_device="${dev_mountpoint%;*}"
    host_mountpoint="${dev_mountpoint#*;}"
fi
if [ -n "$host_device" ]; then
    boot_device=
    root_device="$host_device"
    default_kopt="root=$host_device loop=${loop_file#$host_mountpoint} ro"
else
    default_kopt="root=$root_device ro"
fi
kopt="$default_kopt"

-- 
Update-grub does not set kopt correctly in loopinstallations
https://bugs.launchpad.net/bugs/175772
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to