404f11b6fd
- While I'm here: make rm silent Submitted by: maintainer
62 lines
1.7 KiB
Bash
62 lines
1.7 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD: /tmp/pcvs/ports/security/nessus/scripts/move_nessus,v 1.3 2004-12-12 21:37:53 sem Exp $
|
|
#
|
|
# set -x
|
|
|
|
trap ' cleanup ' 0
|
|
trap ' echo_signal; exit 1' 1 2 3 15
|
|
|
|
cleanup() {
|
|
# No tmp file to remove up to now ;-)
|
|
}
|
|
|
|
echo_signal() {
|
|
echo "Got Signal -- aborting `basename $0`"
|
|
}
|
|
|
|
PATH=/bin:/usr/bin
|
|
|
|
|
|
if [ -f $PREFIX/etc/nessus/nessusd.conf ]; then
|
|
if grep -q "$PREFIX/etc/nessus/var" $PREFIX/etc/nessus/nessusd.conf; then
|
|
mv $PREFIX/etc/nessus/nessusd.conf $PREFIX/etc/nessus/nessusd.conf.bak
|
|
sed -e "s,$PREFIX/etc/nessus/var,$PREFIX/var,g" \
|
|
-e "s,$PREFIX/etc/nessus/com,$PREFIX/com,g" \
|
|
$PREFIX/etc/nessus/nessusd.conf.bak > $PREFIX/etc/nessus/nessusd.conf
|
|
fi
|
|
fi
|
|
if [ -d $PREFIX/etc/nessus/var/nessus/users ]; then
|
|
rmdir $PREFIX/etc/nessus/var/nessus/users > /dev/null 2>/dev/null
|
|
if [ $? -gt 0 ]; then
|
|
printf "\n\nMigrating nessus to default directory scheme\n"
|
|
printf "============================================\n\n"
|
|
cd $PREFIX/etc/nessus/var/nessus/users
|
|
for i in *; do
|
|
if [ $i != '*' ]; then
|
|
mv $i $PREFIX/var/nessus/users
|
|
printf "Moving nessus user %s\n" $i
|
|
fi
|
|
done
|
|
cd $PREFIX
|
|
rmdir $PREFIX/etc/nessus/var/nessus/users > /dev/null 2>/dev/null
|
|
printf "\n"
|
|
fi
|
|
fi
|
|
if [ ! -d $PREFIX/com/CA ]; then
|
|
if [ -d $PREFIX/etc/nessus/com/CA ]; then
|
|
if [ ! -d $PREFIX/com ]; then
|
|
mkdir -m 755 $PREFIX/com
|
|
fi
|
|
mv $PREFIX/etc/nessus/com/CA $PREFIX/com/CA
|
|
fi
|
|
if [ -d $PREFIX/etc/nessus/var/CA ]; then
|
|
if [ ! -d $PREFIX/var/CA ]; then
|
|
mv $PREFIX/etc/nessus/var/CA $PREFIX/var/CA
|
|
fi
|
|
fi
|
|
fi
|
|
cd $PREFIX
|
|
rmdir $PREFIX/etc/nessus/var > /dev/null 2>/dev/null
|
|
rmdir $PREFIX/etc/nessus/com > /dev/null 2>/dev/null
|
|
exit 0
|