summaryrefslogblamecommitdiff
path: root/resteasy/libexec/resteasy-find-uuid
blob: 331d10a2d87d2ada708994d15a359989b04ad3ec (plain) (tree)





















                                                                                                                                  
#!/bin/bash
USAGE=""

# shellcheck source=resteasy-helper.sh
source "$(resteasy --exec-path)/resteasy-helper.sh"

set -o errexit
set -o nounset

[[ "$#" -eq 0 ]] || die_with_usage "too many arguments"

mapfile -t uuids < <(lsblk \
    --noheadings \
    --list \
    --output PARTTYPE,PARTUUID \
    | grep "$RESTEASY_TYPE_UUID" \
    | cut -d' ' -f 2)

[[ ${#uuids[@]} -gt 0 ]] || die "no resteasy device found"
[[ ${#uuids[@]} -lt 2 ]] || die "more than one resteasy devices found; this command only supports one device plugged in at a time"

echo "${uuids[0]}"