Comment 1 for bug 173659

Revision history for this message
Agostino Russo (ago) wrote :

Untested, but something along those lines in /lib/partman/fstab.d might do the trick. The script checks whether / is on a loopfile and whether there is a "boot" directory in the same path of the loopfile, in which case it bindsmount boot.

#!/bin/sh

. /lib/partman/definitions.sh

for dev in $DEVICES/*; do
    [ -d $dev ] || continue
    cd $dev
    open_dialog PARTITIONS
    while { read_line num id size type fs path name; [ "$id" ]; }; do
        [ $fs != free ] || continue
        [ -f "$id/method" ] || continue
        [ -f "$id/acting_filesystem" ] || continue
        [ -f "$id/mountpoint" ] || continue
        method=$(cat $id/method)
        mountpoint=$(cat $id/mountpoint)
        if [ "$mountpoint" = / ]; then
            options=$(get_mountoptions $dev $id)
            [ "$options" = ${options#*loop} ] && exit 0
            path=${path%/*}
            [ -d "$path/boot" ] || exit 0
            echo "$path/boot" /boot none bind 0 0
        fi
    done
    close_dialog
done