genfstab: handle bind mounts

This commit is contained in:
Dave Reisner 2012-06-17 22:53:46 -04:00
parent 67ec87fef0
commit 8fc4708377

View File

@ -79,7 +79,7 @@ if (( bylabel && byuuid )); then
fi
# handle block devices
findmnt -Recvruno SOURCE,TARGET,FSTYPE,VFS-OPTIONS "$root" |
findmnt -Recruno SOURCE,TARGET,FSTYPE,OPTIONS "$root" |
while read -r source target fstype opts; do
# default 5th and 6th columns
dump=0 pass=2
@ -96,6 +96,12 @@ findmnt -Recvruno SOURCE,TARGET,FSTYPE,VFS-OPTIONS "$root" |
pass=0
fi
if [[ $source =~ ^(/.+)\[(.+)\]$ ]]; then
# it's a bind mount
source=$(findmnt -funcrevo TARGET "${BASH_REMATCH[1]}")${BASH_REMATCH[2]}
fstype=bind
fi
# write one line
write_source "$source"
printf '\t%-10s' "$target" "$fstype" "$opts"