Merge branch 'ent-6883-11170-pandora_server_installer-pandora_server-spec-borra-configuracion-de-logrotate' into 'develop'

Prevent logrotate file to be overwritten

See merge request artica/pandorafms!3992
This commit is contained in:
Daniel Rodriguez 2021-04-12 08:32:49 +00:00
commit 34aeb4ddd8
3 changed files with 17 additions and 5 deletions

View File

@ -82,7 +82,9 @@ install -m 0444 man/man1/tentacle_server.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/
rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/PandoraFMS rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/PandoraFMS
rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/recon_scripts/PandoraFMS rm -f $RPM_BUILD_ROOT%{prefix}/pandora_server/util/recon_scripts/PandoraFMS
install -m 0644 util/pandora_server_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server if [ ! -f $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server ] ; then
install -m 0644 util/pandora_server_logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/pandora_server
fi
install -m 0640 conf/pandora_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/pandora/pandora_server.conf.new install -m 0640 conf/pandora_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/pandora/pandora_server.conf.new
install -m 0640 conf/tentacle_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/tentacle/tentacle_server.conf.new install -m 0640 conf/tentacle_server.conf.new $RPM_BUILD_ROOT%{_sysconfdir}/tentacle/tentacle_server.conf.new

View File

@ -122,7 +122,12 @@ systemctl enable pandora_server.service
echo "/usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" > /etc/cron.hourly/pandora_db echo "/usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" > /etc/cron.hourly/pandora_db
chmod 750 /etc/cron.hourly/pandora_db chmod 750 /etc/cron.hourly/pandora_db
cp -aRf /usr/share/pandora_server/util/pandora_server_logrotate /etc/logrotate.d/pandora_server
if [ -d /etc/logrotate.d ] ; then
if [ ! -f /etc/logrotate.d/pandora_server ] ; then
cp -aRf /usr/share/pandora_server/util/pandora_server_logrotate /etc/logrotate.d/pandora_server
fi
fi
if [ ! -d /etc/pandora ] ; then if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora mkdir -p /etc/pandora

View File

@ -354,9 +354,14 @@ install () {
if [ -d /etc/logrotate.d ] if [ -d /etc/logrotate.d ]
then then
[ -d $DESTDIR/etc/logrotate.d ] || mkdir -p $DESTDIR/etc/logrotate.d if [ -f $DESTDIR/etc/logrotate.d/pandora_server ]
echo "Creating logrotate.d entry for Pandora FMS log management" then
cp util/pandora_server_logrotate $DESTDIR/etc/logrotate.d/pandora_server echo "A logrotate.d entry for Pandora FMS log management already exists, skipping creation"
else
echo "Creating logrotate.d entry for Pandora FMS log management"
[ -d $DESTDIR/etc/logrotate.d ] || mkdir -p $DESTDIR/etc/logrotate.d
cp util/pandora_server_logrotate $DESTDIR/etc/logrotate.d/pandora_server
fi
else else
echo "Please add a log rotation schedule manually to your log rotation daemon (if any)" echo "Please add a log rotation schedule manually to your log rotation daemon (if any)"
fi fi