|
2 | 2 |
|
3 | 3 | # Generate supervisord config file
|
4 | 4 | mkdir -p /etc/supervisor/conf.d/
|
5 |
| -sonic-cfggen -d -t /usr/share/sonic/templates/docker-dhcp-relay.supervisord.conf.j2 > /etc/supervisor/conf.d/docker-dhcp-relay.supervisord.conf |
6 | 5 |
|
7 |
| -# Generate the script that waits for all interfaces to come up and make it executable |
8 |
| -sonic-cfggen -d -t /usr/share/sonic/templates/wait_for_intf.sh.j2 > /usr/bin/wait_for_intf.sh |
9 |
| -chmod +x /usr/bin/wait_for_intf.sh |
| 6 | +# Generate the following files from templates: |
| 7 | +# 1. supervisord configuration |
| 8 | +# 2. wait_for_intf.sh, which waits for all interfaces to come up |
| 9 | +# 3. port-to-alias name map |
| 10 | +CFGGEN_PARAMS=" \ |
| 11 | + -d \ |
| 12 | + -t /usr/share/sonic/templates/docker-dhcp-relay.supervisord.conf.j2,/etc/supervisor/conf.d/docker-dhcp-relay.supervisord.conf \ |
| 13 | + -t /usr/share/sonic/templates/wait_for_intf.sh.j2,/usr/bin/wait_for_intf.sh \ |
| 14 | + -t /usr/share/sonic/templates/port-name-alias-map.txt.j2,/tmp/port-name-alias-map.txt \ |
| 15 | +" |
| 16 | +sonic-cfggen $CFGGEN_PARAMS |
10 | 17 |
|
11 |
| -# Generate port name-alias map for isc-dhcp-relay to parse. Each line contains one |
12 |
| -# name-alias pair of the form "<name> <alias>" |
13 |
| -sonic-cfggen -d --var-json "PORT" | python -c "import sys, json, os; [sys.stdout.write('%s %s\n' % (k, v['alias'] if 'alias' in v else k)) for (k, v) in json.load(sys.stdin).iteritems()]" > /tmp/port-name-alias-map.txt |
| 18 | +# Make the script that waits for all interfaces to come up executable |
| 19 | +chmod +x /usr/bin/wait_for_intf.sh |
14 | 20 |
|
15 | 21 | # The docker container should start this script as PID 1, so now that supervisord is
|
16 | 22 | # properly configured, we exec supervisord so that it runs as PID 1 for the
|
|
0 commit comments