[Makefile]: Add possibility for docker containers to install files to base image (#240)

- Add vtysh/lldpctl/sensors to baseimage
This commit is contained in:
Oleksandr Ivantsiv 2017-02-07 10:33:20 +02:00 committed by Shuotian Cheng
parent 522585aadf
commit 53a9792014
8 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,2 @@
#!/bin/bash
docker exec -i bgp vtysh "$@"

View File

@ -0,0 +1,2 @@
#!/bin/bash
docker exec -it lldp lldpctl "$@"

View File

@ -0,0 +1,2 @@
#!/bin/bash
docker exec -i pmon sensors "$@"

View File

@ -117,3 +117,11 @@ sudo LANG=C chroot $FILESYSTEM_ROOT fuser -km /sys || true
sudo LANG=C chroot $FILESYSTEM_ROOT umount -lf /sys
{% endif %}
{% for file in installer_extra_files.split(' ') -%}
{% if file.strip() -%}
{% set src = file.split(':')[0] -%}
{% set dst = file.split(':')[1] -%}
sudo cp {{src}} $FILESYSTEM_ROOT/{{dst}}
{% endif -%}
{% endfor -%}

View File

@ -11,3 +11,5 @@ $(DOCKER_FPM)_CONTAINER_NAME = bgp
$(DOCKER_FPM)_RUN_OPT += --net=host --privileged -t
$(DOCKER_FPM)_RUN_OPT += --volumes-from database
$(DOCKER_FPM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_FPM)_BASE_IMAGE_FILES += vtysh:/usr/bin/vtysh

View File

@ -11,3 +11,5 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_LLDP_SV2)
$(DOCKER_LLDP_SV2)_CONTAINER_NAME = lldp
$(DOCKER_LLDP_SV2)_RUN_OPT += --net=host --privileged -t
$(DOCKER_LLDP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_LLDP_SV2)_BASE_IMAGE_FILES += lldpctl:/usr/bin/lldpctl

View File

@ -11,3 +11,5 @@ SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR)
$(DOCKER_PLATFORM_MONITOR)_CONTAINER_NAME = pmon
$(DOCKER_PLATFORM_MONITOR)_RUN_OPT += --net=host --privileged -t
$(DOCKER_PLATFORM_MONITOR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += sensors:/usr/bin/sensors

View File

@ -309,6 +309,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform
export installer_start_scrips="$(foreach docker, $($*_DOCKERS),$(addsuffix .sh, $($(docker)_CONTAINER_NAME)))"
export installer_services="$(foreach docker, $($*_DOCKERS),$(addsuffix .service, $($(docker)_CONTAINER_NAME)))"
export installer_extra_files="$(foreach docker, $($*_DOCKERS), $(foreach file, $($(docker)_BASE_IMAGE_FILES), $($(docker)_PATH)/base_image_files/$(file)))"
j2 -f env files/initramfs-tools/union-mount.j2 onie-image.conf > files/initramfs-tools/union-mount
j2 -f env files/initramfs-tools/arista-convertfs.j2 onie-image.conf > files/initramfs-tools/arista-convertfs