Creating a Custom Spec file for Snort February 18, 2010
Posted by Paul Whalen in Uncategorized.add a comment
Now to create a custom spec file to be used to build an rpm package for use with Fedora Core 12. First I ran the command:
rpmdev-newspec snort
This will create a skeleton spec file that will be used to create the new rpm package. After filling out the details of the package, I ran the command:
rpmbuild -ba snort.spec
It seemed to be running fine until it hit the make section, then failed. Apparently this was due to the ‘-j3′ option being added to make, the package would not build. After altering the spec file and removing this option, as well as a few tweaks, the package was successfully built. I have included an excerpt for the specific lines that were added below:
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
rm -rf %{buildroot}/usr/src/
mv %{buildroot}/%{_datadir}/doc/%{name} %{buildroot}/%{_datadir}/doc/%{name}-%{version}/
%clean
rm -rf $RPM_BUILD_ROOT
%doc LICENSE RELEASE.NOTES COPYING
%{_bindir}/*
%{_libdir}/*
%{_mandir}/*/*
This built the packages successfully, but now I need to check the rpms. I checked the created rpm binary with rpmlint, running the comand:
rpmlint snort-2.8.5.2-1.fc12.i386.rpm
I discover ‘unstripped-binary-or-object files’, and ‘devel-file-in-non-devel-package’ warnings, 32 in total, however no errors. Running the rpmlint command on the source rpm and the spec file there are no errors. I decided to move forward and revisit the warnings later.
Moving forward I tested with Mock. Using the command:
mock -r fedora-12-i386 --rebuild snort-2.8.5.2-1.fc12.src.rpm
I received errors about build dependencies, checking the log files I needed to add both ‘ibpcap-devel’ and ‘pcre-devel’ to BuildRequires in the spec file. Once that was done and the package was rebuilt using:
rpmbuild -bs snort.spec
Mock was re-run and finished without errors.
Next, Testing with Koji.
Creating a Snort Package for use with Fedora 12 (default spec file) February 9, 2010
Posted by Paul Whalen in Uncategorized.add a comment
First we need to create a packaging environment. I downloaded rpm-build, rpmdevtools, rpmlint using the ‘yum’ command. Then used the “rpmdev-setuptree” command to set up the packaging environment which created a new folder in my working directory called ‘rpmbuild’ which contained the folders ‘BUILD’ , ‘RPMS ‘ , ‘SOURCES’ , ‘SPECS’ and ‘SRPMS’. Then using the command ‘yumdownloader –source snort’ I downloaded ‘snort-2.8.5.1-1.fc12.src.rpm’, the source package for Snort. I then ran the command ‘rpm -i snort-2.8.5.1-1.fc12.src.rpm’.
Moving to the rpmbuild directory I now find in the ‘SOURCES’ folder the files ‘snort-2.8.5.1.tar.gz’, ‘ snortd’ and ‘ sysconfig.snort’. And in the SPEC folder there is now a file ‘snort.spec’.
Now to rebuild. I ran the command ‘rpmbuild –rebuild snort-2.8.5.1-1.fc12.src.rpm’ but received ‘Failed build dependencies’ errors with a list of packages. Installing the needed packages I ran the command again and this time was successful. The default spec file creates 10 different rpms and include snort compiled with different configuration options.
Next I will be creating my own Snort spec file and posting the results.