genfstab: prefer lsblk over blkid

lsblk has a far nicer interface and is capable of doing its work
without the need for extra privileges to read superblocks (assuming
udev is behaving properly).
This commit is contained in:
Dave Reisner 2013-05-23 13:20:56 -04:00
parent 1d35997222
commit 56e438869c

View File

@ -7,8 +7,8 @@ m4_include(common)
write_source() {
local src=$1 spec= label= uuid= comment=()
label=$(blkid -s LABEL -o value "$1" 2>/dev/null)
uuid=$(blkid -s UUID -o value "$1" 2>/dev/null)
label=$(lsblk -rno LABEL "$1" 2>/dev/null)
uuid=$(lsblk -rno UUID "$1" 2>/dev/null)
# bind mounts do not have a UUID!
@ -29,7 +29,7 @@ write_source() {
*)
[[ $uuid ]] && comment=("$1" "UUID=$uuid")
[[ $label ]] && comment+=("LABEL=$label")
[[ $bytag ]] && spec=$(blkid -s "$bytag" -o value "$1")
[[ $bytag ]] && spec=$(lsblk -rno "$bytag" "$1" 2>/dev/null)
;;
esac