snapcraft: Add snapcraft build and definition files

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
This commit is contained in:
Martin Winter 2017-01-26 04:23:43 +07:00
parent dfa7df29a8
commit 3ab11ecc7b
29 changed files with 570 additions and 2 deletions

View file

@ -3,11 +3,11 @@
SUBDIRS = lib qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@ \ SUBDIRS = lib qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@ \
@BGPD@ @RIPD@ @RIPNGD@ @OSPFD@ @OSPF6D@ @LDPD@ \ @BGPD@ @RIPD@ @RIPNGD@ @OSPFD@ @OSPF6D@ @LDPD@ \
@ISISD@ @PIMD@ @WATCHFRR@ @VTYSH@ @OSPFCLIENT@ @DOC@ m4 @pkgsrcdir@ \ @ISISD@ @PIMD@ @WATCHFRR@ @VTYSH@ @OSPFCLIENT@ @DOC@ m4 @pkgsrcdir@ \
redhat @SOLARIS@ tests tools cumulus redhat @SOLARIS@ tests tools cumulus snapcraft
DIST_SUBDIRS = lib qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd \ DIST_SUBDIRS = lib qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd \
isisd watchfrr vtysh ospfclient doc m4 pkgsrc redhat tests \ isisd watchfrr vtysh ospfclient doc m4 pkgsrc redhat tests \
solaris pimd @LIBRFP@ @RFPTEST@ tools cumulus solaris pimd @LIBRFP@ @RFPTEST@ tools cumulus snapcraft
EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS \ EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS \
update-autotools \ update-autotools \

View file

@ -483,6 +483,7 @@ dnl -----------------------------------
if test "x${EXTRAVERSION}" != "x" ; then if test "x${EXTRAVERSION}" != "x" ; then
VERSION="${VERSION}${EXTRAVERSION}" VERSION="${VERSION}${EXTRAVERSION}"
PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}" PACKAGE_VERSION="${PACKAGE_VERSION}${EXTRAVERSION}"
AC_SUBST(PACKAGE_EXTRAVERSION, ["${EXTRAVERSION}"])
PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}" PACKAGE_STRING="${PACKAGE_STRING}${EXTRAVERSION}"
fi fi
@ -1617,6 +1618,8 @@ AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
pkgsrc/Makefile pkgsrc/Makefile
fpm/Makefile fpm/Makefile
redhat/frr.spec redhat/frr.spec
snapcraft/Makefile
snapcraft/snapcraft.yaml
lib/version.h lib/version.h
doc/defines.texi doc/defines.texi
doc/bgpd.8 doc/bgpd.8

6
snapcraft/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
snapcraft.yaml
parts
prime
stage
quagga*.snap
!*/Makefile

11
snapcraft/Makefile.am Normal file
View file

@ -0,0 +1,11 @@
EXTRA_DIST = snapcraft.yaml \
scripts/Makefile scripts/zebra-service scripts/bgpd-service \
scripts/isisd-service scripts/ripd-service scripts/ripngd-service \
scripts/ospf6d-service scripts/ospfd-service \
scripts/isisd-service scripts/pimd-service \
scripts/ldpd-service \
defaults/bgpd.conf.default defaults/isisd.conf.default \
defaults/ospf6d.conf.default defaults/ospfd.conf.default \
defaults/pimd.conf.default defaults/zebra.conf.default \
defaults/ripd.conf.default defaults/ripngd.conf.default \
defaults/ldpd.conf.default defaults/vtysh.conf.default

View file

