1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools eutils readme.gentoo user
8 DESCRIPTION="Really Awesome New Cisco confIg Differ"
9 HOMEPAGE="http://www.shrubbery.net/rancid/"
10 SRC_URI="http://http.debian.net/debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV}.orig.tar.gz -> ${P}.tar.gz"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="+cvs subversion"
18 REQUIRED_USE="^^ ( cvs subversion )"
20 # app-arch/par is blocker, due to bug #455838
28 subversion? ( dev-vcs/subversion )
30 net-misc/netkit-telnetd
36 epatch "${FILESDIR}"/${P}-mailprefix.patch
37 epatch "${FILESDIR}"/${P}-config.patch
38 epatch "${FILESDIR}"/${P}-buildsystem.patch
40 # respect CFLAGS, bug #455840
41 sed -i -e '/^CFLAGS/d' bin/Makefile.am || die 'sed on bin/Makefile.am failed'
48 --localstatedir="${EPREFIX}"/var/${PN} \
49 --enable-conf-install \
50 --docdir="${EPREFIX}"/usr/share/doc/${PF} \
51 --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \
52 $(use subversion && echo "--with-svn=fsfs")
58 if use subversion ; then
59 sed -e 's/^RCSSYS=cvs/RCSSYS=svn/' \
60 -i "${D}"/etc/rancid.conf || die
63 echo "CONFIG_PROTECT=\"${EPREFIX}/var/rancid/.cloginrc\"" > "${T}"/99${PN}
66 readme.gentoo_src_install
71 enewuser ${PN} -1 /bin/bash "${EPREFIX}"/var/rancid ${PN}
73 keepdir /var/${PN}{,/logs}
74 touch "${ED}"/var/${PN}/.cloginrc
76 fperms ug=rwX,o= /var/${PN}/{,logs,.cloginrc}
77 fowners ${PN}:${PN} /var/${PN}/{,logs,.cloginrc}
80 DISABLE_AUTOFORMATTING="yes"
81 DOC_CONTENTS="Micro-HOWTO on how to get running:
83 1) Modify MAILPREFIX, ADMINMAILPREFIX, and LIST_OF_GROUPS
85 MAILPREFIX=\"rancid-\"
86 ADMINMAILPREFIX=\"rancid-admin-\"
87 LIST_OF_GROUPS=\"routers switches\"
89 2) Setup email aliases for rancid:
90 you will need to define mail aliases for {MAILPREFIX}{GROUP}
91 and {ADMINMAILPREFIX}{GROUP} for each group you defined above
92 How to do this depends on your mailserver
94 3) Run rancid-cvs as the rancid user to initialise directories and
95 repositories; eg. su -c /usr/bin/rancid-cvs - rancid
96 Note the command is the same even if you are using subversion
98 4) Populate /var/rancid/{GROUPNAME}/router.db with nodes
99 see man 5 router.db for detailed formatting information
101 5) Populate /var/rancid/.cloginrc with credentials
102 see /usr/share/rancid/cloginrc.sample for an example
104 6) Test clogin access with: clogin -f /var/rancid/.clogin hostname
106 7) Add a cronjob for the rancid user to regularly call rancid-run
107 eg: run crontab -u rancid -e and add the lines below
108 # run rancid once an hour
109 0 * * * * /usr/bin/rancid-run
110 # cleanup old logfiles generated by rancid once a day
111 50 23 * * * /usr/bin/find /var/rancid/logs -type f -mtime +2 -exec rm {} \;