Skip to content

Commit

Permalink
[Makefile]: Add possibility for docker containers to install files to…
Browse files Browse the repository at this point in the history
… base image (#240)

- Add vtysh/lldpctl/sensors to baseimage
  • Loading branch information
oleksandrivantsiv authored and Shuotian Cheng committed Feb 7, 2017
1 parent 522585a commit 53a9792
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dockers/docker-fpm/base_image_files/vtysh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker exec -i bgp vtysh "$@"
2 changes: 2 additions & 0 deletions dockers/docker-lldp-sv2/base_image_files/lldpctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker exec -it lldp lldpctl "$@"
2 changes: 2 additions & 0 deletions dockers/docker-platform-monitor/base_image_files/sensors
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
docker exec -i pmon sensors "$@"
8 changes: 8 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}

2 changes: 2 additions & 0 deletions rules/docker-fpm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions rules/docker-lldp-sv2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions rules/docker-platform-monitor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 53a9792

Please sign in to comment.