postinst is in ntop 3:4.1.0+dfsg1-1.
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 | #! /bin/sh
#
# Copyright 2001,2002 by Dennis Schoen <ds@teuto.net>
#
# 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., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA.
set -e
# Source debconf library
. /usr/share/debconf/confmodule
# Get ntop user
db_get ntop/user
USER=$RET
INITCFG=/var/lib/ntop/init.cfg
db_get ntop/interfaces
INTERFACES=$RET
logdir=/var/log/ntop
libdir=/var/lib/ntop
# Create the log dir
if ! [ -d "$logdir" ]; then
mkdir -p "$logdir"
fi
# avoid logrotate errors if the ntop package is removed without even starting
# ntop (see bug #602890)
touch $logdir/access.log
chown -f root:root "$libdir"
chown -f root:root "$libdir"/*.db || true
chown -f root:root "$libdir"/*.cfg || true
chmod 770 "$libdir"
chgrp -Rf adm "$logdir"
chmod 2750 "$logdir"
if [ -n "$USER" ] ; then
# Creating ntop group if he isn't already there
if ! grep -q ^"$USER": /etc/passwd; then
echo Adding system user: "$USER".
adduser --system --group --home /var/lib/ntop --no-create-home --quiet "$USER"
fi
if ! grep -q ^"$USER": /etc/group; then
# some older versions of the ntop package did not create the ntop group
echo Adding system group: "$USER".
addgroup --system "$USER"
usermod -g "$USER" "$USER"
fi
# make status dir owned by user
if grep -q ^"$USER": /etc/passwd; then
# $libdir contains the init.cfg and password file, should not be writable by the ntop user,
# but we need the ntop user to be able to create directories inside there
chown -f root:$USER "$libdir"
# set sticky bit (rwxrwx--T) so only root can remove/rename the init.cfg file
chmod -f +t "$libdir"
chown -Rf "$USER" "$logdir"
fi
fi
echo USER=\"$USER\" > "$INITCFG"
echo INTERFACES=\"$INTERFACES\" >> "$INITCFG"
db_get ntop/admin_password
if [ -n "$RET" ]; then
adminpass="$RET"
db_set ntop/admin_password ""
db_set ntop/admin_password_again ""
db_fset ntop/admin_password seen false
db_fset ntop/admin_password_again seen false
db_reset ntop/password_reset
db_fset ntop/password_reset seen false
rm -f /var/lib/ntop/ntop_pw.db
ntop --set-admin-password="$adminpass"
elif ! [ -f /var/lib/ntop/ntop_pw.db ]; then
adminpass=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | md5sum | cut -c 1-16)
ntop --set-admin-password="$adminpass"
fi
db_stop
# Automatically added by dh_installinit
if [ -x "/etc/init.d/ntop" ]; then
update-rc.d ntop defaults >/dev/null
invoke-rc.d ntop start || exit $?
fi
# End automatically added section
|