+# Extract the server-side /etc/os-release information into local variables
+# usage: lustre_os_release <facet>
+# generates $facet_OS_ID, $facet_OS_ID_LIKE, $facet_VERSION_ID
+# and also $facet_OS_VERSION_CODE=$(version_code $facet_VERSION_ID)
+lustre_os_release() {
+ local action=${1:-echo}
+ local facet=$2
+ local FACET_OS=$(tr "[:lower:]" "[:upper:]" <<<$facet)_OS_
+
+ [[ "$action" == "echo" ]] &&
+ echo "$facet: $(do_facet $facet "cat /etc/system-release")"
+ do_facet $facet "[[ -r /etc/os-release ]] || ls -s /etc/*release" 1>&2
+
+ while read LINE; do
+ case $LINE in
+ VERSION_ID=*|ID=*|ID_LIKE=*) $action ${FACET_OS}$LINE ;;
+ esac
+ done < <(do_facet $facet "cat /etc/os-release")
+
+ [[ "$action" == "echo" ]] && return 0
+
+ local facet_version=${FACET_OS}VERSION
+ $action ${facet_version}_CODE=\$\(version_code \$${facet_version}_ID\)
+}
+