summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2017-01-24 22:02:15 +0100
committerNicolas Dechesne <nicolas.dechesne@linaro.org>2017-01-25 12:35:23 +0100
commit14c77d935aa059e9cad906f996885c163ed17f3f (patch)
tree72df8c55a031d67c85f66fc31c2db4c654fbca4f
parentc4c736ab2c4d19b08bc4434c74f0367f7449bfa6 (diff)
automated: sh-test-lib: add support for /etc/os-release file
/etc/os-release is a standard file in most distro now, [1] and [2]. Let's use it as the default mechanism to detect the distro at run time, and keep the old mechanisms as fallback. Also * defines 'oe-based' name for any known OE based releases, so that we can adapt test cases accordingly. * convert the ID name found in /etc/os-release into the one we used to have in lsb_release (e.g. Ubuntu vs ubuntu, ... ). [1] https://www.freedesktop.org/software/systemd/man/os-release.html [2] http://0pointer.de/blog/projects/os-release.html Change-Id: I1c9e11b449f8532450c8343bc29eb0aeec58c229 Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
-rwxr-xr-xautomated/lib/sh-test-lib13
1 files changed, 12 insertions, 1 deletions
diff --git a/automated/lib/sh-test-lib b/automated/lib/sh-test-lib
index 39b65cd..32c481f 100755
--- a/automated/lib/sh-test-lib
+++ b/automated/lib/sh-test-lib
@@ -151,7 +151,10 @@ detect_abi() {
}
dist_name() {
- if [ -x /usr/bin/lsb_release ]; then
+ if [ -f /etc/os-release ]; then
+ # shellcheck disable=SC1091
+ dist=$(. /etc/os-release && echo "${ID}")
+ elif [ -x /usr/bin/lsb_release ]; then
dist="$(lsb_release -si)"
elif [ -f /etc/lsb-release ]; then
# shellcheck disable=SC1091
@@ -166,6 +169,14 @@ dist_name() {
dist="Unknown"
warn_msg "Unsupported distro: cannot determine distribution name"
fi
+
+ case "${dist}" in
+ debian) dist="Debian" ;;
+ ubuntu) dist="Ubuntu" ;;
+ fedora) dist="Fedora" ;;
+ centos) dist="CentOS" ;;
+ rpb|rpb-wayland|rpb-eglfs) dist="oe-based" ;;
+ esac
}
install_deps() {