tools/frr: use path settings from ./configure

...so we properly locate config files and daemons whereever the user
decided to put them.

Signed-Off-By: David Lamparter <equinox@diac24.net>
(cherry picked from commit 40da52d8c1)
This commit is contained in:
David Lamparter 2018-09-27 01:49:07 +02:00 committed by Konstantin Shalygin
parent f9d350229c
commit 741c2d72ca
2 changed files with 27 additions and 14 deletions

View File

@ -1931,6 +1931,7 @@ for I in 1 2 3 4 5 6 7 8 9 10; do
eval vtysh_bin="\"$vtysh_bin\"" eval vtysh_bin="\"$vtysh_bin\""
done done
AC_DEFINE_UNQUOTED(VTYSH_BIN_PATH, "$vtysh_bin",path to vtysh binary) AC_DEFINE_UNQUOTED(VTYSH_BIN_PATH, "$vtysh_bin",path to vtysh binary)
AC_SUBST(vtysh_bin)
CFG_SYSCONF="$sysconfdir" CFG_SYSCONF="$sysconfdir"
CFG_SBIN="$sbindir" CFG_SBIN="$sbindir"
@ -2013,6 +2014,7 @@ fi
AC_CONFIG_FILES([solaris/Makefile]) AC_CONFIG_FILES([solaris/Makefile])
AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl]) AC_CONFIG_FILES([vtysh/extract.pl],[chmod +x vtysh/extract.pl])
AC_CONFIG_FILES([tools/frr],[chmod +x tools/frr])
AC_CONFIG_COMMANDS([lib/route_types.h], [ AC_CONFIG_COMMANDS([lib/route_types.h], [
dst="${ac_abs_top_builddir}/lib/route_types.h" dst="${ac_abs_top_builddir}/lib/route_types.h"

View File

@ -14,23 +14,28 @@
# #
PATH=/bin:/usr/bin:/sbin:/usr/sbin PATH=/bin:/usr/bin:/sbin:/usr/sbin
D_PATH=/usr/lib/frr D_PATH="@CFG_SBIN@" # /usr/lib/frr
C_PATH=/etc/frr C_PATH="@CFG_SYSCONF@" # /etc/frr
V_PATH=/var/run/frr V_PATH="@CFG_STATE@" # /var/run/frr
VTYSH="@vtysh_bin@" # /usr/bin/vtysh
FRR_USER="@enable_user@" # frr
FRR_GROUP="@enable_group@" # frr
FRR_VTY_GROUP="@enable_vty_group@" # frrvty
# Local Daemon selection may be done by using /etc/frr/daemons. # Local Daemon selection may be done by using /etc/frr/daemons.
# See /usr/share/doc/frr/README.Debian.gz for further information. # See /usr/share/doc/frr/README.Debian.gz for further information.
# Keep zebra first and do not list watchfrr! # Keep zebra first and do not list watchfrr!
DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd babeld pimd ldpd nhrpd eigrpd sharpd pbrd staticd bfdd" DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd babeld pimd ldpd nhrpd eigrpd sharpd pbrd staticd bfdd"
MAX_INSTANCES=5 MAX_INSTANCES=5
RELOAD_SCRIPT=/usr/lib/frr/frr-reload.py RELOAD_SCRIPT="$D_PATH/frr-reload.py"
WATCHFRR_STARTED="$V_PATH/watchfrr.started"
if [ -e /lib/lsb/init-functions ]; then if [ -e /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions . /lib/lsb/init-functions
fi fi
if [ -f /usr/lib/frr/ssd ]; then if [ -f $D_PATH/ssd ]; then
SSD=/usr/lib/frr/ssd SSD=$D_PATH/ssd
else else
SSD=`which start-stop-daemon` SSD=`which start-stop-daemon`
fi fi
@ -47,6 +52,12 @@ vtyfile()
echo "$V_PATH/$1.vty" echo "$V_PATH/$1.vty"
} }
chownfrr()
{
test -n "$FRR_USER" && chown "$FRR_USER" "$1"
test -n "$FRR_GROUP" && chgrp "$FRR_GROUP" "$1"
}
# Check if daemon is started by using the pidfile. # Check if daemon is started by using the pidfile.
started() started()
{ {
@ -64,7 +75,7 @@ vtysh_b ()
{ {
# Rember, that all variables have been incremented by 1 in convert_daemon_prios() # Rember, that all variables have been incremented by 1 in convert_daemon_prios()
if [ "$vtysh_enable" = 2 -a -f $C_PATH/frr.conf ]; then if [ "$vtysh_enable" = 2 -a -f $C_PATH/frr.conf ]; then
/usr/bin/vtysh -b -n $VTYSH -b -n
fi fi
} }
@ -91,11 +102,11 @@ check_daemon()
if [ -n "$2" ]; then if [ -n "$2" ]; then
if [ ! -r "$C_PATH/$1-$2.conf" ]; then if [ ! -r "$C_PATH/$1-$2.conf" ]; then
touch "$C_PATH/$1-$2.conf" touch "$C_PATH/$1-$2.conf"
chown frr:frr "$C_PATH/$1-$2.conf" chownfrr "$C_PATH/$1-$2.conf"
fi fi
elif [ ! -r "$C_PATH/$1.conf" ]; then elif [ ! -r "$C_PATH/$1.conf" ]; then
touch "$C_PATH/$1.conf" touch "$C_PATH/$1.conf"
chown frr:frr "$C_PATH/$1.conf" chownfrr "$C_PATH/$1.conf"
fi fi
fi fi
return 0 return 0
@ -117,8 +128,8 @@ start()
echo -n " $1" echo -n " $1"
fi fi
if [ -e /var/run/frr/watchfrr.started ] ; then if [ -e $WATCHFRR_STARTED ] ; then
rm /var/run/frr/watchfrr.started rm $WATCHFRR_STARTED
fi fi
${SSD} \ ${SSD} \
--start \ --start \
@ -128,7 +139,7 @@ start()
"${watchfrr_options[@]}" "${watchfrr_options[@]}"
for i in `seq 1 10`; for i in `seq 1 10`;
do do
if [ -e /var/run/frr/watchfrr.started ] ; then if [ -e $WATCHFRR_STARTED ] ; then
break break
else else
sleep 1 sleep 1
@ -523,7 +534,7 @@ convert_daemon_prios
if [ ! -d $V_PATH ]; then if [ ! -d $V_PATH ]; then
echo "Creating $V_PATH" echo "Creating $V_PATH"
mkdir -p $V_PATH mkdir -p $V_PATH
chown frr:frr $V_PATH chownfrr $V_PATH
chmod 755 /$V_PATH chmod 755 /$V_PATH
fi fi
@ -603,7 +614,7 @@ case "$1" in
NEW_CONFIG_FILE="${2:-$C_PATH/frr.conf}" NEW_CONFIG_FILE="${2:-$C_PATH/frr.conf}"
[ ! -r $NEW_CONFIG_FILE ] && echo "Unable to read new configuration file $NEW_CONFIG_FILE" && exit 1 [ ! -r $NEW_CONFIG_FILE ] && echo "Unable to read new configuration file $NEW_CONFIG_FILE" && exit 1
echo "Applying only incremental changes to running configuration from frr.conf" echo "Applying only incremental changes to running configuration from frr.conf"
"$RELOAD_SCRIPT" --reload /etc/frr/frr.conf "$RELOAD_SCRIPT" --reload $C_PATH/frr.conf
exit $? exit $?
;; ;;