From bf7d580622e294c71a248e31ab9c87cc026572a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Mon, 25 Jan 2021 21:48:51 +0100 Subject: [PATCH] package-managers: improve DIST detection --- package-managers/Makefile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/package-managers/Makefile b/package-managers/Makefile index e282082..34ccebc 100644 --- a/package-managers/Makefile +++ b/package-managers/Makefile @@ -11,7 +11,21 @@ YUMCONFDIR = $(SYSCONFDIR)/yum.conf.d QUBESLIBDIR = $(LIBDIR)/qubes QUBESSTATEDIR = $(STATEDIR)/qubes -DIST ?= fc18 +ifneq (,$(wildcard /etc/fedora-release)) +DIST = fc$(shell rpm --eval %{fedora}) +else ifneq (,$(wildcard /etc/os-release)) +DIST = $(shell grep VERSION_CODENAME= /etc/os-release | cut -d'=' -f2) +endif + +ifeq (,$(DIST)) +# On debian if previous attempt failed +# it means we are on sid +ifneq (,$(wildcard /etc/debian_version)) +DIST = $(shell cut -d'/' -f1 /etc/debian_version) +endif +endif + +DIST ?= fc33 .PHONY: install install-apt install-dnf install-rpm install-yum @@ -25,7 +39,7 @@ install: install-apt: install -d $(DESTDIR)$(APTCONFDIR)/sources.list.d - sed -e "s/@DIST@/`lsb_release -cs`/" apt-qubes-r4.list.in \ + sed "s/@DIST@/$(DIST)/" apt-qubes-r4.list.in \ > $(DESTDIR)$(APTCONFDIR)/sources.list.d/qubes-r4.list install -D -m 0644 apt-qubes-archive-keyring.gpg \ $(DESTDIR)$(APTCONFDIR)/trusted.gpg.d/qubes-archive-keyring.gpg