diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-03-05 10:13:09 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-03-05 10:13:09 +0000 |
commit | c793c904f4b0312b2fcb11c3dc735e4232bc2070 (patch) | |
tree | b0f946fe10f78bddec068738033a04e626bddc00 | |
parent | 96401af08dec8cfd8a9cad3975885746ea89374d (diff) | |
download | alpine-conf-c793c904f4b0312b2fcb11c3dc735e4232bc2070.tar.bz2 alpine-conf-c793c904f4b0312b2fcb11c3dc735e4232bc2070.tar.xz |
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.
-rw-r--r-- | setup-disk.in | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/setup-disk.in b/setup-disk.in index 0f05b74..ca586ba 100644 --- a/setup-disk.in +++ b/setup-disk.in @@ -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}" |