#!/usr/bin/make -f #export DH_VERBOSE=1 export DEB_BUILD_MAINT_OPTIONS = hardening=+all CONTRIB_EXAMPLES = debian/mrtg-contrib/usr/share/doc/mrtg-contrib/examples/contrib %: dh $@ override_dh_clean: dh_clean # Revert changes in hashbangs after building for i in cfgmaker indexmaker mrtg; do \ sed -i 's/#! \/usr\/bin\/perl -w/#! \/home\/oetiker\/.plenv\/shims\/perl -w/' bin/$$i; \ done # Using *-indep to avoid issues when building arch dependent binary only override_dh_install-indep: dh_install # xlsummary depends on non-free software. See #293641. rm -rf $(CONTRIB_EXAMPLES)/xlsummary # Removing extra licensing files find $(CONTRIB_EXAMPLES) -name COPYING -exec rm -f {} \; # Fix hashbangs: c:\perl\bin egrep -sri '#!c:\\perl\\bin' $(CONTRIB_EXAMPLES) | cut -d: -f1 | \ xargs sed -i 's/#!c:\\perl\\bin/#!\/usr\/bin\/perl/' # Fix hashbangs: /usr/bin/ksh egrep -sri '#!/usr/bin/ksh' $(CONTRIB_EXAMPLES) | cut -d: -f1 | \ xargs sed -i 's/#!\/usr\/bin\/ksh/#!\/bin\/ksh/' # Fix all Unixes hashbangs with 'perl' egrep -sr '^#!\/[a-z/]+perl[0-9]?' $(CONTRIB_EXAMPLES) | cut -d: -f1 | \ xargs sed -i 's/^#!\/[a-z/]\+perl[0-9]\?/#!\/usr\/bin\/perl/' # Fix specific hashbang with 'perl' egrep -sr '^#! /pkg/gnu/bin/perl' $(CONTRIB_EXAMPLES) | cut -d: -f1 | \ xargs sed -i 's/^#!\ \/pkg\/gnu\/bin\/perl/#!\/usr\/bin\/perl/' # Convert all files to Unix EOL style find $(CONTRIB_EXAMPLES) -type f -exec dos2unix -q {} \; # Create symlinks for duplicate files jdupes -rl $(CONTRIB_EXAMPLES) override_dh_fixperms-indep: # There are several examples with wrong permissions for Unix, so # changing all regular files to 644 is a good idea because they are # examples only. Note that dh_fixperms will change some permissions # again. find $(CONTRIB_EXAMPLES) -type f -exec chmod 644 {} \; dh_fixperms override_dh_compress-indep: dh_compress -Xexamples/