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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#!/usr/bin/make -f
# -*- makefile -*-
include /usr/share/dpkg/pkg-info.mk
# Something larger than what we have in unstable
GNU_COREUTILS_VERSION := 9.7-999
%:
dh $@
update-links:
# gnu-coreutils we take everything
dpkg -L gnu-coreutils | sed s#^/## | grep -E '(man.|bin)/gnu' | sort -u | while read x; do echo $$x $$(echo $$x | sed s#/gnu#/#); done > debian/coreutils-from-gnu.links
# rust-coreutils we take everything too, except more
( coreutils --list | sed 's#^#usr/bin/coreutils usr/bin/#' ; \
dpkg -L rust-coreutils | sed s#^/## | grep -E 'man./rust-' | sort -u | while read x; do echo $$x $$(echo $$x | sed s#/rust-#/#); done ) | grep -vE '/(more|kill|hostname|uptime)' > debian/coreutils-from-uutils.links
# [ usually has no manual page, we need to add one
echo usr/share/man/man1/gnutest.1.gz usr/share/man/man1/[.1.gz >> debian/coreutils-from-gnu.links
echo usr/share/man/man1/rust-test.1.gz usr/share/man/man1/[.1.gz >> debian/coreutils-from-uutils.links
# We limit busybox and toybox to the ones allowed by gnu and rust-coreutils
sed -nr 's#.*bin/([^/]*)$$#\1#gp' debian/coreutils-from-gnu.links debian/coreutils-from-uutils.links | sort -u > debian/real-coreutils.list
busybox --list > debian/busybox.list
comm -12 debian/real-coreutils.list debian/busybox.list | sed 's#^#usr/bin/busybox usr/bin/#' > debian/coreutils-from-busybox.links
toybox | tr ' ' '\n' | sort > debian/toybox.list
comm -12 debian/real-coreutils.list debian/toybox.list | sed 's#^#usr/bin/toybox usr/bin/#' > debian/coreutils-from-toybox.links
rm debian/*.list
execute_before_dh_clean:
rm -f debian/*.pre* debian/*.post*
execute_before_dh_installdeb:
for package in coreutils-from-uutils coreutils-from-busybox coreutils-from-gnu coreutils-from-toybox; do \
for script in preinst prerm; do \
sed "s/@PACKAGE@/$$package/;s/@UTILS@/`awk -F/ '{print $$NF}' debian/$$package.links | xargs`/g" debian/$$script.in > debian/$$package.$$script; \
done; \
done
override_dh_gencontrol:
# Bump the version for coreutils so that upgrades are possible
dh_gencontrol -pcoreutils -- -v$(GNU_COREUTILS_VERSION)+$(DEB_VERSION)
dh_gencontrol --remaining-packages -- -Vcoreutils:Version=$(GNU_COREUTILS_VERSION)+$(DEB_VERSION)
|