summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 97a16df008bfdd5007d04ca1d6fc9801df8586ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/make -f

%:
	dh $@ --with bash-completion

# On Debian we can use either busybox or busybox-static, but on Ubuntu
# and derivatives only busybox-initramfs will work.
BUSYBOX_PACKAGES := $(shell if dpkg-vendor --derives-from ubuntu; then echo busybox-initramfs; else echo busybox busybox-static; fi)
BUSYBOX_MIN_VERSION := 1:1.22.0-17~

override_dh_gencontrol:
	echo >> debian/initramfs-tools-core.substvars "busybox:Breaks=$(wordlist 2,100,$(BUSYBOX_PACKAGES:%=, % (<< $(BUSYBOX_MIN_VERSION))))"
	echo >> debian/initramfs-tools-core.substvars "busybox:Recommends=$(wordlist 2,100,$(BUSYBOX_PACKAGES:%=| % (>= $(BUSYBOX_MIN_VERSION))))"
	dh_gencontrol

override_dh_install:
	sed -e 's,@BUSYBOX_PACKAGES@,$(wordlist 2,100,$(BUSYBOX_PACKAGES:%=or %)),' \
	    -e 's/@BUSYBOX_MIN_VERSION@/$(BUSYBOX_MIN_VERSION)/' \
		mkinitramfs > debian/initramfs-tools-core/usr/sbin/mkinitramfs
	chmod 755 debian/initramfs-tools-core/usr/sbin/mkinitramfs
	dh_install

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	shellcheck -e SC1090,SC1091 -s dash hook-functions $$(find hooks scripts -type f) $$({ find . -maxdepth 1 -type f -executable; find debian -maxdepth 1 -type f; find docs kernel -type f; } | xargs grep -l '^#!/bin/sh')
endif