From 864c0982e2512fbf6637c586b852ac56404d5d95 Mon Sep 17 00:00:00 2001 From: Fco Javier Lopez Perez Date: Tue, 22 Oct 2024 12:34:59 +0200 Subject: [PATCH] Refs #7593 - Debian packaging improved to manage certs using update-ca-certificates really --- debian/rules | 3 -- debian/{install => vn-host.install} | 0 debian/vn-host.postinst | 56 +++++++++++++++++++++++++++++ debian/vn-host.postrm | 48 +++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 3 deletions(-) rename debian/{install => vn-host.install} (100%) create mode 100644 debian/vn-host.postinst create mode 100644 debian/vn-host.postrm diff --git a/debian/rules b/debian/rules index d619713..31c1c17 100755 --- a/debian/rules +++ b/debian/rules @@ -4,6 +4,3 @@ %: dh $@ - -# override_dh_usrlocal to do nothing -override_dh_usrlocal: diff --git a/debian/install b/debian/vn-host.install similarity index 100% rename from debian/install rename to debian/vn-host.install diff --git a/debian/vn-host.postinst b/debian/vn-host.postinst new file mode 100644 index 0000000..b05b67d --- /dev/null +++ b/debian/vn-host.postinst @@ -0,0 +1,56 @@ +#! /bin/sh +# postinst script for vn-host +# +# see: dh_installdeb(1) + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see /usr/share/doc/packaging-manual/ +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +set -e + +CERTS="VerdnaturaCA.crt VerdnaturaIntermediateLab.crt VerdnaturaInformaticaCA.crt" + +CERTSDIR=/usr/share/ca-certificates +VERDNATURACERTSDIR="${CERTSDIR}/verdnatura" +LOCALCERTSDIR=/usr/local/share/ca-certificates +case "$1" in + configure) + # Force install verdnatura certificates from installation directory + # update-ca-certificates only process files in /usr/local/share/ca-certificates + # See lintian-explain-tags dir-in-usr-local for more explain + for certfile in ${CERTS} ; do + ln -s ${VERDNATURACERTSDIR}/${certfile} ${LOCALCERTSDIR} + done + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + diff --git a/debian/vn-host.postrm b/debian/vn-host.postrm new file mode 100644 index 0000000..e62aa54 --- /dev/null +++ b/debian/vn-host.postrm @@ -0,0 +1,48 @@ +#! /bin/sh +# postrm script for vn-host +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' overwrit>r> +# for details, see /usr/share/doc/packaging-manual/ + +# Clear the debconf database as early as possible and signal debconf that +# we are done with it. + + +CERTS="VerdnaturaCA.crt VerdnaturaIntermediateLab.crt VerdnaturaInformaticaCA.crt" + +CERTSDIR=/usr/share/ca-certificates +VERDNATURACERTSDIR="${CERTSDIR}/verdnatura" +LOCALCERTSDIR=/usr/local/share/ca-certificates + +case "$1" in + remove|purge) + for certfile in ${CERTS} ; do + unlink ${LOCALCERTSDIR}/${certfile} 2>/dev/null || true + done + ;; + + upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# +