Skip to content

Commit

Permalink
Merge pull request #3244 from k0ste/stable_6.0_backports
Browse files Browse the repository at this point in the history
stable/6.0: tools/frr: use path settings from ./configure
  • Loading branch information
donaldsharp authored Oct 26, 2018
2 parents f9d3502 + 741c2d7 commit d0ca6a3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,7 @@ for I in 1 2 3 4 5 6 7 8 9 10; do
eval vtysh_bin="\"$vtysh_bin\""
done
AC_DEFINE_UNQUOTED(VTYSH_BIN_PATH, "$vtysh_bin",path to vtysh binary)
AC_SUBST(vtysh_bin)

CFG_SYSCONF="$sysconfdir"
CFG_SBIN="$sbindir"
Expand Down Expand Up @@ -2013,6 +2014,7 @@ fi
AC_CONFIG_FILES([solaris/Makefile])

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], [
dst="${ac_abs_top_builddir}/lib/route_types.h"
Expand Down
39 changes: 25 additions & 14 deletions tools/frr → tools/frr.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,28 @@
#

PATH=/bin:/usr/bin:/sbin:/usr/sbin
D_PATH=/usr/lib/frr
C_PATH=/etc/frr
V_PATH=/var/run/frr
D_PATH="@CFG_SBIN@" # /usr/lib/frr
C_PATH="@CFG_SYSCONF@" # /etc/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.
# See /usr/share/doc/frr/README.Debian.gz for further information.
# 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"
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
. /lib/lsb/init-functions
fi

if [ -f /usr/lib/frr/ssd ]; then
SSD=/usr/lib/frr/ssd
if [ -f $D_PATH/ssd ]; then
SSD=$D_PATH/ssd
else
SSD=`which start-stop-daemon`
fi
Expand All @@ -47,6 +52,12 @@ vtyfile()
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.
started()
{
Expand All @@ -64,7 +75,7 @@ vtysh_b ()
{
# Rember, that all variables have been incremented by 1 in convert_daemon_prios()
if [ "$vtysh_enable" = 2 -a -f $C_PATH/frr.conf ]; then
/usr/bin/vtysh -b -n
$VTYSH -b -n
fi
}

Expand All @@ -91,11 +102,11 @@ check_daemon()
if [ -n "$2" ]; then
if [ ! -r "$C_PATH/$1-$2.conf" ]; then
touch "$C_PATH/$1-$2.conf"
chown frr:frr "$C_PATH/$1-$2.conf"
chownfrr "$C_PATH/$1-$2.conf"
fi
elif [ ! -r "$C_PATH/$1.conf" ]; then
touch "$C_PATH/$1.conf"
chown frr:frr "$C_PATH/$1.conf"
chownfrr "$C_PATH/$1.conf"
fi
fi
return 0
Expand All @@ -117,8 +128,8 @@ start()
echo -n " $1"
fi

if [ -e /var/run/frr/watchfrr.started ] ; then
rm /var/run/frr/watchfrr.started
if [ -e $WATCHFRR_STARTED ] ; then
rm $WATCHFRR_STARTED
fi
${SSD} \
--start \
Expand All @@ -128,7 +139,7 @@ start()
"${watchfrr_options[@]}"
for i in `seq 1 10`;
do
if [ -e /var/run/frr/watchfrr.started ] ; then
if [ -e $WATCHFRR_STARTED ] ; then
break
else
sleep 1
Expand Down Expand Up @@ -523,7 +534,7 @@ convert_daemon_prios
if [ ! -d $V_PATH ]; then
echo "Creating $V_PATH"
mkdir -p $V_PATH
chown frr:frr $V_PATH
chownfrr $V_PATH
chmod 755 /$V_PATH
fi

Expand Down Expand Up @@ -603,7 +614,7 @@ case "$1" in
NEW_CONFIG_FILE="${2:-$C_PATH/frr.conf}"
[ ! -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"
"$RELOAD_SCRIPT" --reload /etc/frr/frr.conf
"$RELOAD_SCRIPT" --reload $C_PATH/frr.conf
exit $?
;;

Expand Down

0 comments on commit d0ca6a3

Please sign in to comment.