|
@ -16,6 +16,9 @@ |
|
|
# file does not exist. |
|
|
# file does not exist. |
|
|
# |
|
|
# |
|
|
# This script should be installed in /usr/sbin/frrcommon.sh |
|
|
# This script should be installed in /usr/sbin/frrcommon.sh |
|
|
|
|
|
# FRR_PATHSPACE is passed in from watchfrr |
|
|
|
|
|
suffix="${FRR_PATHSPACE:+/${FRR_PATHSPACE}}" |
|
|
|
|
|
nsopt="${FRR_PATHSPACE:+-N ${FRR_PATHSPACE}}" |
|
|
|
|
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin |
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin |
|
|
D_PATH="/usr/sbin" # /usr/lib/frr |
|
|
D_PATH="/usr/sbin" # /usr/lib/frr |
|
@ -25,6 +28,8 @@ VTYSH="/usr/bin/vtysh" # /usr/bin/vtysh |
|
|
FRR_USER="network" # frr |
|
|
FRR_USER="network" # frr |
|
|
FRR_GROUP="network" # frr |
|
|
FRR_GROUP="network" # frr |
|
|
FRR_VTY_GROUP="" # frrvty |
|
|
FRR_VTY_GROUP="" # frrvty |
|
|
|
|
|
FRR_CONFIG_MODE="0600" # 0600 |
|
|
|
|
|
FRR_DEFAULT_PROFILE="traditional" # traditional / datacenter |
|
|
|
|
|
|
|
|
# ORDER MATTERS FOR $DAEMONS! |
|
|
# ORDER MATTERS FOR $DAEMONS! |
|
|
# - keep zebra first |
|
|
# - keep zebra first |
|
@ -53,15 +58,19 @@ debug() { |
|
|
chownfrr() { |
|
|
chownfrr() { |
|
|
[ -n "$FRR_USER" ] && chown "$FRR_USER" "$1" |
|
|
[ -n "$FRR_USER" ] && chown "$FRR_USER" "$1" |
|
|
[ -n "$FRR_GROUP" ] && chgrp "$FRR_GROUP" "$1" |
|
|
[ -n "$FRR_GROUP" ] && chgrp "$FRR_GROUP" "$1" |
|
|
|
|
|
[ -n "$FRR_CONFIG_MODE" ] && chmod "$FRR_CONFIG_MODE" "$1" |
|
|
|
|
|
if [ -d "$1" ]; then |
|
|
|
|
|
chmod u+x "$1" |
|
|
|
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
vtysh_b () { |
|
|
vtysh_b () { |
|
|
[ "$1" = "watchfrr" ] && return 0 |
|
|
[ "$1" = "watchfrr" ] && return 0 |
|
|
[ -r "$C_PATH/frr.conf" ] || return 0 |
|
|
[ -r "$C_PATH/frr.conf" ] || return 0 |
|
|
if [ -n "$1" ]; then |
|
|
if [ -n "$1" ]; then |
|
|
"$VTYSH" -b -n -d "$1" |
|
|
|
|
|
|
|
|
"$VTYSH" `echo $nsopt` -b -d "$1" |
|
|
else |
|
|
else |
|
|
"$VTYSH" -b -n |
|
|
|
|
|
|
|
|
"$VTYSH" `echo $nsopt` -b |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -90,7 +99,8 @@ daemon_list() { |
|
|
continue |
|
|
continue |
|
|
fi |
|
|
fi |
|
|
debug "$daemon enabled" |
|
|
debug "$daemon enabled" |
|
|
enabled="$enabled $daemon" |
|
|
|
|
|
|
|
|
# enabled="$enabled $daemon" |
|
|
|
|
|
|
|
|
if [ -n "$inst" ]; then |
|
|
if [ -n "$inst" ]; then |
|
|
debug "$daemon multi-instance $inst" |
|
|
debug "$daemon multi-instance $inst" |
|
|
oldifs="${IFS}" |
|
|
oldifs="${IFS}" |
|
@ -99,6 +109,8 @@ daemon_list() { |
|
|
enabled="$enabled $daemon-$i" |
|
|
enabled="$enabled $daemon-$i" |
|
|
done |
|
|
done |
|
|
IFS="${oldifs}" |
|
|
IFS="${oldifs}" |
|
|
|
|
|
else |
|
|
|
|
|
enabled="$enabled $daemon" |
|
|
fi |
|
|
fi |
|
|
else |
|
|
else |
|
|
debug "$daemon disabled" |
|
|
debug "$daemon disabled" |
|
@ -152,7 +164,7 @@ daemon_start() { |
|
|
instopt="${inst:+-n $inst}" |
|
|
instopt="${inst:+-n $inst}" |
|
|
eval args="\$${daemon}_options" |
|
|
eval args="\$${daemon}_options" |
|
|
|
|
|
|
|
|
if eval "$all_wrap $wrap $bin -d $instopt $args"; then |
|
|
|
|
|
|
|
|
if eval "$all_wrap $wrap $bin $nsopt -d $frr_global_options $instopt $args"; then |
|
|
log_success_msg "Started $dmninst" |
|
|
log_success_msg "Started $dmninst" |
|
|
vtysh_b "$daemon" |
|
|
vtysh_b "$daemon" |
|
|
else |
|
|
else |
|
@ -288,9 +300,11 @@ load_old_config() { |
|
|
} |
|
|
} |
|
|
. "$C_PATH/daemons" |
|
|
. "$C_PATH/daemons" |
|
|
|
|
|
|
|
|
load_old_config "$C_PATH/daemons.conf" |
|
|
|
|
|
load_old_config "/etc/default/frr" |
|
|
|
|
|
load_old_config "/etc/sysconfig/frr" |
|
|
|
|
|
|
|
|
if [ -z "$FRR_PATHSPACE" ]; then |
|
|
|
|
|
load_old_config "$C_PATH/daemons.conf" |
|
|
|
|
|
load_old_config "/etc/default/frr" |
|
|
|
|
|
load_old_config "/etc/sysconfig/frr" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
if { declare -p watchfrr_options 2>/dev/null || true; } | grep -q '^declare \-a'; then |
|
|
if { declare -p watchfrr_options 2>/dev/null || true; } | grep -q '^declare \-a'; then |
|
|
log_warning_msg "watchfrr_options contains a bash array value." \ |
|
|
log_warning_msg "watchfrr_options contains a bash array value." \ |
|
@ -299,6 +313,19 @@ if { declare -p watchfrr_options 2>/dev/null || true; } | grep -q '^declare \-a' |
|
|
unset watchfrr_options |
|
|
unset watchfrr_options |
|
|
fi |
|
|
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 |
|
|
# other defaults and dispatch |
|
|
# |
|
|
# |
|
|