This file is indexed.

postinst is in inn2 2.5.3-3ubuntu1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/sh -e

init_inn_files() {
    PATHDB=$(/usr/lib/news/bin/innconfval pathdb)
    if [ -z "$PATHDB" ]; then
	echo "Cannot determine the database path, aborting."
	exit 1
    fi
    cd $PATHDB

    local package='inn2'
    if [ -e /usr/share/doc/inn2-lfs/ ]; then
      package='inn2-lfs'
    fi
      
    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/share/doc/$package/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.5.2+20110413-1; then
  if dpkg --compare-versions $2 lt 2.3.999+20030125-1; then
    /usr/lib/news/bin/innupgrade -f /etc/news/inn.conf
  fi
    /usr/lib/news/bin/innupgrade /etc/news/
  fi
}

rebuild_history_index() {
    [ -f /var/lib/news/must-rebuild-history-index ] || return 0

    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

    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 <<END


Not starting innd.  The daemon needs to be able to determine the name of
this machine, and your /etc/hosts and/or DNS config is apparently not
allowing this to happen.  After you have fixed things so that 'hostname
--fqdn' returns a reasonable value, you can start the daemon by running
'/etc/init.d/inn2 start'.


END
fi
}

# #690128: if the old MOTD file has been amended by the admin from default,
# then copy it to the new non-conffile nnrpd MOTD file.
# If not then remove the old MOTD conffile, being sure to cater for rollback.
if [ "$1" = "configure" -a "$2" ] &&
        dpkg --compare-versions "$2" le-nl "2.5.3-1~"; then
    if [ -e /etc/news/motd.news.dpkg-backup -a ! -e /etc/news/motd.nnrpd ]; then
        echo "Renaming modified conffile /etc/news/motd.news to /etc/news/motd.nnrpd."
        mv /etc/news/motd.news.dpkg-backup /etc/news/motd.nnrpd
    fi
fi
dpkg-maintscript-helper rm_conffile /etc/news/motd.news 2.5.3-1~ -- "$@"

case "$1" in
    configure)
    init_inn_files
    check_usenet_alias
    upgrade_inn_conf "$@"
    rebuild_history_index
    rebuild_overview
    if [ -z "$2" -o ! -e /var/run/news/innd.pid ]; then # first install
	start_innd
    else
	ctlinnd -t 20 throttle "upgrade" > /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
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
    echo "postinst called with unknown argument '$1'" >&2
    ;;
esac



exit 0