Argus SPEC file for RPM building

Chris Wilson chris-argus at qwirx.com
Sun Sep 20 17:49:47 EDT 2009



I just tried to build Argus 3.0.0 RPMs as a normal user (not as root) and 
discovered that it was not possible, because argus.spec does not use buildroots 
and tries to install Argus on the host system in order to create the RPM. This 
is generally seen as a Bad and Dangerous Thing(TM).

Please find attached a patch to argus.spec to enable the RPM to be built as a 
non-root user, and without installing it on the host system.

Cheers, Chris.
-- 
_____ __     _
\  __/ / ,__(_)_  | Chris Wilson <chris+sig at qwirx.com> Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Ruby/Perl/SQL Developer |
\__/_/_/_//_/___/ | We are GNU : free your mind & your software |
-------------- next part --------------
--- argus-3.0.0/lib/argus.spec	2008-02-05 03:37:42.000000000 +0000
+++ /usr/src/redhat/SPECS/argus.spec	2009-09-20 22:43:24.000000000 +0100
@@ -13,6 +13,7 @@
 Group: Applications/Internet
 Source: %{name}-%{version}.%{rel}.tar%{srcext}
 URL: http://qosient.com/argus
+BuildRoot: /var/tmp/argus-buildroot
 
 %description
 The ARGUS (Network Transaction Activity Monitor) is an IP network
@@ -24,8 +25,8 @@
 %define argusdir	/usr/local
 %define arguslog	/var/log/argus
 %define argusdocs	/usr/share/doc/argus-%{ver}
-%define argusdata	%{argusdir}/argus
 
+%define argusdata	%{argusdir}/argus
 %define argusbin	%{argusdir}/bin
 %define argussbin	%{argusdir}/sbin
 
@@ -34,30 +35,33 @@
 %build
 %configure --prefix=/usr
 make
-mkdir -p %{argusdir}
-mkdir -p %{argusbin}
-mkdir -p %{argusdocs}
-mkdir -p %{argusdata}
-mkdir -p %{argusdata}/archive
-mkdir -p %{argussbin}
-mkdir -p %{arguslog}
-
-cp -Rp support %{argusdocs}
-cp -Rp doc/* %{argusdocs}
-
-install -m 0444 -o root -g root README %{argusdata}
-install -m 0444 -o root -g root COPYING %{argusdata}
-
-install -m 0555 -o root -g root bin/argus %{argussbin}
-install -m 0555 -o root -g root bin/ntasbug %{argusbin}
+mkdir -p $RPM_BUILD_ROOT%{argusdir}
+mkdir -p $RPM_BUILD_ROOT%{argusbin}
+mkdir -p $RPM_BUILD_ROOT%{argusdocs}
+mkdir -p $RPM_BUILD_ROOT%{argusdata}
+mkdir -p $RPM_BUILD_ROOT%{argusdata}/archive
+mkdir -p $RPM_BUILD_ROOT%{argussbin}
+mkdir -p $RPM_BUILD_ROOT%{arguslog}
+mkdir -p $RPM_BUILD_ROOT%{_mandir}/man5/
+mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8/
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
+
+cp -Rp support $RPM_BUILD_ROOT%{argusdocs}
+cp -Rp doc/* $RPM_BUILD_ROOT%{argusdocs}
+
+install README $RPM_BUILD_ROOT%{argusdata}
+install COPYING $RPM_BUILD_ROOT%{argusdata}
+
+install bin/argus $RPM_BUILD_ROOT%{argussbin}
+install bin/argusbug $RPM_BUILD_ROOT%{argusbin}
 
-install -m 0444 -o root -g root man/man5/* %{_mandir}/man5/
-install -m 0444 -o root -g root man/man8/* %{_mandir}/man8/
+install man/man5/* $RPM_BUILD_ROOT%{_mandir}/man5/
+install man/man8/* $RPM_BUILD_ROOT%{_mandir}/man8/
 
-install -m 0600 -o root -g root support/Config/argus.conf /etc/argus.conf
-install -m 0755 -o root -g root support/Startup/argus /etc/rc.d/init.d/argus
+install support/Config/argus.conf $RPM_BUILD_ROOT/etc/argus.conf
+install support/Startup/argus $RPM_BUILD_ROOT/etc/rc.d/init.d/argus
 
-install -m 0755 -o root -g root support/Archive/argusarchive %{argusbin}/argusarchive
+install support/Archive/argusarchive $RPM_BUILD_ROOT%{argusbin}/argusarchive
 
 %post
 /sbin/chkconfig --add argus
@@ -75,16 +79,20 @@
 fi
 
 %files
-%defattr(-,root,root)
+%defattr(0555,root,root)
 %{argussbin}/argus
-%{argusbin}/ntasbug
+%{argusbin}/argusbug
+%{argusbin}/argusarchive
+%defattr(0444,root,root)
 %{argusdata}
 %doc %{argusdocs}
-%{_mandir}/man5/argus.5
 %{_mandir}/man5/argus.conf.5
 %{_mandir}/man8/argus.8
 
 /var/log/argus
+
+%defattr(0755,root,root)
 /etc/rc.d/init.d/argus
 
+%defattr(0600,root,root)
 %config /etc/argus.conf


More information about the argus mailing list