Use /etc/os-release as first option, translating the distro name to the current identifier used. The other options (the release files) are left as following checks, avoiding them if any matches. --- m4/guestfs_appliance.m4 | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/m4/guestfs_appliance.m4 b/m4/guestfs_appliance.m4 index 8cff51e..b48da74 100644 --- a/m4/guestfs_appliance.m4 +++ b/m4/guestfs_appliance.m4 @@ -94,24 +94,29 @@ dnl names vary slightly across distros. (See dnl appliance/packagelist.in, appliance/excludefiles.in, dnl appliance/hostfiles.in) AC_MSG_CHECKING([which Linux distro for package names]) -DISTRO=REDHAT -if test -f /etc/debian_version; then +if test -f /etc/os-release; then + ( . /etc/os-release && echo $ID | tr '@<:@:lower:@:>@' '@<:@:upper:@:>@' ) >&AS_MESSAGE_LOG_FD + DISTRO="`. /etc/os-release && echo $ID | tr '@<:@:lower:@:>@' '@<:@:upper:@:>@'`" + AS_CASE([$DISTRO], + [FEDORA | RHEL | CENTOS],[DISTRO=REDHAT], + [OPENSUSE | SLED | SLES],[DISTRO=SUSE], + [ARCH],[DISTRO=ARCHLINUX]) +elif test -f /etc/debian_version; then DISTRO=DEBIAN if grep -q 'DISTRIB_ID=Ubuntu' /etc/lsb-release 2>&AS_MESSAGE_LOG_FD; then DISTRO=UBUNTU fi -fi -if test -f /etc/arch-release; then +elif test -f /etc/arch-release; then DISTRO=ARCHLINUX -fi -if test -f /etc/SuSE-release; then +elif test -f /etc/SuSE-release; then DISTRO=SUSE -fi -if test -f /etc/frugalware-release; then +elif test -f /etc/frugalware-release; then DISTRO=FRUGALWARE -fi -if test -f /etc/mageia-release; then +elif test -f /etc/mageia-release; then DISTRO=MAGEIA +else +dnl fallback option + DISTRO=REDHAT fi AC_MSG_RESULT([$DISTRO]) AC_SUBST([DISTRO]) -- 2.7.4 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs