#!/bin/sh # postinst script for motd-news-config # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-remove' # * `abort-deconfigure' `in-favour' # `removing' # # for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in configure) # only run on new installs, $2 will be empty then if [ -z "$2" ]; then # /e/d/motd-news was moved from pkg:base-files to this package. # base-files runs rm_conffile which, if it was modified, leaves # /e/d/motd-news.dpkg-bak around. We want to preserve that *changed* # config file in this migration, and this is something that # rm_conffile is not handling. In that case, let's put the backup # file back in place if [ -e /etc/default/motd-news.dpkg-bak ]; then mv /etc/default/motd-news.dpkg-bak /etc/default/motd-news fi if [ -e /etc/default/motd-news.wasremoved ] && [ -e /etc/default/motd-news ]; then sed -i -e 's/^ENABLED=1/# Changed by motd-news-config.postinst:\n# config file was manually removed - disable the service\nENABLED=0/' /etc/default/motd-news fi fi rm -f /etc/default/motd-news.wasremoved ;; 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