diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-07-14 18:27:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-07-16 15:11:56 +0000 |
commit | 6197903bd42478987516bc4cc3f0769488a37065 (patch) | |
tree | 508d399340039960289dd1d96696db7c56c22321 /scripts | |
parent | Adding upstream version 1.16. (diff) | |
download | nvme-cli-6197903bd42478987516bc4cc3f0769488a37065.tar.xz nvme-cli-6197903bd42478987516bc4cc3f0769488a37065.zip |
Adding upstream version 2.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/gen-hostnqn.sh | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/scripts/gen-hostnqn.sh b/scripts/gen-hostnqn.sh index 563aa60..3333a86 100644 --- a/scripts/gen-hostnqn.sh +++ b/scripts/gen-hostnqn.sh @@ -1,28 +1,3 @@ -#!/bin/bash +#!/bin/sh -LC_ALL=C - -if [ -e "/proc/device-tree/ibm,partition-uuid" ] ; then - UUID=$(tr -d '\0' < /proc/device-tree/ibm,partition-uuid) -else - UUID=$(dmidecode -s system-uuid | tr -d '[:space:]') -fi - -if [ -z "$UUID" ] ; then - >&2 echo "No UUID found, can't determine hostnqn." - exit 1 -fi - -# convert UUID to lower-case only: -UUID=$(echo $UUID | tr '[:upper:]' '[:lower:]') - -# check UUID format, e.g.: 4c4c4544-0156-4a10-8134-b7d04f383232, so: 8-4-4-4-12 -if ! [[ $UUID =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ ]] ; then - >&2 echo "UUID has invalid format." - >&2 echo "Invalid UUID: ${UUID}" - exit 2 -fi - -HOSTNQN="nqn.2014-08.org.nvmexpress:uuid:${UUID}" - -echo $HOSTNQN +nvme gen-hostnqn |