#!/bin/bash # # Target dist: Debian Stretch DIST=stretch if [ ! -d ../../pkg/deb ] ; then echo "script needs to be executed at pkg/deb dir" >&2 exit 1 fi rm -rf ${DIST} cp -r debian ${DIST} # dkms stuff (see MT#56627) cp old-dkms/rtpengine-kernel-dkms.postinst "${DIST}"/ cp old-dkms/rtpengine-kernel-dkms.prerm "${DIST}"/ cp old-dkms/dkms.conf.in "${DIST}"/ rm -f "${DIST}"/rtpengine-kernel-dkms.install "${DIST}"/rtpengine-kernel-dkms.dkms sed -i '/ngcp-rtpengine source:/d' "${DIST}"/source/lintian-overrides sed -i '1n;/^Package: rtpengine-kernel-dkms/,/^Depends:/{ s/Depends:/Depends:\n dkms (>= 1.95),/;}' "${DIST}"/control sed -i '/^ dh-sequence-dkms,/d' "${DIST}"/control sed -i '/^Testsuite: autopkgtest-pkg-dkms/d' "${DIST}"/control sed -i '/^override_dh_dkms/d' "${DIST}"/rules sed -i '/dh_dkms /d' "${DIST}"/rules sed -i '/^export DEB_VERSION_UPSTREAM/d' "${DIST}"/rules sed -i '/^export DEB_SOURCE/d' "${DIST}"/rules sed -i 's;^include /usr/share/dpkg/pkg-info.mk;include /usr/share/dpkg/pkg-info.mk\ ## kernel package specific stuff\ # Name of the dkms package\ pdkms:=rtpengine-kernel-dkms\ # short upstream name, used for module source directory\ sname:=rtpengine\ # Source version\ sversion:=$(DEB_VERSION_UPSTREAM)\ ## end of kernel package specific stuff\ ;' "${DIST}"/rules sed -i 's;^execute_before_dh_auto_install-indep:;execute_before_dh_auto_install-indep:\ \t# Create the directories to install the source into\ \tdh_installdirs -p$(pdkms) usr/src/$(sname)-$(sversion)\ \t# Copy only the driver source to the proper locations\ \tcd kernel-module \&\& cp Makefile *.c *.h ../debian/$(pdkms)/usr/src/$(sname)-$(sversion)\ \t# Prepare dkms.conf from the dkms.conf.in template\ \tsed "s/__VERSION__/$(sversion)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(sname)-$(sversion)/dkms.conf\ ;' "${DIST}"/rules # No libbcg729-dev package sed -i -e '/libbcg729-dev/d' ${DIST}/control # Update for stretch debhelper echo 10 > ${DIST}/compat sed -i -e 's/debhelper-compat.*/debhelper (>= 10),/' ${DIST}/control # Compat level for dkms module package sed -i -e '/cp debian.control/ i \ cp debian/compat debian/\$(psource)/usr/src/modules/\$(sname)/debian/' ${DIST}/rules # Replace execute_* hooks with old-style overrides sed -i -e 's/^execute_before_dh_auto_configure:/override_dh_auto_configure:/' ${DIST}/rules sed -i -e 's/^execute_after_dh_installsystemd:/override_dh_installsystemd:\n\tdh_installsystemd/' ${DIST}/rules sed -i -e 's/^execute_before_dh_auto_install-indep:/override_dh_auto_install-indep:/' ${DIST}/rules sed -i -e '/^\tgzip -9 < README.md/a\\n\tdh_auto_install' ${DIST}/rules # Remove bottom make rules sed -i -e '/^override_dh_installsystemd/,/^\n/d' ${DIST}/rules # ... and replace with: cat >> ${DIST}/rules <<'EOF' override_dh_systemd_enable: dh_systemd_enable dh_systemd_enable -prtpengine-recording-daemon --name=rtpengine-recording-nfs-mount override_dh_systemd_start: dh_systemd_start dh_systemd_start -prtpengine-recording-daemon --name=rtpengine-recording-nfs-mount EOF # Fix module installation location rm ${DIST}/rtpengine-iptables.dirs rm ${DIST}/rtpengine-iptables.install cat >> ${DIST}/rules <<'EOF' override_dh_install: dh_install dh_installdirs -prtpengine-iptables $(XTABLES_DIR) rm -f debian/tmp/$(XTABLES_DIR)/libxt_RTPENGINE.so install -m 0644 iptables-extension/libxt_RTPENGINE.so debian/rtpengine-iptables/$(XTABLES_DIR) EOF # Fix man page install fragments sed -i -e 's,^usr/share/man/man./,daemon/,' ${DIST}/rtpengine-daemon.manpages sed -i -e 's,^usr/share/man/man./,recording-daemon/,' ${DIST}/rtpengine-recording-daemon.manpages sed -i -e 's,^usr/share/man/man./,utils/,' ${DIST}/rtpengine-utils.manpages if command -v wrap-and-sort &>/dev/null ; then wrap-and-sort -sat -d ${DIST} else echo "WARN: wrap-and-sort (Debian package devscripts) not available." fi # clean backports scripts rm -rf ${DIST}/backports exit 0