@ -0,0 +1,93 @@
Building your own FreeRangeRouting Snap
========================================
(Tested on Ubuntu 16.04 with Snap Version 2, does not work on Ubuntu 15.x
which uses earlier versions of snaps)
1. Install snapcraft:
sudo apt-get install snapcraft
2. Checkout FreeRangeRouting under a **unpriviledged** user account
git clone https://github.com/freerangerouting/frr.git
cd frr
3. Run Bootstrap and make distribution tar.gz
./bootstrap.sh
./configure --with-pkg-extra-version=-MySnapVersion
make dist
Note: configure parameters are not important for the Snap building,
except the `with-pkg-extra-version` if you want to give the Snap
a specific name to mark your own unoffical build
This will build `frr-something.tar.gz` - the distribution tar and
the snapcraft/snapcraft.yaml with the matching version number
4. Create snap
cd snapcraft
snapcraft
You should now end up with `frr_something.snap`
Installing the snap
===================
(This can be done on a different system)
1. Install snapd
sudo apt-get install snapd
2. Install self-built frr snap. (`--force-dangerous` is required to
install a unsigned self-built snap)
snap install --force-dangerous ./frr*.snap
Connect the priviledged `network-control` plug to the snap:
snap connect frr:network-control ubuntu-core:network-control
DONE.
The Snap will be auto-started and running.
Operations
==========
### FreeRangeRouting Daemons
At this time, all FreeRangeRouting daemons are auto-started.
A daemon can be stopped/started with (ie ospf6d)
systemctl stop snap.frr.ospf6d.service
systemctl start snap.frr.ospf6d.service
or disabled/enabled with
systemctl disable snap.frr.ospf6d.service
systemctl enable snap.frr.ospf6d.service
### FreeRangeRouting Commands
All the commands are prefixed with frr.
frr.vtysh -> vtysh
frr.version -> Just gives version output (zebra --version)
frr.readme -> Returns simple README with hints on using FRR
frr.bgpd-debug -> Directly start each daemon (without service)
frr.isisd-debug
frr.ospf6d-debug
frr.ospfd-debug
frr.pimd-debug
frr.ripd-debug
frr.ripngd-debug
frr.ldp-debug
frr.zebra-debug
vtysh can be accessed as frr.vtysh (Make sure you have /snap/bin in your
path). If access as `vtysh` instead of `frr.vtysh` is needed, a symlink
can be created:
sudo ln -s /snap/bin/frr.vtysh /usr/local/bin/vtysh

77
snapcraft/README.usage.md Normal file
View file

@ -0,0 +1,77 @@
Using the FreeRangeRouting Snap
===============================
After installing the Snap, the priviledged plug need to be connected:
snap connect frr:network-control ubuntu-core:network-control
Enabling/Disabling FreeRangeRouting Daemons
-------------------------------------------
By default (at this time), all FreeRangeRouting daemons will be enabled
on installation. If you want to disable a specific daemon, then use
the systemctl commands
ie for `ospf6d` (OSPFv3):
systemctl disable snap.frr.ospf6d.service
systemctl enable snap.frr.ospf6d.service
The daemons are: `ripd`, `ripngd`, `ospfd`, `ospf6d`, `isisd`, `bgpd`,
`pimd`, `zebra`
Commands defined by this snap
-----------------------------
- `frr.vtysh`:
FreeRangeRouting VTY Shell (configuration tool)
- `frr.version`:
Returns output of `zebra --version` to display version and configured
options
- `frr.readme`:
Returns this document `cat README_usage.md`
and for debugging defined at this time (May get removed later - do not
depend on them). These are mainly intended to debug the Snap
- `frr.zebra-debug`:
Starts zebra daemon in foreground
- `frr.ripd-debug`:
Starts ripd daemon in foreground
- `frr.ripngd-debug`:
Starts ripng daemon in foreground
- `frr.ospfd-debug`:
Starts ospfd daemon in foreground
- `frr.ospf6d-debug`:
Starts ospf6d daemon in foreground
- `frr.isisd-debug`:
Starts isisd daemon in foreground
- `frr.bgpd-debug`:
Starts bgpd daemon in foreground
- `frr.pimd-debug`:
Starts pimd daemon in foreground
- `frr.ldpd-debug`:
Starts ldpd daemon in foreground
FAQ
---
- frr.vtysh displays `--MORE--` on long output. How to suppress this?
- Define `VTYSH_PAGER` to `cat` (default is `more`). (Ie add
`export VTYSH_PAGER=cat` to the end of your `.profile`)
Sourcecode available
====================
The source for this SNAP is available as part of the FreeRangeRouting
Source Code Distribution.
https://github.com/freerangerouting/frr.git
Instructions for rebuilding the snap are in `README.snap_build.md`
Feedback welcome
================
Please send Feedback about this snap to Martin Winter at
`mwinter@opensourcerouting.org`

