File tree 1 file changed +36
-3
lines changed
dockers/docker-fpm-frr/base_image_files
1 file changed +36
-3
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
+ # read SONiC immutable variables
3
+ [ -f /etc/sonic/sonic-environment ] && . /etc/sonic/sonic-environment
4
+
5
+ function help()
6
+ {
7
+ echo -e " Usage: $0 -n [0 to $(( $NUM_ASIC - 1 )) ] [OPTION]... " 1>&2 ; exit 1;
8
+ }
9
+
10
+ DEV=" "
11
+ PLATFORM=${PLATFORM:- `sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`}
12
+
13
+ # Parse the device specific asic conf file, if it exists
14
+ ASIC_CONF=/usr/share/sonic/device/$PLATFORM /asic.conf
15
+ [ -f $ASIC_CONF ] && . $ASIC_CONF
16
+
17
+ if [[ ($NUM_ASIC -gt 1) ]]; then
18
+ while getopts " :n:h:" opt; do
19
+ case " ${opt} " in
20
+ h) help
21
+ ;;
22
+ n) DEV=${OPTARG}
23
+ [ $DEV -lt $NUM_ASIC -a $DEV -ge 0 ] || help
24
+ ;;
25
+ esac
26
+ done
27
+
28
+ if [ -z " ${DEV} " ]; then
29
+ help
30
+ fi
31
+
32
+ # Skip the arguments -n <inst> while passing to docker command
33
+ shift 2
34
+ fi
2
35
3
36
# Determine whether stdout is on a terminal
4
37
if [ -t 1 ] ; then
@@ -7,10 +40,10 @@ if [ -t 1 ] ; then
7
40
TTY=$( tty)
8
41
function cleanup
9
42
{
10
- docker exec -i bgp pkill -HUP -f " vtysh $TTY "
43
+ docker exec -i bgp$DEV pkill -HUP -f " vtysh $TTY "
11
44
}
12
45
trap cleanup HUP
13
- docker exec -ti bgp vtysh " $TTY " " $@ "
46
+ docker exec -ti bgp$DEV vtysh " $TTY " " $@ "
14
47
else
15
- docker exec -i bgp vtysh " $@ "
48
+ docker exec -i bgp$DEV vtysh " $@ "
16
49
fi
You can’t perform that action at this time.
0 commit comments