Commit c793c904 authored by Natanael Copa's avatar Natanael Copa
Browse files

setup-disk: fix enumerate_fstab

fix case when mountpoint is a prefix of other mount. For example:

 setup-disk /d

which would also match /dev and create various bogus entries in the
generated fstab.

Thanks to Jim Pryor for pointing this out.
parent 96401af0
......@@ -57,8 +57,8 @@ enumerate_fstab() {
local mnt="$1"
local fs_spec= fs_file= fs_vfstype= fs_mntops= fs_freq= fs_passno=
[ -z "$mnt" ] && return
local escaped_mnt=$(echo $mnt | sed 's:/:\\/:g')
awk "\$2 ~ /^$escaped_mnt/ {print \$0}" /proc/mounts | \
local escaped_mnt=$(echo $mnt | sed -e 's:/*$::' -e 's:/:\\/:g')
awk "\$2 ~ /^$escaped_mnt(\/|\$)/ {print \$0}" /proc/mounts | \
sed "s:$mnt:/:g; s: :\t:g" | sed 's:/\+:/:g' | \
while read fs_spec fs_file fs_vfstype fs_mntops fs_freq fs_passno; do
echo -e "$(uuid_or_device $fs_spec)\t${fs_file}\t${fs_vfstype}\t${fs_mntops} ${fs_freq} ${fs_passno}"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment