build: apply DFLT_NAME/profiles in init script

Hopefully at some point we can get rid of the --enable-datacenter switch
and just have the init script do magic.  Should already work for Cumulus
as it is.

NB: the profile name can't be baked into the package.  The whole point
is to make the package profile-agnostic;  in theory at some point the
exact same package files should work on both, say, a Cumulus switch and
a Linux software BGP DFZ router.

Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
David Lamparter 2018-10-26 19:33:20 +02:00 committed by David Lamparter
parent f210b3e300
commit 684959068c
4 changed files with 37 additions and 5 deletions

View File

@ -643,6 +643,7 @@ fi
if test "${enable_datacenter}" = "yes" ; then
AC_DEFINE([HAVE_DATACENTER], [1], [Compile extensions for a DataCenter])
AC_MSG_WARN([The --enable-datacenter compile time option is deprecated. Please modify the init script to pass -F datacenter to the daemons instead.])
DFLT_NAME="datacenter"
else
DFLT_NAME="traditional"

View File

@ -56,6 +56,11 @@ bfdd_options=" -A 127.0.0.1"
fabricd_options="-A 127.0.0.1"
vrrpd_options=" -A 127.0.0.1"
# configuration profile
#
#frr_profile="traditional"
#frr_profile="datacenter"
#
# This is the maximum number of FD's that will be available.
# Upon startup this is read by the control files and ulimit

View File

@ -21,6 +21,7 @@ VTYSH="@vtysh_bin@" # /usr/bin/vtysh
FRR_USER="@enable_user@" # frr
FRR_GROUP="@enable_group@" # frr
FRR_VTY_GROUP="@enable_vty_group@" # frrvty
FRR_DEFAULT_PROFILE="@DFLT_NAME@" # traditional / datacenter
# Local Daemon selection may be done by using /etc/frr/daemons.
# See /usr/share/doc/frr/README.Debian.gz for further information.
@ -151,7 +152,7 @@ start()
--pidfile=`pidfile $dmn-$inst` \
--exec "$D_PATH/$dmn" \
-- \
`eval echo "$""$dmn""_options"` -n "$inst"
`eval echo "$""$dmn""_options"` $frr_global_options -n "$inst"
else
if ! check_daemon $dmn; then
echo -n " (binary does not exist)"
@ -164,14 +165,14 @@ start()
--pidfile=`pidfile $dmn` \
--exec "$valgrind" \
-- --trace-children=no --leak-check=full --log-file=/var/log/frr/$dmn-valgrind.log $D_PATH/$dmn \
`eval echo "$""$dmn""_options"`
`eval echo "$""$dmn""_options"` $frr_global_options
else
${SSD} \
--start \
--pidfile=`pidfile $dmn` \
--exec "$D_PATH/$dmn" \
-- \
`eval echo "$""$dmn""_options"`
`eval echo "$""$dmn""_options"` $frr_global_options
fi
fi
@ -188,7 +189,7 @@ start()
--pidfile=`pidfile staticd` \
--exec "$D_PATH/staticd" \
-- \
`eval echo "$"staticd"_options"`
`eval echo "$"staticd"_options"` $frr_global_options
fi
}
@ -511,6 +512,18 @@ fi
# Read configuration variable file if it is present
[ -r /etc/default/frr ] && . /etc/default/frr
if test -z "$frr_profile"; then
# try to autodetect config profile
if test -d /etc/cumulus; then
frr_profile=datacenter
# elif test ...; then
# -- add your distro/system here
elif test -n "$FRR_DEFAULT_PROFILE"; then
frr_profile="$FRR_DEFAULT_PROFILE"
fi
fi
test -n "$frr_profile" && frr_global_options="$frr_global_options -F $frr_profile"
MAX_INSTANCES=${MAX_INSTANCES:=5}
# Set priority of un-startable daemons to 'no' and substitute 'yes' to '0'

View File

@ -24,6 +24,7 @@ VTYSH="@vtysh_bin@" # /usr/bin/vtysh
FRR_USER="@enable_user@" # frr
FRR_GROUP="@enable_group@" # frr
FRR_VTY_GROUP="@enable_vty_group@" # frrvty
FRR_DEFAULT_PROFILE="@DFLT_NAME@" # traditional / datacenter
# ORDER MATTERS FOR $DAEMONS!
# - keep zebra first
@ -151,7 +152,7 @@ daemon_start() {
instopt="${inst:+-n $inst}"
eval args="\$${daemon}_options"
if eval "$all_wrap $wrap $bin -d $instopt $args"; then
if eval "$all_wrap $wrap $bin -d $frr_global_options $instopt $args"; then
log_success_msg "Started $dmninst"
vtysh_b "$daemon"
else
@ -298,6 +299,18 @@ if { declare -p watchfrr_options 2>/dev/null || true; } | grep -q '^declare \-a'
unset watchfrr_options
fi
if test -z "$frr_profile"; then
# try to autodetect config profile
if test -d /etc/cumulus; then
frr_profile=datacenter
# elif test ...; then
# -- add your distro/system here
elif test -n "$FRR_DEFAULT_PROFILE"; then
frr_profile="$FRR_DEFAULT_PROFILE"
fi
fi
test -n "$frr_profile" && frr_global_options="$frr_global_options -F $frr_profile"
#
# other defaults and dispatch
#