El 29/03/16 a las 21:55, Santiago Vila escribió:
> On Tue, Mar 29, 2016 at 05:13:51PM +0200, Santiago Ruano Rincón wrote:
> >  #!/usr/bin/make -f
> >  
> > -DEBIAN_VERSION ?= $(shell LANG=C dpkg -l base-files | awk 
> > '($$1=="ii"){print $$3}' | cut -d. -f1)
> > +DEBIAN_VERSION ?= $(shell LANG=C dpkg -l base-files | awk 
> > '($$1=="ii"){print $$3}' | cut -d. -f1 | cut -d+ -f1)
> 
> Hello tocayo.
> 
> This is not ok (neither the original or the patched version). The fact
> that base-files numbering happens to match Debian stable releases
> until now is not enough to use its version number to guess Debian
> version number.
> 
> Please do it right and use /etc/debian_version or /etc/os-release
> instead.

Hi tocayo,

What about this?

diff --git a/debian/rules b/debian/rules
index 10e034a..3fefda0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,6 +1,11 @@
 #!/usr/bin/make -f
 
-DEBIAN_VERSION ?= $(shell LANG=C dpkg -l base-files | awk '($$1=="ii"){print 
$$3}' | cut -d. -f1 | cut -d+ -f1)
+NEXT_VERSION_ID=$(shell ls -w1 ./security-support-ended.deb* | sort -n | tail 
-n1 | awk -F "deb" '{print $$2}')
+
+DEBIAN_VERSION ?= $(shell cat /etc/debian_version | grep '[0-9.]' | cut -d. 
-f1)
+ifeq (,$(DEBIAN_VERSION))
+  DEBIAN_VERSION=$(NEXT_VERSION_ID)
+endif
 
 %:
        dh $@

Thanks,

Santiago

Attachment: signature.asc
Description: PGP signature

Reply via email to