0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-17 08:38:42 +00:00

add apkg-powered upstream packaging for deb, rpm

Files in a single new distro/ dir allow apkg to build BIRD packages for
various distros directly from upstream sources as well as from upstream
archives.

Please see distro/README.md for more detail as well as apkg docs:

https://apkg.rtfd.io

I've used these files to build bird-2.0.8 on all currently supported
releases of following distros:

* Debian
* Ubuntu
* Fedora
* CentOS
* openSUSE

Please note that latest apkg with accumulated fixes for bird is needed:
https://gitlab.nic.cz/packaging/apkg/-/merge_requests/35
This commit is contained in:
Jakub Ružička 2021-04-06 18:13:16 +02:00 committed by Ondrej Zajicek (work)
parent c3c691e95c
commit 329d6e3fbc
30 changed files with 2448 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,5 +1,6 @@
/autom4te.cache/
/obj/
/pkg/
/Makefile
/bird
/birdc
@ -12,3 +13,4 @@
/sysdep/autoconf.h.in
/sysdep/autoconf.h.in~
/cscope.*
*.tar.gz

69
distro/README.md Normal file
View File

@ -0,0 +1,69 @@
# BIRD upstream packaging sources
This distro/ directory contains packaging sources initially copied from Debian
and Fedora downstream repos.
Files in this directory follow [apkg] conventions and apkg can be used to
create BIRD packages for various distros directly from upstream sources as
well as from upstream archives.
[apkg]: https://apkg.rtfd.io
## Create (source) package from current repo commit
Following command should build source package for current distro directly
from current repo state - run at top bird directory:
apkg srcpkg
or build native packages directly:
apkg build
or in case of disposable VM/container you can use faster direct host build
apkg build -Hi
tools/make-dev-archive script is in charge of creating archive from source.
## Create (source) package from upstream release
Following commands can be used to clone upstream repo, download current upstream
archive (tarball), and build Debian, Ubuntu, Fedora, CentOS, or OpenSUSE
source package (depending on host system) using files in bird/distro:
git clone https://gitlab.nic.cz/labs/bird
cd bird
apkg get-archive
apkg srcpkg -a pkg/archives/upstream/bird-2.0.8.tar.gz
To create native packages instead use `build`:
apkg build -a pkg/archives/upstream/bird-2.0.8.tar.gz
Or to build packages directly in case of a disposable VM/container (faster, modifies system):
apkg build -Hi -a pkg/archives/upstream/bird-2.0.8.tar.gz
## Build packages in openSUSE Build Service (OBS)
tools/make-obs script can be used on Debian-based system to create OBS
source package in pkg/obs directory ready to be uploaded:
cd bird
apkg get-archive
./tools/make-obs
# result in pkg/obs
You can also supply (upstream) archive to build from:
# or to use specified archive
./tools/make-obs pkg/archives/upstream/bird-2.0.8.tar.gz
## More Info
Please see [apkg docs][apkg].

8
distro/config/apkg.toml Normal file
View File

@ -0,0 +1,8 @@
[project]
name = "bird"
# needed for make-archive
make_archive_script = "tools/make-dev-archive"
[upstream]
# needed for get-archive
archive_url = "https://bird.network.cz/download/bird-{{ version }}.tar.gz"

286
distro/pkg/deb/bird.xml Normal file
View File

@ -0,0 +1,286 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!--
`xsltproc -''-nonet \
-''-param man.charmap.use.subset "0" \
-''-param make.year.ranges "1" \
-''-param make.single.year.ranges "1" \
/usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl \
manpage.xml'
A manual page <package>.<section> will be generated. You may view the
manual page with: nroff -man <package>.<section> | less'. A typical entry
in a Makefile or Makefile.am is:
DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0"
manpage.1: manpage.xml
$(XP) $(DB2MAN) $<
The xsltproc binary is found in the xsltproc package. The XSL files are in
docbook-xsl. A description of the parameters you can use can be found in the
docbook-xsl-doc-* packages. Please remember that if you create the nroff
version in one of the debian/rules file targets (such as build), you will need
to include xsltproc and docbook-xsl in your Build-Depends control field.
Alternatively use the xmlto command/package. That will also automatically
pull in xsltproc and docbook-xsl.
Notes for using docbook2x: docbook2x-man does not automatically create the
AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as
<refsect1> ... </refsect1>.
To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections
read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be
found in the docbook-xsl-doc-html package.
Validation can be done using: `xmllint -''-noout -''-valid manpage.xml`
General documentation about man-pages and man-page-formatting:
man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
-->
<!ENTITY dhfirstname "Giovanni">
<!ENTITY dhsurname "Mascellani">
<!ENTITY dhusername "&dhfirstname; &dhsurname;">
<!ENTITY dhemail "mascellani@poisson.phc.unipi.it">
<!ENTITY dhsection "8">
<!ENTITY dhtitle "BIRD User Manual">
]>
<refentry>
<refentryinfo>
<title>&dhtitle;</title>
<productname>bird</productname>
<authorgroup>
<author>
<firstname>&dhfirstname;</firstname>
<surname>&dhsurname;</surname>
<contrib>Wrote this manpage for the Debian system.</contrib>
<address>
<email>&dhemail;</email>
</address>
</author>
</authorgroup>
<copyright>
<year>2010</year>
<holder>&dhusername;</holder>
</copyright>
<legalnotice>
<para>This manual page was written for the Debian system
(and may be used by others).</para>
<para>Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU General Public License,
Version 2 or (at your option) any later version published by
the Free Software Foundation.</para>
<para>On Debian systems, the complete text of the GNU General Public
License can be found in
<filename>/usr/share/common-licenses/GPL</filename>.</para>
</legalnotice>
</refentryinfo>
<refmeta>
<refentrytitle>bird</refentrytitle>
<manvolnum>&dhsection;</manvolnum>
</refmeta>
<refnamediv>
<refname>bird</refname>
<refpurpose>BIRD Internet Routing Daemon</refpurpose>
</refnamediv>
<refnamediv>
<refname>birdc</refname>
<refpurpose>BIRD Internet Routing Daemon remote control</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>bird</command>
<arg choice="opt"><option>-c <replaceable>config-file</replaceable></option></arg>
<arg choice="opt"><option>-d</option></arg>
<arg choice="opt"><option>-D <replaceable>debug-file</replaceable></option></arg>
<arg choice="opt"><option>-f</option></arg>
<arg choice="opt"><option>-g <replaceable>group</replaceable></option></arg>
<arg choice="opt"><option>-l</option></arg>
<arg choice="opt"><option>-p</option></arg>
<arg choice="opt"><option>-P <replaceable>pid-file</replaceable></option></arg>
<arg choice="opt"><option>-R</option></arg>
<arg choice="opt"><option>-s <replaceable>control-socket</replaceable></option></arg>
<arg choice="opt"><option>-u <replaceable>user</replaceable></option></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>birdc</command>
<arg choice="opt"><option>-l</option></arg>
<arg choice="opt"><option>-r</option></arg>
<arg choice="opt"><option>-s <replaceable>control-socket</replaceable></option></arg>
<arg choice="opt"><option>-v</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id="description">
<title>DESCRIPTION</title>
<para><command>bird</command> is an Internet Routing Daemon. That is,
it sends and receives messages using different protocols in order to
discover and exchange routing information with other routing daemons
present on the same network. It is able to talk the most widely
known routing protocols (such as BGPv4, RIPv2, OSPFv2 and OSPFv3),
both on IPv4 and IPv6 and it features a very powerful language for
route filtering.</para>
<para><command>birdc</command> is a remote control for <command>bird</command>.
While <command>bird</command> is running, the system administrator can
connect to it using <command>birdc</command>, to inspect its internal
status and reconfigure it. The two processes use a Unix socket to
communicate. Once started, <command>bird</command> will give access
to an interactive shell: commands can be completed with TAB and help
can be requested by pressing the key `?'. More documentation on
the available commands can be foung on the website, see below.</para>
</refsect1>
<refsect1 id="options">
<title>OPTIONS</title>
<para>The <command>bird</command> accepts these options:</para>
<variablelist>
<varlistentry>
<term><option>-c <replaceable>config-file</replaceable></option></term>
<listitem>
<para>Use given configuration file instead of the default /etc/bird/bird.conf.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-d</option></term>
<listitem>
<para>Enable debug messages to stderr, and run bird in foreground.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-D <replaceable>debug-file</replaceable></option></term>
<listitem>
<para>Enable debug messages to given file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-f</option></term>
<listitem>
<para>Run bird in foreground.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-g <replaceable>group</replaceable></option></term>
<listitem>
<para>Run bird with given group ID.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--help</option></term>
<listitem>
<para>Display command-line options to bird.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-l</option></term>
<listitem>
<para>Look for a configuration file and a communication socket in the
current working directory instead of in default system locations.
However, paths specified by options <option>-c</option>,
<option>-s</option> have higher priority.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-p</option></term>
<listitem>
<para>Just parse the config file and exit. Return value is zero if the
config file is valid, nonzero if there are some errors.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-P <replaceable>pid-file</replaceable></option></term>
<listitem>
<para>Create a PID file with given filename.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-R</option></term>
<listitem>
<para>Apply graceful restart recovery after start.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-s <replaceable>control-socket</replaceable></option></term>
<listitem>
<para>Use given filename for a socket for communications with the
client (remote control), default is /run/bird/bird.ctl.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-u <replaceable>user</replaceable></option></term>
<listitem>
<para>Drop privileges and run as given user instead of root. The bird
would keep CAP_NET_ADMIN and other network-related capabilities
necessary for its function.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<listitem>
<para>Display bird version.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The <command>birdc</command> accepts these options:</para>
<variablelist>
<varlistentry>
<term><option>-l</option></term>
<listitem>
<para>Look for a communication socket in the current working directory.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-r</option></term>
<listitem>
<para>Run <command>birdc</command> in restricted mode: only the
`show ...' commands are allowed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-s <replaceable>control-socket</replaceable></option></term>
<listitem>
<para>Use given filename for a socket for communications with the
server, default is /run/bird/bird.ctl.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-v</option></term>
<listitem>
<para>Numeric return codes are dumped along with messages, making
them easily parsable by a program. See the programmer's documentation
for information about their meanings.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="files">
<title>FILES</title>
<variablelist>
<varlistentry>
<term><filename>/etc/bird/bird.conf</filename></term>
<listitem>
<para>The system-wide configuration file to control the
behaviour of <application>bird</application>. See
the website for more documentation.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="see_also">
<title>SEE ALSO</title>
<para>More documentation con be found on the website:
https://bird.network.cz/.</para>
</refsect1>
</refentry>

View File

@ -0,0 +1,4 @@
obj/doc/bird*.html
obj/doc/bird.pdf
obj/doc/prog*.html
obj/doc/prog.pdf

View File

@ -0,0 +1,136 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: bird
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
# Author: Ondřej Surý <ondrej@sury.org>
#
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="BIRD Internet Routing Daemon"
NAME=bird
DAEMON=/usr/sbin/$NAME
BIRD_ARGS=""
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# read the RUN variables
. /etc/bird/envvars
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
# Create /run/bird with correct permissions
/usr/lib/bird/prepare-environment
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --name $NAME --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --name $NAME --exec $DAEMON -- \
-u $BIRD_RUN_USER -g $BIRD_RUN_GROUP $BIRD_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --name $NAME --exec $DAEMON
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --name $NAME --exec $DAEMON
[ "$?" = 2 ] && return 2
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --name $NAME --exec $DAEMON
return 0
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
esac
;;
reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
log_daemon_msg "Reloading $DESC" "$NAME"
do_reload
log_end_msg $?
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
exit 3
;;
esac
:

View File

@ -0,0 +1,14 @@
[Unit]
Description=BIRD Internet Routing Daemon
After=network.target
[Service]
EnvironmentFile=/etc/bird/envvars
ExecStartPre=/usr/lib/bird/prepare-environment
ExecStartPre=/usr/sbin/bird -p
ExecReload=/usr/sbin/birdc configure
ExecStart=/usr/sbin/bird -f -u $BIRD_RUN_USER -g $BIRD_RUN_GROUP $BIRD_ARGS
Restart=on-abort
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,2 @@
NEWS
README

View File

@ -0,0 +1,6 @@
etc/bird/bird.conf /usr/share/bird2/
debian/envvars /etc/bird/
debian/prepare-environment /usr/lib/bird/
usr/sbin/bird
usr/sbin/birdc
usr/sbin/birdcl

View File

@ -0,0 +1 @@
bird2: binary-without-manpage usr/sbin/birdcl

View File

@ -0,0 +1,2 @@
bird.8
birdc.8

View File

@ -0,0 +1,19 @@
#!/bin/sh
set -e
if [ "$1" = "configure" ]; then
if ! getent passwd bird > /dev/null; then
adduser --quiet --system --group --no-create-home --home /run/bird bird
fi
dpkg-statoverride --list /etc/bird > /dev/null || dpkg-statoverride --update --add bird bird 0750 /etc/bird
ucf /usr/share/bird2/bird.conf /etc/bird/bird.conf
ucfr -f bird2 /etc/bird/bird.conf
dpkg-statoverride --list /etc/bird/bird.conf > /dev/null || dpkg-statoverride --update --add bird bird 0640 /etc/bird/bird.conf
fi
#DEBHELPER#
exit 0

View File

@ -0,0 +1,26 @@
#!/bin/sh
set -e
if test "$1" = "purge"; then
# Check if there is no collision of ownership of /etc/bird/bird.conf
if ! command -v ucf ucfr >/dev/null || ucfr bird2 /etc/bird/bird.conf 2>/dev/null; then
dpkg-statoverride --remove /etc/bird >/dev/null 2>/dev/null || true
dpkg-statoverride --remove /etc/bird/bird.conf >/dev/null 2>/dev/null || true
for ext in '~' '%' .bak .ucf-new .ucf-old .ucf-dist; do
rm -f /etc/bird/bird.conf$ext
done
rm -f /etc/bird/bird.conf
if command -v ucf ucfr >/dev/null; then
ucf --purge /etc/bird/bird.conf
ucfr --purge bird2 /etc/bird/bird.conf
fi
deluser --quiet bird > /dev/null || true
fi
fi
#DEBHELPER#
exit 0

5
distro/pkg/deb/changelog Normal file
View File

@ -0,0 +1,5 @@
bird2 ({{ version }}-cznic.{{ release }}) unstable; urgency=medium
* upstream package
-- Jakub Ružička <jakub.ruzicka@nic.cz> Mon, 29 Mar 2021 14:15:50 +0000

1
distro/pkg/deb/compat Normal file
View File

@ -0,0 +1 @@
9

55
distro/pkg/deb/control Normal file
View File

@ -0,0 +1,55 @@
Source: bird2
Section: net
Priority: optional
Build-Depends: bison,
debhelper,
docbook-xsl,
flex,
libncurses5-dev,
libreadline-dev | libreadline6-dev | libreadline5-dev,
libssh-gcrypt-dev,
linuxdoc-tools-latex,
m4,
opensp,
quilt,
texlive-latex-extra,
xsltproc
Maintainer: Jakub Ružička <jakub.ruzicka@nic.cz>
Uploaders: Ondřej Surý <ondrej@debian.org>
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/debian/bird2
Vcs-Git: https://salsa.debian.org/debian/bird2.git
Homepage: https://bird.network.cz/
Package: bird2
Architecture: kfreebsd-any linux-any
Pre-Depends: init-system-helpers (>= 1.56~),
${misc:Pre-Depends}
Depends: adduser,
lsb-base,
ucf,
${misc:Depends},
${shlibs:Depends}
Conflicts: bird
Suggests: bird2-doc
Description: Internet Routing Daemon
BIRD is an Internet routing daemon with full support for all the major
routing protocols. It allows redistribution between protocols with a
powerful route filtering syntax and an easy-to-use configuration
interface.
.
BIRD supports IPv4 and IPv6 versions of OSPF, RIP, BGP and Babel routing
protocols. It also supports supplementary protocols like BFD, RPKI-Router
and IPv6 router advertisements.
Package: bird2-doc
Architecture: all
Section: doc
Depends: ${misc:Depends}
Description: Internet Routing Daemon - documentation
BIRD is an Internet routing daemon with full support for all the major
routing protocols. It allows redistribution between protocols with a
powerful route filtering syntax and an easy-to-use configuration
interface.
.
This package provides the user and developer documentation.

99
distro/pkg/deb/copyright Normal file
View File

@ -0,0 +1,99 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: bird
Upstream-Contact: bird-users@network.cz
Source: https://bird.network.cz
Files: *
Copyright: 1998-2008 Martin Mareš
1998-2019 Ondřej Filip
1998-2000 Pavel Machek
2008-2019 Ondřej Zajíček
2015-2019 Maria Matějka
License: GPL-2+
Files: lib/heap.h
Copyright: 2001 Martin Mareš <mj@ucw.cz>
2005 Tomáš Valla <tom@ucw.cz>
License: LGPL-2+
Files: lib/md5.c
Copyright: 1993 Colin Plumb
License: public-domain
Files: lib/printf.c
Copyright: 1991-1992 Lars Wirzenius
1991-1992 Linus Torvalds
1998-2000 Martin Mareš
License: GPL-2
Files: lib/sha*
Copyright: 1998-2009 Free Software Foundation, Inc.
2015-2016 Pavel Tvrdík
2015-2016 Ondřej Zajíček
License: GPL-2+
Files: proto/babel/*
Copyright: 2015-2016 Toke Høiland-Jørgensen
2016-2018 Ondřej Zajíček
License: GPL-2+
Files: proto/rpki/*
Copyright: 2015-2016 Pavel Tvrdík
2016-2018 Ondřej Zajíček
License: GPL-2+
Files: debian/*
Copyright: 2010-2013 Ondřej Surý <ondrej@debian.org>
License: GPL-2+
License: GPL-2+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
.
On Debian systems, the complete text of the GNU General Public License
version 2 can be found in `/usr/share/common-licenses/GPL-2'.
License: GPL-2
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
.
On Debian systems, the complete text of the GNU General Public License
version 2 can be found in `/usr/share/common-licenses/GPL-2'.
License: LGPL-2+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
.
On Debian systems, the complete text of the GNU Lesser General Public
License version 2 can be found in `/usr/share/common-licenses/LGPL-2'.
License: public-domain
This code is in the public domain; do with it what you wish.

3
distro/pkg/deb/envvars Normal file
View File

@ -0,0 +1,3 @@
BIRD_RUN_USER=bird
BIRD_RUN_GROUP=bird
#BIRD_ARGS=

9
distro/pkg/deb/gbp.conf Normal file
View File

@ -0,0 +1,9 @@
[DEFAULT]
debian-branch = master
debian-tag = debian/%(version)s
upstream-branch = upstream
upstream-tag = upstream/%(version)s
pristine-tar = True
[dch]
meta = 1

View File

@ -0,0 +1 @@
0001-Sync-the-linuxdoc-mangled-files-with-linuxdoc-tools_.patch

View File

@ -0,0 +1,28 @@
#!/bin/sh
set -eu
BIRD_RUN_DIR=/run/bird
. /etc/bird/envvars
mkdir --parents "$BIRD_RUN_DIR";
if [ -n "$BIRD_RUN_USER" ]; then
if ! getent passwd $BIRD_RUN_USER >/dev/null; then
echo "Configured user '$BIRD_RUN_USER' doesn't exist."
exit 1
fi
fi
if [ -n "$BIRD_RUN_GROUP" ]; then
if ! getent group $BIRD_RUN_GROUP >/dev/null; then
echo "Configured group '$BIRD_RUN_GROUP' doesn't exist."
exit 1
fi
fi
chown --silent "$BIRD_RUN_USER:$BIRD_RUN_GROUP" "$BIRD_RUN_DIR"
chmod 775 "$BIRD_RUN_DIR"
:

56
distro/pkg/deb/rules Executable file
View File

@ -0,0 +1,56 @@
#!/usr/bin/make -f
# -*- makefile -*-
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
COMMON_FLAGS= --prefix=/usr --sysconfdir=/etc/bird --mandir=\$${prefix}/share/man \
--infodir=\$${prefix}/share/info --localstatedir=/var --runstatedir=/run/bird \
--docdir=\$${prefix}/share/bird2 \
--enable-client
CFLAGS += -g -O2 -fno-strict-aliasing -fno-strict-overflow -fPIC
LDFLAGS += -g -O2 -fno-strict-aliasing -fno-strict-overflow -fPIC -Wl,-z,defs -Wl,--as-needed
%:
dh $@
override_dh_auto_configure:
CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" dh_auto_configure -- $(COMMON_FLAGS) --with-protocols=all
override_dh_auto_build:
dh_auto_build
dh_auto_build -- docs
override_dh_auto_install:
dh_auto_install --destdir=debian/tmp
override_dh_installinit:
dh_installinit --name=bird --restart-after-upgrade
override_dh_installsystemd:
dh_installsystemd --name=bird --restart-after-upgrade
DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0"
bird.8: debian/bird.xml
$(XP) $(DB2MAN) $<
override_dh_installman: bird.8
dh_installman
override_dh_clean:
dh_clean
-rm -f bird.8 birdc.8
override_dh_missing:
dh_missing --fail-missing
override_dh_compress:
dh_compress -X.conf

View File

@ -0,0 +1 @@
3.0 (quilt)

2
distro/pkg/deb/watch Normal file
View File

@ -0,0 +1,2 @@
version=3
https://bird.network.cz/download/bird-(2\.[\d.]+).tar.gz

View File

@ -0,0 +1,13 @@
[Unit]
Description=BIRD Internet Routing Daemon
Wants=network.target
After=network.target
[Service]
Type=simple
ExecStart=/usr/sbin/bird -f -u bird -g bird
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target

121
distro/pkg/rpm/bird.spec Normal file
View File

@ -0,0 +1,121 @@
%global _hardened_build 1
%if "x%{?suse_version}" == "x"
# missing linuxdoc-tools and sgml-common on SUSE
%define _without_doc 1
%endif
Name: bird
Version: {{ version }}
Release: cznic.{{ release }}%{?dist}
Summary: BIRD Internet Routing Daemon
License: GPLv2+
URL: https://bird.network.cz/
Source0: https://bird.network.cz/download/bird-%{version}.tar.gz
Source1: bird.service
Source2: bird.tmpfilesd
BuildRequires: flex
BuildRequires: bison
BuildRequires: ncurses-devel
BuildRequires: readline-devel
BuildRequires: sed
BuildRequires: gcc
BuildRequires: make
BuildRequires: libssh-devel
%if 0%{?fedora} || (0%{?rhel} && 0%{?rhel} > 7)
BuildRequires: systemd-rpm-macros
%else
BuildRequires: systemd
%endif
Obsoletes: bird6 < 2.0.2-1
Provides: bird6 = %{version}-%{release}
%description
BIRD is a dynamic IP routing daemon supporting both, IPv4 and IPv6, Border
Gateway Protocol (BGPv4), Routing Information Protocol (RIPv2, RIPng), Open
Shortest Path First protocol (OSPFv2, OSPFv3), Babel Routing Protocol (Babel),
Bidirectional Forwarding Detection (BFD), IPv6 router advertisements, static
routes, inter-table protocol, command-line interface allowing on-line control
and inspection of the status of the daemon, soft reconfiguration as well as a
powerful language for route filtering.
%if 0%{!?_without_doc:1}
%package doc
Summary: Documentation for BIRD Internet Routing Daemon
BuildRequires: linuxdoc-tools sgml-common perl(FindBin)
BuildArch: noarch
%description doc
Documentation for users and programmers of the BIRD Internet Routing Daemon.
BIRD is a dynamic IP routing daemon supporting both, IPv4 and IPv6, Border
Gateway Protocol (BGPv4), Routing Information Protocol (RIPv2, RIPng), Open
Shortest Path First protocol (OSPFv2, OSPFv3), Babel Routing Protocol (Babel),
Bidirectional Forwarding Detection (BFD), IPv6 router advertisements, static
routes, inter-table protocol, command-line interface allowing on-line control
and inspection of the status of the daemon, soft reconfiguration as well as a
powerful language for route filtering.
%endif
%prep
%setup -q
%build
%configure --runstatedir=%{_rundir}/bird
%make_build all %{!?_without_doc:docs}
%install
%make_install
{% raw %}
install -d %{buildroot}{%{_localstatedir}/lib/bird,%{_rundir}/bird}
install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/bird.service
install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/bird.conf
{% endraw %}
%check
make test
%pre
getent group bird >/dev/null || groupadd -r bird
getent passwd bird >/dev/null || \
useradd -r -g bird -d %{_localstatedir}/lib/bird -s /sbin/nologin \
-c "BIRD daemon user" bird
exit 0
%post
%systemd_post bird.service
%preun
%systemd_preun bird.service
%postun
%systemd_postun_with_restart bird.service
%files
%doc NEWS README
%attr(0640,root,bird) %config(noreplace) %{_sysconfdir}/bird.conf
%{_unitdir}/bird.service
%{_tmpfilesdir}/bird.conf
%{_sbindir}/bird
%{_sbindir}/birdc
%{_sbindir}/birdcl
%dir %attr(0750,bird,bird) %{_localstatedir}/lib/bird
%dir %attr(0750,bird,bird) %{_rundir}/bird
%if 0%{!?_without_doc:1}
%files doc
%doc NEWS README
%doc doc/bird.conf.*
%doc obj/doc/bird*.html
%doc obj/doc/bird.pdf
%doc obj/doc/prog*.html
%doc obj/doc/prog.pdf
%endif
%changelog
* Wed Apr 07 2021 Jakub Ružička <jakub.ruzicka@nic.cz> - {{ version }}-cznic.1
- upstream package

View File

@ -0,0 +1 @@
d /run/bird 750 bird bird

38
tools/make-dev-archive Executable file
View File

@ -0,0 +1,38 @@
#!/bin/sh
#
# This a modified version of gendist script which generates development
# archive (tarball) without docs from current sources.
BIRD_VERSION=`grep 'BIRD_VERSION \"' sysdep/config.h | sed '/BIRD_VERSION/!d;s/^.*"\(.*\)"$/\1/'`
# differentiate dev tarballs from upstream ones
GIT_HASH=$(git rev-parse --short HEAD )
TIMESTAMP=$(date -u +'%s' 2>/dev/null)
VERSION=$BIRD_VERSION.$TIMESTAMP.$GIT_HASH
REL=bird-$VERSION
T=/tmp/bird
AC=autoreconf
set -e
# prepare output dir
rm -rf $T/$REL
mkdir -p $T/$REL
$AC
# cleanup
find . -name "*~" -exec rm -f '{}' '+'
rm -rf autom4te*cache
echo Building $REL
cp -a . $T/$REL
echo Generating ChangeLog
git log >$T/$REL/ChangeLog
rm -f $T/$REL/bird.conf*
rm -rf $T/$REL/.git/
rm -rf `find $T/$REL -name CVS -o -name tmp` $T/$REL/{misc,rfc,doc/slides,doc/slt2001,doc/old,doc/*.out}
( cd $T ; tar czvvf $REL.tar.gz $REL )
rm -rf $T/$REL
echo $T/$REL.tar.gz

46
tools/make-obs Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# create OpenSUSE Build System (OBS) source package
#
# this needs to be run on a (Debian-based) system with:
#
# * apkg
# * dpkg-buildpackage
#
# run from project root containing distro/ dir:
#
# ./tools/make-obs [path/to/archive.tar.gz]
#
# supply archives as optional arguments to build from,
# otherwise archive will be built from sources by apkg
#
# output at ./pkg/obs/ (removed on each run)
set -o errexit -o nounset
OUTDIR="pkg/obs"
APKG_OPTS="-O $OUTDIR"
if [ -z $@ ]; then
echo "building OBS srcpkg from project files"
else
AR=$1
echo "building OBS srcpkg from specified archive(s)"
APKG_OPTS="-a $AR $APKG_OPTS"
fi
if [ -n "$RELEASE" ]; then
echo "custom release: $RELEASE"
APKG_OPTS="-r $RELEASE $APKG_OPTS"
fi
set -o xtrace
: removing existing output files at output dir: $OUTDIR
rm -rf "$OUTDIR"
: making debian source package from archive
apkg srcpkg $APKG_OPTS -d debian
: removing extra debian source package files
rm -f $OUTDIR/*_source.*
: rendering RPM template
apkg srcpkg $APKG_OPTS -d fedora --render-template
: fixing RPM .spec to use debian source archive
sed -i 's/^\(Source0:\s\+\).*/\1bird2_%{version}.orig.tar.gz/' $OUTDIR/*.spec
echo "OBS srcpkg ready at: $OUTDIR"