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
|
#!/bin/sh
# Post-installation script for the Debian Tripwire distribution.
set -e
# Make sure we should be running...
case "$1" in
configure)
# continue below
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument "$1 >&2
exit 0
;;
esac
if [ -d /var/lib/tripwire ]
then
cat <<EOF
The old location /var/lib/tripwire still exists. I can move all files to
the new location /usr/lib/tripwire and remove the old one.
EOF
while true
do
echo -n "Should I do this (y/n) [y]? "
read input
if [ $input = "y" ]
then
wd=1
break
elif [ $input = "n" ]
then
wd=0
break
elif [ ! $input ]
then
wd=1
break
else
echo "Please answer \`Y' or \`N'."
fi 2>/dev/null
done
if [ $wd = 1 ]
then
mv -f /var/lib/tripwire/databases/* /usr/lib/tripwire/databases &&\
/bin/rm -r /var/lib/tripwire/databases &&\
mv -f /var/lib/tripwire/* /usr/lib/tripwire &&\
/bin/rm -r /var/lib/tripwire
fi
fi
if [ -f /etc/tw.config ]
then
cat <<EOF
Old configuration file /etc/tw.config exists. The new locations
is /etc/tripwire/tw.config."
EOF
while true
do
echo -n "Should I move it into the new location (y/n) [y]? "
read input
if [ $input = "y" ]
then
wd=1
break
elif [ $input = "n" ]
then
wd=0
break
elif [ ! $input ]
then
wd=1
break
else
echo "Please answer \`Y' or \`N'."
fi 2>/dev/null
done
if [ $wd = 1 ]
then
mv -f /etc/tw.config /etc/tripwire
fi
fi
wd=1
if grep "MAILTO=$" /etc/cron.daily/tripwire > /dev/null 2>&1
then
cat << EOF
I can set up the system so that all detected changes are mailed
to a specified user. Please enter \`none' to disable this feature.
EOF
echo -n "Username [none]? "
read input
if [ $input = "none" ]
then
wd=0
elif [ ! $input ]
then
wd=0
fi 2>/dev/null
if [ $wd = 1 ]
then
echo -n "Okay, now enabling mailing... "
sed 's:^MAILTO=$:MAILTO='$input':' /etc/cron.daily/tripwire \
> /etc/cron.daily/tripwire.$$ && \
mv /etc/cron.daily/tripwire.$$ /etc/cron.daily/tripwire
chmod 755 /etc/cron.daily/tripwire
echo "done."
else
echo "Okay, not enabling mailing."
fi
fi
test -p /etc/tripwire/tw.fifo || mkfifo /etc/tripwire/tw.fifo
chmod 600 /etc/tripwire/tw.fifo
cat <<EOF
Tripwire has been installed.
Note: the tripwire binaries and database directory are located conforming in
/usr/lib/tripwire. It is strongly advised that this location is stored on
write-protected media (e.g. mounted RO floppy). See /usr/doc/tripwire/README
for details.
You will probably want to finetune /etc/tripwire/tw.config.
EOF
echo "Press <return> to continue".
read $x
|