diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec index c2bb116901..0a81c02d2b 100644 --- a/pandora_console/pandora_console.redhat.spec +++ b/pandora_console/pandora_console.redhat.spec @@ -23,7 +23,7 @@ Group: Productivity/Networking/Web/Utilities Packager: Sancho Lerena Prefix: /var/www/html BuildRoot: %{_tmppath}/%{name} -BuildArch: noarch +BuildArch: x86_64 AutoReq: 0 Requires: %{httpd_name} >= 2.0.0 Requires: php >= 8.0 @@ -109,3 +109,5 @@ fi %{prefix}/pandora_console %config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console %attr(0644, root, root) %{_sysconfdir}/logrotate.d/pandora_console +%defattr(0744,%{httpd_user},%{httpd_group},0755) +%{prefix}/pandora_console/attachment/discovery diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec index c820107758..23e58fc89d 100644 --- a/pandora_console/pandora_console.rhel7.spec +++ b/pandora_console/pandora_console.rhel7.spec @@ -23,7 +23,7 @@ Group: Productivity/Networking/Web/Utilities Packager: Sancho Lerena Prefix: /opt/rh/httpd24/root/var/www/html BuildRoot: %{_tmppath}/%{name} -BuildArch: noarch +BuildArch: x86_64 AutoReq: 0 Requires: httpd24-httpd Requires: httpd24-mod_php >= 7.2 @@ -93,3 +93,5 @@ fi %{prefix}/pandora_console %config(noreplace) %{_sysconfdir}/logrotate.d/pandora_console %attr(0644, root, root) %{_sysconfdir}/logrotate.d/pandora_console +%defattr(0744,%{httpd_user},%{httpd_group},0755) +%{prefix}/pandora_console/attachment/discovery diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 314a1d1b0f..91747db77e 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -18,7 +18,7 @@ Group: System/Monitoring Packager: Sancho Lerena Prefix: %{_datadir} BuildRoot: %{_tmppath}/%{name}-buildroot -BuildArchitectures: noarch +BuildArchitectures: x86_64 AutoReq: 0 Provides: %{name}-%{version} Requires(pre): shadow-utils @@ -59,6 +59,7 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/netflow mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/sflow mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/trans mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/commands +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/pandora/ mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf/ mkdir -p $RPM_BUILD_ROOT%{prefix}/pandora_server/conf.d/ @@ -68,6 +69,23 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/pandora/.ssh mkdir -p $RPM_BUILD_ROOT/usr/lib/perl5/ +# Copy open discovery plugins to data_in +if [ -d "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery" ]; then + echo ">Installing the open discovery scripts to $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery..." + for disco_folder in $(ls "discovery/"); do + if [ -d "discovery/"$disco_folder ]; then + if [ -d "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder" ]; then + rm -Rf "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder" + fi + cp -Rf "discovery/"$disco_folder "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder" + chmod -R 770 "$RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery/$disco_folder" + fi + done + +else + echo ">ERROR: Failed to copy open discovery scripts to $RPM_BUILD_ROOT%{_localstatedir}/spool/pandora/data_in/discovery - Folder not found" +fi + # All binaries go to %{_bindir} cp -aRf bin/pandora_server $RPM_BUILD_ROOT%{_bindir}/ cp -aRf bin/pandora_exec $RPM_BUILD_ROOT%{_bindir}/ diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 6790673e24..39af106794 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -341,6 +341,23 @@ install () { chown apache:$GROUPNAME $DESTDIR$PANDORA_SPOOL/data_in/customer_key 2>/dev/null + # Copy open discovery plugins to data_in + if [ -d "$DESTDIR$PANDORA_SPOOL/data_in/discovery" ]; then + echo ">Installing the open discovery scripts to $DESTDIR$PANDORA_SPOOL/data_in/discovery..." + for disco_folder in $(ls "discovery/"); do + if [ -d "discovery/"$disco_folder ]; then + if [ -d "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder" ]; then + rm -Rf "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder" + fi + cp -Rf "discovery/"$disco_folder "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder" + chmod -R 770 "$DESTDIR$PANDORA_SPOOL/data_in/discovery/$disco_folder" + fi + done + + else + echo ">ERROR: Failed to copy open discovery scripts to $DESTDIR$PANDORA_SPOOL/data_in/discovery/discovery - Folder not found" + fi + echo "Creating setup directory in $PANDORA_CFG_DIR" mkdir -p $DESTDIR$PANDORA_CFG_DIR 2> /dev/null if [ -f "$DESTDIR$PANDORA_CFG_FILE" ]