View file

View file

View file

View file

View file

View file

View file

View file

View file

@ -0,0 +1 @@
no service integrated-vtysh-config

View file

View file

@ -0,0 +1,7 @@
all:
install:
install -D -m 0755 $(DESTDIR)/usr/bin/telnet.netkit $(DESTDIR)/bin/telnet
install -D -m 0755 $(DESTDIR)/usr/bin/traceroute.db $(DESTDIR)/bin/traceroute
install -D -m 0755 $(DESTDIR)/usr/bin/traceroute6.db $(DESTDIR)/bin/traceroute6

View file

@ -0,0 +1,14 @@
all:
install:
mkdir -p $(DESTDIR)/bin
install -D -m 0755 zebra-service $(DESTDIR)/bin/
install -D -m 0755 bgpd-service $(DESTDIR)/bin/
install -D -m 0755 ospfd-service $(DESTDIR)/bin/
install -D -m 0755 ospf6d-service $(DESTDIR)/bin/
install -D -m 0755 ripd-service $(DESTDIR)/bin/
install -D -m 0755 ripngd-service $(DESTDIR)/bin/
install -D -m 0755 isisd-service $(DESTDIR)/bin/
install -D -m 0755 pimd-service $(DESTDIR)/bin/
install -D -m 0755 ldpd-service $(DESTDIR)/bin/

View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e -x
if ! [ -e $SNAP_DATA/bgpd.conf ]; then
cp $SNAP/etc/frr/bgpd.conf.default $SNAP_DATA/bgpd.conf
fi
exec $SNAP/sbin/bgpd \
-f $SNAP_DATA/bgpd.conf \
--pid_file $SNAP_DATA/bgpd.pid \
--socket $SNAP_DATA/zsock \
--vty_socket $SNAP_DATA

View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e -x
if ! [ -e $SNAP_DATA/isisd.conf ]; then
cp $SNAP/etc/frr/isisd.conf.default $SNAP_DATA/isisd.conf
fi
exec $SNAP/sbin/isisd \
-f $SNAP_DATA/isisd.conf \
--pid_file $SNAP_DATA/isisd.pid \
--socket $SNAP_DATA/zsock \
--vty_socket $SNAP_DATA

View file

@ -0,0 +1,14 @@
#!/bin/sh
set -e -x
if ! [ -e $SNAP_DATA/ldpd.conf ]; then
cp $SNAP/etc/frr/ldpd.conf.default $SNAP_DATA/ldpd.conf
fi
exec $SNAP/sbin/ldpd \
-f $SNAP_DATA/ldpd.conf \
--pid_file $SNAP_DATA/ldpd.pid \
--socket $SNAP_DATA/zsock \
--ctl_socket $SNAP_DATA \
--vty_socket $SNAP_DATA

View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e -x
if ! [ -e $SNAP_DATA/ospf6d.conf ]; then
cp $SNAP/etc/frr/ospf6d.conf.default $SNAP_DATA/ospf6d.conf
fi
exec $SNAP/sbin/ospf6d \
-f $SNAP_DATA/ospf6d.conf \
--pid_file $SNAP_DATA/ospf6d.pid \
--socket $SNAP_DATA/zsock \
--vty_socket $SNAP_DATA

View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e -x
if ! [ -e $SNAP_DATA/ospfd.conf ]; then
cp $SNAP/etc/frr/ospfd.conf.default $SNAP_DATA/ospfd.conf
fi
exec $SNAP/sbin/ospfd \
-f $SNAP_DATA/ospfd.conf \
--pid_file $SNAP_DATA/ospfd.pid \
--socket $SNAP_DATA/zsock \
--vty_socket $SNAP_DATA

View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e -x
if ! [ -e $SNAP_DATA/pimd.conf ]; then
cp $SNAP/etc/frr/pimd.conf.default $SNAP_DATA/pimd.conf
fi
exec $SNAP/sbin/pimd \
-f $SNAP_DATA/pimd.conf \
--pid_file $SNAP_DATA/pimd.pid \
--socket $SNAP_DATA/zsock \
--vty_socket $SNAP_DATA

View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e -x
if ! [ -e $SNAP_DATA/ripd.conf ]; then
cp $SNAP/etc/frr/ripd.conf.default $SNAP_DATA/ripd.conf
fi
exec $SNAP/sbin/ripd \
-f $SNAP_DATA/ripd.conf \
--pid_file $SNAP_DATA/ripd.pid \
--socket $SNAP_DATA/zsock \
--vty_socket $SNAP_DATA

View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e -x
if ! [ -e $SNAP_DATA/ripngd.conf ]; then
cp $SNAP/etc/frr/ripngd.conf.default $SNAP_DATA/ripngd.conf
fi
exec $SNAP/sbin/ripngd \
-f $SNAP_DATA/ripngd.conf \
--pid_file $SNAP_DATA/ripngd.pid \
--socket $SNAP_DATA/zsock \
--vty_socket $SNAP_DATA

View file

@ -0,0 +1,16 @@
#!/bin/sh
set -e -x
if ! [ -e $SNAP_DATA/zebra.conf ]; then
cp $SNAP/etc/frr/zebra.conf.default $SNAP_DATA/zebra.conf
fi
if ! [ -e $SNAP_DATA/vtysh.conf ]; then
cp $SNAP/etc/frr/vtysh.conf.default $SNAP_DATA/vtysh.conf
fi
exec $SNAP/sbin/zebra \
-f $SNAP_DATA/zebra.conf \
--pid_file $SNAP_DATA/zebra.pid \
--socket $SNAP_DATA/zsock \
--vty_socket $SNAP_DATA

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

235
snapcraft/snapcraft.yaml.in Normal file
View file

