[rancid] Re: RANCID :: RPM

Lance Vermilion rancid at gheek.net
Tue Jul 20 00:56:09 UTC 2010


Any chance the already included SPEC file can be updated with what I
have here so it will work with RANCID-2.3.4 right away? It might also
be of help to others to have the rpmbuild instructions...especially if
they want an RPM but aren't really familiar with building an RPM.


After slightly modifying the spec file to match the current version
"2.3.4" everything seems to work without an issue. It does an install
(at least on CentOS 5.2) to /usr/bin/clogin...etc created a rancid
user directory of /var/rancid and copies the .cloginrc there just

For those that don't know how to create and rpm from a spec file. Here
are some short bits of info.
Follow the link below to setup your CentOS.

# Short Instructions:
Assumptions: It is assumed you have Expect 5.40 or greater installed,
your Time/Date are current, and you are not logged in as root.

Install rpm-build if it isn't already: sudo yum install rpm-build
Install redhat-rpm-config if it isn't already: sudo yum install
Create a build environment for your user (DO NOT USE ROOT): mkdir -p
~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} Create your RPM macros
(it is assumed you have do not have a .rpmmacros file): echo '%_topdir
%(echo $HOME)/rpmbuild' > ~/.rpmmacros
Install Make if it isn't already: sudo yum install make
Install gcc if it isn't already: sudo yum install gcc
Download RANCID 2.3.4: wget
Copy the RANCID tar.gz where rpmbuild will look for it: cp
rancid-2.3.4.tar.gz ~/rpmbuild/SOURCES/
Create the RPM spec file (see below for file contents): vi
Change to the SPEC directory: cd ~/rpmbuild/SPEC/
Create the RPM/SRPMs: rpmbuild -ba rancid.2.3.4.spec

Copy/paste what I have below to the
"~/rpmbuild/SPEC/rancid-2.3.4.spec". Exclude ### Start and ###Stop
when you copy/paste.
### Start
Name:           rancid
Version:        2.3.4
Release:        1%{?dist}
Summary:        Really Awesome New Cisco confIg Differ

Group:          Applications/System
License:        non-free
URL:            http://www.shrubbery.net/rancid/
Source:         rancid-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-root
Requires:       cvs expect >= 5.40

%package lg
Summary:        RANCID Looking Glass CGI scripts
Group:		Applications/System

Rancid is a "Really Awesome New Cisco confIg Differ" developed to
maintain CVS controlled copies of router configs. Rancid is not limited
to Cisco devices. It currently supports Cisco routers, Juniper routers,
Catalyst switches, Foundry switches, Redback NASs, ADC EZT3 muxes, MRTd
(and thus likely IRRd), Alteon switches, and HP procurve switches and a
host of others.

%description lg
RANCID also includes looking glass software. It is based on Ed Kern's
looking glass which was once used for http://nitrous.digex.net/, for the
old-school folks who remember it. Our version has added functions, supports
cisco, juniper, and foundry and uses the login scripts that come with
rancid; so it can use telnet or ssh to connect to your devices(s).

%setup -q

%configure --localstatedir=%{_localstatedir}/rancid

# Get rid of unwanted /usr/share/rancid install
rm -rf $RPM_BUILD_ROOT/%{_datadir}/rancid
# Move lg CGI scripts to CGI directory
mkdir -p $RPM_BUILD_ROOT/var/www/cgi-bin
mv $RPM_BUILD_ROOT/%{_bindir}/*.cgi $RPM_BUILD_ROOT/var/www/cgi-bin
# Workaround for the stupid rpmbuild to NOT search for dependencies in the
# documentation. We need to do it here as %doc ignores %attr.
find share -type f -print | xargs chmod a-x
# Install the sample .cloginrc file
cp cloginrc.sample $RPM_BUILD_ROOT/%{_localstatedir}/rancid/.cloginrc

if [ $1 -eq 1 ]; then
    egrep -q '^rancid:' /etc/passwd || useradd -M -r -d
%{_localstatedir}/rancid -c "RANCID User" rancid

if [ $1 -eq 0 ]; then
    # It's a matter of taste if we should remove the user on uninstall or not
    userdel rancid


%doc share/cisco-load.exp share/cisco-reload.exp
%doc share/downreport share/getipacctg share/rtrfilter
%config(noreplace) /etc/rancid.conf
%dir %attr(770,rancid,rancid) %{_localstatedir}/rancid
%config(noreplace) %attr(640,rancid,rancid) %{_localstatedir}/rancid/.cloginrc

%files lg
%config(noreplace) /etc/lg.conf
%doc README.lg

* Mon Jul 19 2010 Lance Vermilion <rancid at xxxxxxxx> 2.3.4
- Modified Version to be 2.3.4 and Release to be 1%{?dist} instead of 2%{?dist}

* Fri Feb 15 2008 Steve Snodgrass <ssnodgra at xxxxxxxx> 2.3.2a8-1
- Install .cloginrc as a configuration file
- Don't try to create the rancid user if it already exists

* Wed Feb 13 2008 Steve Snodgrass <ssnodgra at xxxxxxxx> 2.3.2a8-1
- Create subpackage for looking glass CGI scripts
- Include configuration files in RPM
- Many other tweaks

* Wed Nov 16 2005 Michael Stefaniuc <mstefani at xxxxxxxxxx> 2.3.1-3
- Use /var/rancid as localstatedir
- Create the rancid user on install and remove it on uninstall
- Use %doc correctly

* Wed Nov 02 2005 Michael Stefaniuc <mstefani at xxxxxxxxxx> 2.3.1-2
- Original spec file by Dan Pfleger.
- Add a changelog.
- Make the formating of the spec file adhere to the Fedora Extras Packaging
- New %description based on the README and the website.
- Add cvs Requires.
- Changed Group
- Use macros in the files section. Simplify it.
- Do not install the looking glass cgi's. Those make rpm pull in more perl
  module dependencies.
### Stop

On Mon, Jul 19, 2010 at 3:17 PM, Lance Vermilion <rancid at gheek.net> wrote:
> Has anyone tried this Spec file?
> Better yet has anyone got a spec file for 2.3.4?
> http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20080227/39e1e42f/attachment.ksh

More information about the Rancid-discuss mailing list