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:
parent
1d35997222
commit
56e438869c
@ -7,8 +7,8 @@ m4_include(common)
|
|||||||
write_source() {
|
write_source() {
|
||||||
local src=$1 spec= label= uuid= comment=()
|
local src=$1 spec= label= uuid= comment=()
|
||||||
|
|
||||||
label=$(blkid -s LABEL -o value "$1" 2>/dev/null)
|
label=$(lsblk -rno LABEL "$1" 2>/dev/null)
|
||||||
uuid=$(blkid -s UUID -o value "$1" 2>/dev/null)
|
uuid=$(lsblk -rno UUID "$1" 2>/dev/null)
|
||||||
|
|
||||||
# bind mounts do not have a UUID!
|
# bind mounts do not have a UUID!
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ write_source() {
|
|||||||
*)
|
*)
|
||||||
[[ $uuid ]] && comment=("$1" "UUID=$uuid")
|
[[ $uuid ]] && comment=("$1" "UUID=$uuid")
|
||||||
[[ $label ]] && comment+=("LABEL=$label")
|
[[ $label ]] && comment+=("LABEL=$label")
|
||||||
[[ $bytag ]] && spec=$(blkid -s "$bytag" -o value "$1")
|
[[ $bytag ]] && spec=$(lsblk -rno "$bytag" "$1" 2>/dev/null)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user