Files
server/var/lib/dpkg/info/drweb-daemon.prerm
2026-01-07 20:52:11 +01:00

67 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
# ESP Package Manager v6.0.2 Dr.Web Edition
BackupFile()
{
if [ -f "$1" ] ; then
if [ -f "$1.drwebsave" ] ; then
TIMESTAMP=`date "+%Y%m%d-%k_%M_%S"`
dest="$1.$TIMESTAMP"
else
dest="$1.drwebsave"
fi
cp -p "$1" "$dest"
if [ $? -ne 0 ] ; then
echo "Error: can't backup $1!"
return 3
else
echo "Info: backup file $1 is saved to $dest."
fi
else
echo ""
echo "Error: can't find file $1 for backup!"
echo ""
return 1
fi
return 0;
}
check_config() {
config="$1"
template="$2"
save=${3:-"no"}
if ( cmp "$config" "$template" >/dev/null 2>/dev/null ) ; then
rm -f "$config"
else
if [ "$save" = "yes" -a -f "$config" ] ; then
if ( BackupFile "$config" ) ; then
rm -f "$config"
fi
fi
fi
}
check_config /etc/drweb/monitor/daemon.mmc /opt/drweb/doc/daemon/daemon.mmc no
check_config /etc/drweb/templates/drwebd/msg.tmpl /opt/drweb/doc/daemon/msg.tmpl no
rm_symlink() {
if [ -L "$1" ] ; then
rm -f "$1"
fi
}
rm_man_symlinks() {
prefix=$1
mans=$2
for mandir in $prefix/man/man* ; do
for dir in /usr/local/share/man /usr/share/man ; do
if [ -d "$dir/`basename $mandir`" ] ; then
for man in $mans ; do
rm_symlink "$dir/`basename $mandir`/$man"
done
fi
done
done
}
rm_man_symlinks /opt/drweb "drwebd.1 drwebdc.1" "$MANS"
if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d drwebd stop || true
else
/etc/init.d/drwebd stop || true
fi