#!/bin/bash # Copyright (C) 2010-2023 Pädagogisches Landesinstitut Rheinland-Pfalz # Copyright (C) 2022-2023 Mike Gabriel # Copyright (C) 2022-2023 Daniel Teichmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # postrm script for debian-edu-router-config set -e . /usr/share/debconf/confmodule || exit 255 # prepare debconf export DC_PRIO_LOW="medium" export DC_PRIO_HIGH="high" if [ -e /etc/debian-edu/router.conf ]; then source /etc/debian-edu/router.conf fi PRODUCTNAME="${PRODUCTNAME:-"Debian Edu Router"}" db_title "$PRODUCTNAME" # summary of how this script can be called: # * `remove' # * `purge' # * `upgrade' # * `failed-upgrade' # * `abort-install' # * `abort-install' # * `abort-upgrade' # * `disappear' # # for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package function unmask_dnsmasq_service() { deb-systemd-helper unmask dnsmasq } case "${1}" in 'purge') db_input ${DC_PRIO_HIGH} debian-edu-router-config/purging-warn-remaining-config || true db_go # purge debconf-managed ifupdown config snippets rm -fv /etc/network/interfaces.d/??_d-e-r_* # purge debconf-managed uif config snippets rm -fv /etc/uif/uif.conf.d/??_d-e-r_* rm -fv /etc/uif/uif-ipv4-networks.inc.d/??_d-e-r_* rm -fv /etc/uif/uif-ipv6-networks.inc.d/??_d-e-r_* # purge mdns-reflector related config files rm -fv /etc/mdns-reflector/conf.d/??_d-e-r_* # purge ssh service related config files rm -fv /etc/ssh/sshd_config.d/??_d-e-r_* # if /etc/ssh/sshd_config does not exist we should assume that # openssh-server has never been installed (or purged again). # This might mean that it has been likely us who created # /etc/ssh/sshd_config.d/ (in our postinst script) and thus, we should # remove it again if empty. if [ ! -e "/etc/ssh/sshd_config" ] && [ -d "/etc/ssh/sshd_config.d" ]; then rmdir --ignore-fail-on-non-empty /etc/ssh/sshd_config.d/ rmdir --ignore-fail-on-non-empty /etc/ssh/ fi # purge debconf-managed sysctl config snippet rm -fv /etc/sysctl.d/30-debian-edu-router-config.conf # purge debconf-managed dnsmasq config snippets rm -fv /etc/dnsmasq.d/??_d-e-r_* # if /etc/dnsmasq.conf does not exist we should assume that # dnsmasq has never been installed (or purged again). # This might mean that it has been likely us who created # /etc/dnsmasq.d/ (in our postinst script) and thus, we should # remove it again if empty. if [ ! -e "/etc/dnsmasq.conf" ] && [ -d "/etc/dnsmasq.d" ]; then rmdir --ignore-fail-on-non-empty /etc/dnsmasq.d/ fi unmask_dnsmasq_service rm -fv /etc/debian-edu-router/MANAGED_BY_DEBIAN_EDU_ROUTER rm -fv /etc/debian-edu-router/debug ;; 'remove'|'upgrade'|'failed-upgrade'|'abort-install'|'abort-upgrade'|'disappear') unmask_dnsmasq_service ;; *) 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. # Automatically added by dh_installsystemd/13.24.2 if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then systemctl --system daemon-reload >/dev/null || true fi # End automatically added section # Automatically added by dh_installsystemd/13.24.2 if [ "$1" = "purge" ]; then if [ -x "/usr/bin/deb-systemd-helper" ]; then deb-systemd-helper purge 'dnsmasq_d-e-r.target' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installdebconf/13.24.2 if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then . /usr/share/debconf/confmodule db_purge fi # End automatically added section exit '0'