From 18f45dd85c9106cc4efce21b86800748a6fdb1cd Mon Sep 17 00:00:00 2001 From: grmat Date: Tue, 9 Oct 2018 15:38:54 +0200 Subject: [PATCH] genfstab: add support for PARTUUIDs --- genfstab.in | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/genfstab.in b/genfstab.in index 7663522..1067504 100644 --- a/genfstab.in +++ b/genfstab.in @@ -5,10 +5,11 @@ shopt -s extglob m4_include(common) write_source() { - local src=$1 spec= label= uuid= comment=() + local src=$1 spec= label= uuid= partuuid= comment=() label=$(lsblk -rno LABEL "$1" 2>/dev/null) uuid=$(lsblk -rno UUID "$1" 2>/dev/null) + partuuid=$(lsblk -rno PARTUUID "$1" 2>/dev/null) # bind mounts do not have a UUID! @@ -26,8 +27,14 @@ write_source() { comment=("$src") [[ $label ]] && comment+=("LABEL=$(mangle "$label")") ;; + PARTUUID) + spec=$partuuid + comment=("$src") + [[ $label ]] && comment+=("LABEL=$(mangle "$label")") + ;; *) [[ $uuid ]] && comment=("$1" "UUID=$uuid") + [[ $partuuid ]] && comment=("$1" "PARTUUID=$partuuid") [[ $label ]] && comment+=("LABEL=$(mangle "$label")") [[ $bytag ]] && spec=$(lsblk -rno "$bytag" "$1" 2>/dev/null) ;; @@ -85,6 +92,7 @@ usage: ${0##*/} [options] root -P Include pseudofs mounts -t TAG Use TAG for source identifiers -U Use UUIDs for source identifiers (shortcut for -t UUID) + -u Use PARTUUIDs for source identifiers (shortcut for -t PARTUUID) -h Print this help message @@ -99,7 +107,7 @@ if [[ -z $1 || $1 = @(-h|--help) ]]; then exit $(( $# ? 0 : 1 )) fi -while getopts ':f:LPpt:U' flag; do +while getopts ':f:LPpt:Uu' flag; do case $flag in L) bytag=LABEL @@ -107,6 +115,9 @@ while getopts ':f:LPpt:U' flag; do U) bytag=UUID ;; + u) + bytag=PARTUUID + ;; f) prefixfilter=$OPTARG ;; -- 2.19.1