1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
SUMMARY = "BGP/OSPF/RIP routing daemon"
DESCRIPTION = "Quagga is a routing software suite, providing \
implementations of OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for \
Unix platforms, particularly FreeBSD, Linux, Solaris and NetBSD. \
Quagga is a fork of GNU Zebra which was developed by Kunihiro \
Ishiguro. The Quagga tree aims to build a more involved community \
around Quagga than the current centralised model of GNU Zebra."
HOMEPAGE = "http://www.nongnu.org/quagga/"
SECTION = "network"
LICENSE = "GPL-2.0 & LGPL-2.0"
DEPENDS = "readline ncurses perl-native"
DEPENDS += "${@base_contains('DISTRO_FEATURES', 'snmp', 'net-snmp', '', d)}"
SNMP_CONF="${@base_contains('DISTRO_FEATURES', 'snmp', '--enable-snmp', '', d)}"
LIC_FILES_CHKSUM = "file://COPYING;md5=81bcece21748c91ba9992349a91ec11d \
file://COPYING.LIB;md5=01ef24401ded36cd8e5d18bfe947240c"
# the "ip" command from busybox is not sufficient (flush by protocol flushes all routes)
RDEPENDS_${PN} += "iproute2"
QUAGGASUBDIR = ""
# ${QUAGGASUBDIR} is deal with old versions. Set to "/attic" for old
# versions and leave it empty for recent versions.
SRC_URI = "${SAVANNAH_GNU_MIRROR}/quagga${QUAGGASUBDIR}/quagga-${PV}.tar.gz; \
file://Zebra-sync-zebra-routing-table-with-the-kernel-one.patch \
file://quagga.init \
file://quagga.default \
file://watchquagga.init \
file://watchquagga.default \
file://volatiles.03_quagga \
file://quagga.pam \
file://ripd-fix-two-bugs-after-received-SIGHUP.patch \
file://quagga-Avoid-duplicate-connected-address.patch \
file://babeld.service \
file://bgpd.service \
file://isisd.service \
file://ospf6d.service \
file://ospfd.service \
file://ripd.service \
file://ripngd.service \
file://zebra.service \
"
PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam"
inherit autotools update-rc.d useradd systemd
SYSTEMD_PACKAGES = "${PN} ${PN}-babeld ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
SYSTEMD_SERVICE_${PN}-babeld = "babeld.service"
SYSTEMD_SERVICE_${PN}-bgpd = "bgpd.service"
SYSTEMD_SERVICE_${PN}-isisd = "isisd.service"
SYSTEMD_SERVICE_${PN}-ospf6d = "ospf6d.service"
SYSTEMD_SERVICE_${PN}-ospfd = "ospfd.service"
SYSTEMD_SERVICE_${PN}-ripd = "ripd.service"
SYSTEMD_SERVICE_${PN}-ripngd = "ripngd.service"
SYSTEMD_SERVICE_${PN} = "zebra.service"
EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \
--localstatedir=${localstatedir}/run/quagga \
--enable-exampledir=${docdir}/quagga/examples/ \
--enable-vtysh \
--enable-isisd \
--enable-watchquagga \
--enable-ospf-te \
--enable-opaque-lsa \
--enable-ipv6 \
--enable-ospfclient=yes \
--enable-multipath=64 \
--enable-user=quagga \
--enable-group=quagga \
--enable-vty-group=quaggavty \
--enable-configfile-mask=0640 \
--enable-logfile-mask=0640 \
--enable-rtadv \
--enable-linux24-tcp-md5 \
ap_cv_cc_pie=no \
${SNMP_CONF}"
do_install () {
# Install init script and default settings
install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \
${D}${sysconfdir}/quagga ${D}${sysconfdir}/default/volatiles
install -m 0644 ${WORKDIR}/quagga.default ${D}${sysconfdir}/default/quagga
install -m 0644 ${WORKDIR}/watchquagga.default ${D}${sysconfdir}/default/watchquagga
install -m 0755 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga
install -m 0755 ${WORKDIR}/watchquagga.init ${D}${sysconfdir}/init.d/watchquagga
install -m 0644 ${WORKDIR}/volatiles.03_quagga ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
# Install sample configurations for the daemons
for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do
install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample
done
for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do
touch ${D}${sysconfdir}/quagga/$f.conf
done
chown quagga:quaggavty ${D}${sysconfdir}/quagga
chown quagga:quagga ${D}${sysconfdir}/quagga/*.conf
chmod 750 ${D}${sysconfdir}/quagga
chmod 640 ${D}${sysconfdir}/quagga/*.conf
# Install quagga
oe_runmake install DESTDIR=${D} prefix=${prefix} \
sbindir=${sbindir} \
sysconfdir=${sysconfdir}/quagga \
localstatedir=${localstatedir}/run/quagga
# Fix hardcoded paths
sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/*
sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/quagga
sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/watchquagga
sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
sed -i 's!^PATH=.*!PATH=${base_sbindir}:${sbindir}:${base_bindir}:${bindir}!' ${D}${sysconfdir}/init.d/*
# Remove generated info dir file, it doesn't belong in the generated
# package.
rm -f ${D}${infodir}/dir
# For PAM
for feature in ${DISTRO_FEATURES}; do
if [ "$feature" = "pam" ]; then
install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga
break
fi
done
if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -d ${D}${sysconfdir}/tmpfiles.d
echo "d /var/run/quagga 0755 quagga quagga -" \
> ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
fi
# Remove sysinit script if sysvinit is not in DISTRO_FEATURES
if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
rm -rf ${D}${sysconfdir}/init.d/
fi
install -d ${D}${systemd_unitdir}/system
for i in babeld bgpd isisd ospf6d ospfd ripd ripngd zebra; do
install -m 0644 ${WORKDIR}/$i.service ${D}${systemd_unitdir}/system
done
sed -e 's,@BASE_SBINDIR@,${base_sbindir},g' \
-e 's,@SYSCONFDIR@,${sysconfdir},g' \
-e 's,@SBINDIR@,${sbindir},g' \
-i ${D}${systemd_unitdir}/system/*.service
}
DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
pkg_postinst_${PN} () {
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
if [ -n "$D" ]; then
OPTS="--root=$D"
fi
systemctl $OPTS mask quagga.service
fi
}
# Split into a main package and separate per-protocol packages
PACKAGE_BEFORE_PN = "${PN}-ospfd ${PN}-ospf6d ${PN}-babeld ${PN}-bgpd \
${PN}-ripd ${PN}-ripngd ${PN}-isisd \
${PN}-ospfclient ${PN}-watchquagga"
RDEPENDS_${PN} += "${PN}-babeld ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
FILES_${PN}-ospfd = "${sbindir}/ospfd ${libdir}/libospf.so.*"
FILES_${PN}-ospf6d = "${sbindir}/ospf6d"
FILES_${PN}-babeld = "${sbindir}/babeld"
FILES_${PN}-bgpd = "${sbindir}/bgpd"
FILES_${PN}-ripd = "${sbindir}/ripd"
FILES_${PN}-ripngd = "${sbindir}/ripngd"
FILES_${PN}-isisd = "${sbindir}/isisd"
FILES_${PN}-ospfclient = "${sbindir}/ospfclient ${libdir}/libospfapiclient.so.*"
FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchquagga \
${sysconfdir}/init.d/watchquagga"
# Indicate that the default files are configuration files
CONFFILES_${PN} = "${sysconfdir}/default/quagga \
${sysconfdir}/quagga/bgpd.conf \
${sysconfdir}/quagga/vtysh.conf \
${sysconfdir}/quagga/babeld.conf \
${sysconfdir}/quagga/isisd.conf \
${sysconfdir}/quagga/ospfd.conf \
${sysconfdir}/quagga/ripngd.conf \
${sysconfdir}/quagga/zebra.conf \
${sysconfdir}/quagga/ripd.conf \
${sysconfdir}/quagga/ospf6d.conf \
"
CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga"
# Stop the names being rewritten due to the internal shared libraries
DEBIAN_NOAUTONAME_${PN}-ospfd = "1"
DEBIAN_NOAUTONAME_${PN}-ospfclient = "1"
# the "ip" command from busybox is not sufficient (flush by protocol flushes all routes)
RDEPENDS_${PN} += "iproute2"
# Main init script starts all deamons
# Seperate init script for watchquagga
INITSCRIPT_PACKAGES = "${PN} ${PN}-watchquagga"
INITSCRIPT_NAME_${PN} = "quagga"
INITSCRIPT_PARAMS_${PN} = "defaults 15 85"
INITSCRIPT_NAME_${PN}-watchquagga = "watchquagga"
INITSCRIPT_PARAMS_${PN}-watchquagga = "defaults 90 10"
# Add quagga's user and group
USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty"
USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga --shell /bin/false quagga"
pkg_postinst_${PN} () {
if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
${sysconfdir}/init.d/populate-volatile.sh update
fi
}
# Stop apps before uninstall
pkg_prerm_${PN} () {
${sysconfdir}/init.d/quagga stop
}
pkg_prerm_${PN}-ospfd () {
${sysconfdir}/init.d/quagga stop ospfd
}
pkg_prerm_${PN}-ospf6d () {
${sysconfdir}/init.d/quagga stop ospf6d
}
pkg_prerm_${PN}-babeld () {
${sysconfdir}/init.d/quagga stop babeld
}
pkg_prerm_${PN}-bgpd () {
${sysconfdir}/init.d/quagga stop bgpd
}
pkg_prerm_${PN}-ripd () {
${sysconfdir}/init.d/quagga stop ripd
}
pkg_prerm_${PN}-ripngd () {
${sysconfdir}/init.d/quagga stop ripngd
}
pkg_prerm_${PN}-isisd () {
${sysconfdir}/init.d/quagga stop isisd
}
|