#!/bin/sh -e init_inn_files() { PATHDB='/var/lib/news' if [ ! -d "$PATHDB" ]; then PATHDB="$(/usr/lib/news/bin/innconfval pathdb)" fi if [ -z "$PATHDB" ]; then echo "Cannot determine the database path, aborting." exit 1 fi cd $PATHDB for file in active newsgroups; do if [ ! -f $file ]; then echo "Installing initial content for $PATHDB/$file" install -m 644 -o news -g news \ /usr/lib/news/examples/$file . fi done if [ ! -f history.dir ]; then echo -n "Building history database in $PATHDB... " if ! /usr/lib/news/bin/makehistory; then echo "failed!" return fi if ! /usr/lib/news/bin/makedbz -i -o -s 300000; then echo "failed!" return fi chown news:news history* chmod 664 history* echo "done." fi if [ ! -f active.times ]; then touch active.times chown news:news active.times chmod 644 active.times fi # squelch initial noise in email if this isn't present if [ ! -f .news.daily ]; then touch .news.daily chown news:news .news.daily fi # make sure typical log files exist, and can be rotated if [ ! -d /var/log/news ]; then install -d -m 775 -o news -g news /var/log/news fi cd /var/log/news [ -f news.notice ] || touch news.crit news.err news.notice chown news:news . OLD path news.crit news.err news.notice if [ -x /etc/init.d/inn2 ]; then update-rc.d inn2 defaults > /dev/null fi } check_usenet_alias() { # must have an alias for user usenet, point it to root by default if [ -f /etc/aliases ] && ! grep -q '^usenet:' /etc/aliases \ && ! getent passwd usenet > /dev/null; then echo "Adding alias for pseudo-user usenet to /etc/aliases." echo "usenet: root" >> /etc/aliases if command -v newaliases > /dev/null; then newaliases; fi fi } upgrade_inn_conf() { [ "$2" ] || return 0 if dpkg --compare-versions $2 lt 2.6.0-1; then /usr/lib/news/bin/innupgrade -f /etc/news/inn.conf fi } rebuild_history_index() { [ -f /var/lib/news/must-rebuild-history-index ] || return 0 invoke-rc.d inn2 stop cd /var/lib/news HLINES=$(tail -1 history.dir | awk '{ print $1 }') [ "$HLINES" ] || HLINES=1000000 echo "Rebuilding the history index for $HLINES lines, please wait..." rm history.hash history.index history.dir su news -s /bin/sh -c "/usr/lib/news/bin/makedbz -s $HLINES -f history" rm /var/lib/news/must-rebuild-history-index } rebuild_overview() { [ -f /var/lib/news/must-rebuild-overview ] || return 0 invoke-rc.d inn2 stop OVENABLED=$(/usr/lib/news/bin/innconfval enableoverview) if [ -z "$OVENABLED" ]; then echo "Cannot determine the overview method used, stopping." exit 1 fi if [ $OVENABLED = no -o $OVENABLED = false ]; then return 0 fi OVMETHOD=$(/usr/lib/news/bin/innconfval ovmethod) if [ -z "$OVMETHOD" ]; then echo "Cannot determine the overview method used, stopping." exit 1 elif [ $OVMETHOD = tradindexed -o $OVMETHOD = ovdb ]; then OVPATH=$(/usr/lib/news/bin/innconfval pathoverview) if [ -z "$OVPATH" ]; then echo "Cannot determine the overview path, aborting." exit 1 fi echo "Deleting the old overview database, please wait..." find $OVPATH -type f -not -name DB_CONFIG -print0 | xargs -0 -r rm -f elif [ $OVMETHOD = buffindexed ]; then echo "Deleting the old overview database, please wait..." awk -F : '/^[0-9]/ { print $2 }' < /etc/news/buffindexed.conf | \ while read name size; do dd if=/dev/zero of="$name" bs=1024 count="$size" done else echo "Unknown overview method '$OVMETHOD', aborting." exit 1 fi echo "Rebuilding the overview database, please wait..." su news -s /bin/sh -c "/usr/lib/news/bin/makehistory -F -O -x" rm /var/lib/news/must-rebuild-overview } start_innd() { # make sure we can determine the FQDN, since innd won't launch if we can't if hostname --fqdn > /dev/null 2>&1; then invoke-rc.d inn2 start || echo "Could not start INN!" else cat < /dev/null || true ctlinnd -t 20 xexec innd > /dev/null \ || { invoke-rc.d inn2 stop && invoke-rc.d inn2 start; } \ || echo "Could not restart INN!" fi ;; esac # Automatically added by dh_installtmpfiles/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -x "$(command -v systemd-tmpfiles)" ]; then systemd-tmpfiles ${DPKG_ROOT:+--root="$DPKG_ROOT"} --create inn2.conf || true fi fi # End automatically added section # Automatically added by dh_installdeb/13.24.2 dpkg-maintscript-helper rm_conffile /etc/news/motd.news 2.5.3-1\~ -- "$@" dpkg-maintscript-helper rm_conffile /etc/news/radius.conf 2.6.1-3\~ -- "$@" # End automatically added section # Automatically added by dh_installsystemd/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'inn2.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet was-enabled 'inn2.service'; then # Enables the unit on first installation, creates new # symlinks on upgrades if the unit file has changed. deb-systemd-helper enable 'inn2.service' >/dev/null || true else # Update the statefile to add new symlinks (if any), which need to be # cleaned up on purge. Also remove old symlinks. deb-systemd-helper update-state 'inn2.service' >/dev/null || true fi fi # End automatically added section # Automatically added by dh_installsystemd/13.24.2 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true deb-systemd-invoke start 'inn2.service' >/dev/null || true fi fi # End automatically added section exit 0