dev checkup: src.rpm for cactid with different .conf path

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
TECK
Posts: 16
Joined: Sun May 27, 2007 2:13 am

dev checkup: src.rpm for cactid with different .conf path

Post by TECK »

Hi all,

I'm new to this forum and I really like Cacti, very good software.
I've created an RPM for CentOS5 and everything works fine.
I also created an RPM for cactid. It works also fine , when I use the default path for cactid.conf file.

I would like to use the cactid.conf file into a different directory, not /etc.
For example /etc/cacti/cactid.conf

I would like a confirmation from one of the cactid devs if my procedure is correct.
Because I did not wanted to use the -C argument into poller.php file (line 101), I decided to modify the cactid.h file in the archive:

Code: Select all

--- cactid.h.orig	2006-10-22 21:31:41.000000000 -0400
+++ cactid.h	2007-05-27 02:25:05.000000000 -0400
@@ -130,7 +130,7 @@
 /* locations to search for the config file */
 #define CONFIG_PATHS 2
 #define CONFIG_PATH_1 ""
-#define CONFIG_PATH_2 "/etc/"
+#define CONFIG_PATH_2 "/etc/cacti/"
 
 /* config file defaults */
 #define DEFAULT_CONF_FILE "cactid.conf"
Then, I simply created a regular spec file that applies my changes:

Code: Select all

Summary:			Threaded poller for Cacti written in C
Name:				cacti-cactid
Version:			0.8.6i
Release:			1.el5
License:			LGPL
Group:				Application/System
URL:				http://www.cacti.net/
Source:				http://www.cacti.net/downloads/cactid/%{name}-%{version}.tar.gz
Patch:				cacti-cactid.0.8.6i.config_path.patch
BuildRoot:			%{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:		mysql-devel, net-snmp-devel
Requires:			cacti, mysql, net-snmp

%description
Cactid is a supplemental poller for Cacti that makes use of pthreads to achieve
excellent performance.


%prep
%setup -q
%patch -p0


%build
%configure
%{__make} %{?_smp_mflags}


%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}
%{__install} -D -p -m 0640 cactid.conf \
    %{buildroot}%{_sysconfdir}/cacti/cactid.conf
%{__rm} -rf %{buildroot}%{_sysconfdir}/cactid.conf


%clean
%{__rm} -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING INSTALL NEWS
%doc LICENSE LICENSE.LGPL README README-WINDOWS
%attr(-,cactid,lighttpd) %config(noreplace) %{_sysconfdir}/cacti/cactid.conf
%{_bindir}/cactid


%changelog
* Sun May 27 2007 Floren Munteanu <http://www.yqed.com/> 0.8.6i-1
- Initial build.
Can you please confirm if my approach is good?
Do you recommend another method? To tell you the truth, I'm not really experienced with RPM's. I'm not sure why cactid.conf is added automatically into %{buildroot} folder, is it because is there by default in BUILD/cacti-0.8.6j directory?

I solved the orphan RPM file presence with this line:
%{__rm} -rf %{buildroot}%{_sysconfdir}/cactid.conf

but I'm not positive this is the right way. :)
Thank you for reading this.

Edit: I forgot to mention that everything is OK with the changes listed above.
The graphs are updated properly by the modified cactid. :)
TECK
Posts: 16
Joined: Sun May 27, 2007 2:13 am

Post by TECK »

There is another weird behavior with the cactid setup.
In the .spec file, I tried to use:

Code: Select all

%build
%configure --sysconfdir=%{_sysconfdir}/cacti
%{__make} %{?_smp_mflags}
to push the sysconfdir to /etc/cacti, before I did the patching.
It did not work and still used the hard coded CONFIG_PATH_2 value from cactid.h file.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests