pkgrel=0
pkgdesc="Free Range Routing is a fork of quagga"
url="https://frrouting.org/"
-arch="all"
+arch="x86_64"
license="GPL-2.0"
-depends="iproute2 json-c c-ares ipsec-tools iproute2"
+depends="json-c c-ares ipsec-tools iproute2 python py-ipaddr bash"
makedepends="ncurses-dev net-snmp-dev gawk texinfo perl
acct autoconf automake bash
binutils binutils-libs bison bsd-compat-headers build-base
patch pax-utils pcre perl pkgconf python2 python2-dev readline
readline-dev sqlite-libs squashfs-tools sudo tar texinfo xorriso xz-libs
py-sphinx"
+install="$pkgname.pre-install $pkgname.pre-deinstall $pkgname.post-deinstall"
subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg"
-source="$pkgname-$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz docker-start daemons daemons.conf"
builddir="$srcdir"/$pkgname-$pkgver
+_sbindir=/usr/lib/frr
+_sysconfdir=/etc/frr
+_libdir=/usr/lib
+_localstatedir=/var/run/frr
+_user=frr
+
build() {
cd "$builddir"
- ./configure --prefix=/usr || return 1
+ ./configure \
+ --prefix=/usr \
+ --sbindir=$_sbindir \
+ --sysconfdir=$_sysconfdir \
+ --libdir=$_libdir \
+ --localstatedir=$_localstatedir \
+ --enable-systemd=no \
+ --enable-vtysh \
+ --enable-multipath=64 \
+ --enable-vty-group=frrvty \
+ --enable-user=$_user \
+ --enable-group=$_user || return 1
make || return 1
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install || return 1
+
+ install -Dm755 "$srcdir"/docker-start "$pkgdir"$_sbindir
+ install -Dm644 "$srcdir"/daemons "$pkgdir"$_sysconfdir
+ install -Dm644 "$srcdir"/daemons.conf "$pkgdir"$_sysconfdir
+ install -d "$pkgdir"/etc/init.d
+ ln -s ${_sbindir}/frr "$pkgdir"/etc/init.d/frr
}
--- /dev/null
+#!/bin/sh
+
+set -e
+
+##
+# For volume mounts...
+##
+chown -R frr:frr /etc/frr
+/etc/init.d/frr start
+exec sleep 10000d
--- /dev/null
+#!/bin/sh
+
+getent passwd frr > /dev/null && deluser frr
+getent group frrvty > /dev/null && delgroup frrvty
+getent group frr > /dev/null && delgroup frr
+exit 0
--- /dev/null
+#!/bin/sh
+
+/etc/init.d/frr stop
+exit 0
--- /dev/null
+#!/bin/sh
+
+for g in frr frrvty; do
+ ! getent group $g > /dev/null && addgroup -S $g
+done
+
+! getent passwd frr > /dev/null && \
+ adduser -S -D -h /var/run/frr -s /sbin/nologin -G frr -g frr frr
+
+adduser frr frrvty
::
- docker run -it --rm frr:latest /bin/sh
+ docker run -it --rm --name frr frr:latest
-Currently, we only package the raw daemons and example files, so, you'll
-need to run the daemons by hand (or, better, orchestrate in the Dockerfile).
+In the default configuration, none of the frr daemons will be running.
+To configure the daemons, exec into the container and edit the configuration
+files or mount a volume with configuration files into the container on
+startup. To configure by hand:
-We can also build directly from docker-compose, with a docker-compose.yml file
-like this one:
+::
+
+ docker exec -it frr /bin/sh
+ vi /etc/frr/daemons
+ vi /etc/frr/daemons.conf
+ cp /etc/frr/zebra.conf.sample /etc/frr/zebra.conf
+ vi /etc/frr/zebra.conf
+ /etc/init.d/frr start
+
+Or, to configure the daemons using /etc/frr from a host volume, put the
+config files in, say, ./docker/etc and bind mount that into the
+container:
+
+::
+
+ docker run -it --rm -v `pwd`/docker/etc:/etc/frr frr:latest
+
+We can also build the base image directly from docker-compose, with a
+docker-compose.yml file like this one:
::
RUN apk add --no-cache abuild alpine-sdk && mkdir -p /pkgs/apk
ADD docker/alpine/alpine-build.sh /usr/bin/
ADD docker/alpine/builder /etc/sudoers.d
-COPY --from=source-builder /src/*.tar.gz /src/alpine/APKBUILD /dist/
+COPY --from=source-builder /src/*.tar.gz /src/alpine/* /src/tools/etc/frr/daemons* /dist/
RUN adduser -D -G abuild builder && chown -R builder /dist /pkgs
USER builder
RUN /usr/bin/alpine-build.sh
FROM alpine:3.7
RUN mkdir -p /pkgs/apk
COPY --from=alpine-builder /pkgs/apk/ /pkgs/apk/
+RUN apk add --no-cache tini
RUN apk add --no-cache --allow-untrusted /pkgs/apk/x86_64/*.apk
+ENTRYPOINT [ "/sbin/tini", "--", "/usr/lib/frr/docker-start" ]
MAX_INSTANCES=5
RELOAD_SCRIPT=/usr/lib/frr/frr-reload.py
-. /lib/lsb/init-functions
+if [ -e /lib/lsb/init-functions ]; then
+ . /lib/lsb/init-functions
+fi
if [ -f /usr/lib/frr/ssd ]; then
SSD=/usr/lib/frr/ssd