From 4418e6345ab73d8a395449ce7e7dc6df2955ea70 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 21 May 2022 17:19:54 +0100 Subject: [PATCH] appliance: Error out if QUERY_FILES_CMD cannot be set Instead of continuing on regardless and failing with a weird error later, error out early if we don't know about the distro and so cannot set QUERY_FILES_CMD. This avoids situations like https://github.com/libguestfs/libguestfs/issues/81 --- appliance/Makefile.am | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/appliance/Makefile.am b/appliance/Makefile.am index 9a0ba98a0..580f38285 100644 --- a/appliance/Makefile.am +++ b/appliance/Makefile.am @@ -79,16 +79,19 @@ make.sh: make.sh.in $(top_builddir)/config.log $(top_builddir)/config.status PACKAGELIST_CPP_FLAGS = -D$(DISTRO)=1 -DEXTRA_PACKAGES="$(EXTRA_PACKAGES)" - if HAVE_RPM QUERY_FILES_CMD := xargs rpm -qf --qf '%{name}\n' -endif +else if HAVE_DPKG QUERY_FILES_CMD := sed -e 's,^/,\*/,' | xargs dpkg -S | cut -d: -f1 -endif +else if HAVE_PACMAN QUERY_FILES_CMD := xargs pacman -Qo | sed -r 's/.* is owned by ([^ ]+) .*/\1/' -endif +else +$(error Error: Unknown Linux distribution "$(DISTRO)". Please add support to m4/guestfs-appliance.m4 and appliance/Makefile.am and send a patch upstream to libguestfs@redhat.com) +endif !HAVE_PACMAN +endif !HAVE_DPKG +endif !HAVE_RPM # Automatically generate library dependency list guestfsd.deps: ../daemon/guestfsd