@ -0,0 +1,235 @@
name: frr
version: @VERSION@
summary: FreeRangeRouting BGP/OSPFv2/OSPFv3/ISIS/RIP/RIPng/PIM/LDP routing daemon
description: BGP/OSPFv2/OSPFv3/ISIS/RIP/RIPng/PIM routing daemon
FreeRangeRouting (FRR) is free software which manages TCP/IP based routing
protocols. It supports BGP4, BGP4+, OSPFv2, OSPFv3, IS-IS, RIPv1, RIPv2,
RIPng, PIM and LDP as well as the IPv6 versions of these.
FreeRangeRouting (frr) is a fork of Quagga.
confinement: strict
grade: devel
apps:
vtysh:
command: bin/vtysh --vty_socket $SNAP_DATA --config_dir $SNAP_DATA
plugs:
- network
- network-bind
- network-control
version:
command: sbin/zebra --version
readme:
command: bin/cat $SNAP/doc/README.usage.md
zebra:
command: bin/zebra-service
daemon: simple
plugs:
- network
- network-bind
- network-control
bgpd:
command: bin/bgpd-service
daemon: simple
plugs:
- network
- network-bind
- network-control
ospfd:
command: bin/ospfd-service
daemon: simple
plugs:
- network
- network-bind
- network-control
ospf6d:
command: bin/ospf6d-service
daemon: simple
plugs:
- network
- network-bind
- network-control
isisd:
command: bin/isisd-service
daemon: simple
plugs:
- network
- network-bind
- network-control
ripd:
command: bin/ripd-service
daemon: simple
plugs:
- network
- network-bind
- network-control
ripngd:
command: bin/ripngd-service
daemon: simple
plugs:
- network
- network-bind
- network-control
pimd:
command: bin/pimd-service
daemon: simple
plugs:
- network
- network-bind
- network-control
ldpd:
command: bin/ldpd-service
daemon: simple
plugs:
- network
- network-bind
- network-control
zebra-debug:
command: sbin/zebra -f $SNAP_DATA/zebra.conf --pid_file $SNAP_DATA/zebra.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
- network-control
bgpd-debug:
command: sbin/bgpd -f $SNAP_DATA/bgpd.conf --pid_file $SNAP_DATA/bgpd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
- network-control
ospfd-debug:
command: sbin/ospfd -f $SNAP_DATA/ospfd.conf --pid_file $SNAP_DATA/ospfd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
- network-control
ospf6d-debug:
command: sbin/ospf6d -f $SNAP_DATA/ospf6d.conf --pid_file $SNAP_DATA/ospf6d.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
- network-control
isisd-debug:
command: sbin/isisd -f $SNAP_DATA/isisd.conf --pid_file $SNAP_DATA/isisd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
- network-control
ripd-debug:
command: sbin/ripd -f $SNAP_DATA/ripd.conf --pid_file $SNAP_DATA/ripd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
- network-control
ripngd-debug:
command: sbin/ripngd -f $SNAP_DATA/ripngd.conf --pid_file $SNAP_DATA/ripngd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
- network-control
pimd-debug:
command: sbin/pimd -f $SNAP_DATA/pimd.conf --pid_file $SNAP_DATA/pimd.pid --socket $SNAP_DATA/zsock --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
- network-control
ldpd-debug:
command: sbin/ldpd -f $SNAP_DATA/pimd.conf --pid_file $SNAP_DATA/pimd.pid --socket $SNAP_DATA/zsock --ctl_socket $SNAP_DATA --vty_socket $SNAP_DATA
plugs:
- network
- network-bind
- network-control
parts:
frr:
build-packages:
- autoconf
- automake
- libtool
- make
- gawk
- libreadline-dev
- texinfo
- dejagnu
- libncurses5-dev
- texlive-latex-base
- texlive-generic-recommended
- libcap-dev
- imagemagick
- ghostscript
- groff
- hardening-wrapper
- libpcre3-dev
- chrpath
- pkg-config
- libjson-c-dev
stage-packages:
- coreutils
- iproute2
- logrotate
- libcap2
- libc6
- libtinfo5
- libreadline6
- libjson-c2
plugin: autotools
source: ../frr-@PACKAGE_VERSION@.tar.gz
configflags:
- --with-cflags=-g
- --with-cflags=-O0
- --with-cflags=-std=gnu99
- --with-cflags=-fpie
- --with-cflags=-fno-omit-frame-pointer
- --with-cflags=-Wall
- --enable-vtysh
- --enable-isisd
- --enable-watchfrr
- --enable-ospfclient=yes
- --enable-ospfapi=yes
- --enable-multipath=64
- --enable-rtadv
- --enable-irdp
- --enable-gcc-rdynamic
- --enable-user=root
- --enable-group=root
- --enable-pimd
- --enable-ldpd
- --enable-configfile-mask=0640
- --enable-logfile-mask=0640
- --localstatedir=/var/run
- --sbindir=/sbin
- --bindir=/bin
- --sysconfdir=/etc/frr
- --with-pkg-extra-version=@PACKAGE_EXTRAVERSION@
frr-defaults:
plugin: dump
source: defaults
organize:
zebra.conf.default: etc/frr/zebra.conf.default
bgpd.conf.default: etc/frr/bgpd.conf.default
isisd.conf.default: etc/frr/isisd.conf.default
ospf6d.conf.default: etc/frr/ospf6d.conf.default
ospfd.conf.default: etc/frr/ospfd.conf.default
pimd.conf.default: etc/frr/pimd.conf.default
ripd.conf.default: etc/frr/ripd.conf.default
ripngd.conf.default: etc/frr/ripngd.conf.default
ldpd.conf.default: etc/frr/ldpd.conf.default
vtysh.conf.default: etc/frr/vtysh.conf.default
frr-scripts:
plugin: make
source: scripts
helpers:
stage-packages:
- telnet
- traceroute
plugin: make
source: helpers
prime:
- bin/telnet
- bin/traceroute
- bin/traceroute6
docs:
plugin: dump
source: .
organize:
README.usage.md: doc/README.usage.md
README.snap_build.md: doc/README.snap_build.md