[ovs-dev] [PATCH] ovs-ctl: support populating system info from /etc/os-release

Panu Matilainen pmatilai at redhat.com
Wed Aug 10 11:16:14 UTC 2016


On systemd-era hosts, OS name and version are available in sanitized
format from /etc/os-release(5) without resorting to calling (and thus
requiring) lsb_release. Support populating system-type and system-version
from /etc/os-release, prefer it over lsb_release, but permit overriding
via the OVS-specific system-type.conf and system-version.conf.

Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1350550
Signed-off-by: Panu Matilainen <pmatilai at redhat.com>
---
 utilities/ovs-ctl.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index d92cf3c..ff3eaf2 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -522,6 +522,9 @@ set_defaults () {
     if test -e "$type_file" ; then
         SYSTEM_TYPE=`cat $type_file`
         SYSTEM_VERSION=`cat $version_file`
+    elif test -e "@sysconfdir@/os-release"; then
+        SYSTEM_TYPE=`awk -F= '/^ID=/{print $2}' @sysconfdir@/os-release`
+        SYSTEM_VERSION=`awk -F= '/^VERSION_ID=/{print $2}' @sysconfdir@/os-release`
     elif (lsb_release --id) >/dev/null 2>&1; then
         SYSTEM_TYPE=`lsb_release --id -s`
         system_release=`lsb_release --release -s`
-- 
2.5.5




More information about the dev mailing list