#!/bin/bash shopt -s extglob m4_include(common) write_source() { local src=$1 tag= spec= label= uuid= comment=() label=$(blkid -s LABEL -o value "$1" 2>/dev/null) uuid=$(blkid -s UUID -o value "$1" 2>/dev/null) if (( bylabel )); then tag=LABEL spec=$label comment=("$src" "UUID=$uuid") elif (( byuuid )); then tag=UUID spec=$uuid comment=("$src") if [[ $label ]]; then comment+=("LABEL=$label") fi else [[ $uuid ]] && comment+=("UUID=$uuid") [[ $label ]] && comment+=("LABEL=$label") fi [[ $comment ]] && printf '# %s\n' "${comment[*]}" if [[ $spec ]]; then printf '%-20s' "$tag=$spec" else printf '%-20s' "$(mangle "$src")" fi } usage() { cat <