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

42 lines
1020 B
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/drweb32.ini /opt/drweb/doc/drweb32.ini no