4 PATHDB=$(/usr/lib/news/bin/innconfval pathdb)
5 if [ -z "$PATHDB" ]; then
6 echo "Cannot determine the database path, aborting."
12 if [ -e /usr/share/doc/inn2-lfs/ ]; then
16 for file in active newsgroups; do
17 if [ ! -f $file ]; then
18 echo "Installing initial content for $PATHDB/$file"
19 install -m 644 -o news -g news \
20 /usr/share/doc/$package/examples/$file .
24 if [ ! -f history.dir ]; then
25 echo -n "Building history database in $PATHDB... "
26 if ! /usr/lib/news/bin/makehistory; then
30 if ! /usr/lib/news/bin/makedbz -i -o -s 300000; then
34 chown news:news history*
39 if [ ! -f active.times ]; then
41 chown news:news active.times
42 chmod 644 active.times
45 # squelch initial noise in email if this isn't present
46 if [ ! -f .news.daily ]; then
48 chown news:news .news.daily
51 # make sure typical log files exist, and can be rotated
52 if [ ! -d /var/log/news ]; then
53 install -d -m 775 -o news -g news /var/log/news
56 [ -f news.notice ] || touch news.crit news.err news.notice
57 chown news:news . OLD path news.crit news.err news.notice
59 if [ -x /etc/init.d/inn2 ]; then
60 update-rc.d inn2 defaults > /dev/null
64 check_usenet_alias() {
65 # must have an alias for user usenet, point it to root by default
66 if [ -f /etc/aliases ] && ! grep -q '^usenet:' /etc/aliases \
67 && ! getent passwd usenet; then
68 echo "Adding alias for pseudo-user usenet to /etc/aliases."
69 echo "usenet: root" >> /etc/aliases
70 [ -x /usr/bin/newaliases ] && /usr/bin/newaliases
76 if [ "$2" ] && dpkg --compare-versions "$2" lt "2.3.999+20030125-1"; then
77 /usr/lib/news/bin/innupgrade -f inn.conf
81 rebuild_history_index() {
82 [ -f /var/lib/news/must-rebuild-history-index ] || return 0
85 HLINES=$(tail -1 history.dir | awk '{ print $1 }')
86 [ "$HLINES" ] || HLINES=1000000
87 echo "Rebuilding the history index for $HLINES lines, please wait..."
88 rm history.hash history.index history.dir
89 su news -c "/usr/lib/news/bin/makedbz -s $HLINES -f history"
91 rm /var/lib/news/must-rebuild-history-index
95 [ -f /var/lib/news/must-rebuild-overview ] || return 0
97 OVENABLED=$(/usr/lib/news/bin/innconfval enableoverview)
98 if [ -z "$OVENABLED" ]; then
99 echo "Cannot determine the overview method used, stopping."
102 if [ $OVENABLED = no -o $OVENABLED = false ]; then
106 OVMETHOD=$(/usr/lib/news/bin/innconfval ovmethod)
107 if [ -z "$OVMETHOD" ]; then
108 echo "Cannot determine the overview method used, stopping."
110 elif [ $OVMETHOD = tradindexed -o $OVMETHOD = ovdb ]; then
111 OVPATH=$(/usr/lib/news/bin/innconfval pathoverview)
112 if [ -z "$OVPATH" ]; then
113 echo "Cannot determine the overview path, aborting."
116 echo "Deleting the old overview database, please wait..."
117 find $OVPATH -type f -not -name DB_CONFIG -print0 | xargs -0 -r rm -f
118 elif [ $OVMETHOD = buffindexed ]; then
119 echo "Deleting the old overview database, please wait..."
120 awk -F : '/^[0-9]/ { print $2 }' < /etc/news/buffindexed.conf | \
121 while read name size; do
122 dd if=/dev/zero of="$name" bs=1024 count="$size"
125 echo "Unknown overview method '$OVMETHOD', aborting."
129 echo "Rebuilding the overview database, please wait..."
130 su news -c "/usr/lib/news/bin/makehistory -F -O -x"
132 rm /var/lib/news/must-rebuild-overview
136 # make sure we can determine the FQDN, since innd won't launch if we can't
137 if hostname --fqdn > /dev/null 2>&1; then
138 invoke-rc.d inn2 start || echo "Could not start INN!"
143 Not starting innd. The daemon needs to be able to determine the name of
144 this machine, and your /etc/hosts and/or DNS config is apparently not
145 allowing this to happen. After you have fixed things so that 'hostname
146 --fqdn' returns a reasonable value, you can start the daemon by running
147 '/etc/init.d/inn2 start'.
158 upgrade_inn_conf "$@"
159 rebuild_history_index
161 if [ -z "$2" -o ! -e /var/run/news/innd.pid ]; then # first install
164 ctlinnd -t 20 throttle "upgrade" > /dev/null || true
165 ctlinnd -t 20 xexec inndstart > /dev/null \
166 || echo "Could not restart INN!"
170 abort-upgrade|abort-remove|abort-deconfigure)
174 echo "postinst called with unknown argument '$1'" >&2