From 27803ec60339238e5106bb51ae5b9cea8ebcc7d8 Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Thu, 11 Apr 2019 12:55:54 +0800 Subject: [PATCH] [docker-platform-monitor]: Add smartmontools 6.6-1 (#2703) --- .../base_image_files/smartctl | 10 ++++++++++ rules/docker-platform-monitor.mk | 3 ++- rules/smartmontools.mk | 13 +++++++++++++ sonic-slave-stretch/Dockerfile | 8 +++++++- src/smartmontools/Makefile | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100755 dockers/docker-platform-monitor/base_image_files/smartctl create mode 100644 rules/smartmontools.mk create mode 100644 src/smartmontools/Makefile diff --git a/dockers/docker-platform-monitor/base_image_files/smartctl b/dockers/docker-platform-monitor/base_image_files/smartctl new file mode 100755 index 000000000000..2bbc5f7a6d74 --- /dev/null +++ b/dockers/docker-platform-monitor/base_image_files/smartctl @@ -0,0 +1,10 @@ +#!/bin/bash + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS pmon smartctl "$@" diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index c8a224c9a4e0..09017641e413 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -2,7 +2,7 @@ DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz $(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor -$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL) $(SENSORD) $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) +$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS) $(FANCONTROL) $(SENSORD) $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON) $(SMARTMONTOOLS) $(DOCKER_PLATFORM_MONITOR)_PYTHON_DEBS += $(SONIC_LEDD) $(SONIC_XCVRD) $(SONIC_PSUD) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2) @@ -22,3 +22,4 @@ $(DOCKER_PLATFORM_MONITOR)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_PLATFORM_MONITOR)_aboot_RUN_OPT += -v /usr/lib/python2.7/dist-packages/arista:/usr/lib/python2.7/dist-packages/arista:ro $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += sensors:/usr/bin/sensors +$(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += smartctl:/usr/sbin/smartctl diff --git a/rules/smartmontools.mk b/rules/smartmontools.mk new file mode 100644 index 000000000000..b4b906aef18e --- /dev/null +++ b/rules/smartmontools.mk @@ -0,0 +1,13 @@ +# smartmontools package +# + +SMARTMONTOOLS_VERSION_MAJOR = 6.6 +SMARTMONTOOLS_VERSION_FULL = $(SMARTMONTOOLS_VERSION_MAJOR)-1 + +export SMARTMONTOOLS_VERSION_MAJOR SMARTMONTOOLS_VERSION_FULL + +SMARTMONTOOLS = smartmontools_$(SMARTMONTOOLS_VERSION_FULL)_amd64.deb +$(SMARTMONTOOLS)_SRC_PATH = $(SRC_PATH)/smartmontools + +SONIC_STRETCH_DEBS += $(SMARTMONTOOLS) +SONIC_MAKE_DEBS += $(SMARTMONTOOLS) \ No newline at end of file diff --git a/sonic-slave-stretch/Dockerfile b/sonic-slave-stretch/Dockerfile index be71d426a844..9048cab082a8 100644 --- a/sonic-slave-stretch/Dockerfile +++ b/sonic-slave-stretch/Dockerfile @@ -218,7 +218,13 @@ RUN apt-get update && apt-get install -y \ # For lm-sensors librrd8 \ librrd-dev \ - rrdtool + rrdtool \ +# For smartmontools 6.6-1 + automake1.11 \ + libselinux1-dev + +# For smartmontools 6.6-1 +RUN apt-get -t stretch-backports install -y debhelper # For linux build RUN apt-get -y build-dep linux diff --git a/src/smartmontools/Makefile b/src/smartmontools/Makefile new file mode 100644 index 000000000000..b67c8e59a6d6 --- /dev/null +++ b/src/smartmontools/Makefile @@ -0,0 +1,19 @@ +SHELL = /bin/bash +.ONESHELL: +.SHELLFLAGS += -e + + +MAIN_TARGET = smartmontools_$(SMARTMONTOOLS_VERSION_FULL)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + rm -rf smartmontools-$(SMARTMONTOOLS_VERSION_MAJOR) + wget -O smartmontools_$(SMARTMONTOOLS_VERSION_MAJOR).orig.tar.gz -N "https://sonicstorage.blob.core.windows.net/packages/debian/smartmontools_$(SMARTMONTOOLS_VERSION_MAJOR).orig.tar.gz?sv=2015-04-05&sr=b&sig=JZx4qiLuO36T0rsGqk4V2RDuWjRw6NztsLK7vlBYAkg%3D&se=2046-08-20T23%3A47%3A13Z&sp=r" + wget -O smartmontools_$(SMARTMONTOOLS_VERSION_FULL).dsc -N "https://sonicstorage.blob.core.windows.net/packages/debian/smartmontools_$(SMARTMONTOOLS_VERSION_FULL).dsc?sv=2015-04-05&sr=b&sig=IS7FKUN%2Bvq0T55f4X2hGAViB70Y%2FgzjGgvzpUJLyUfA%3D&se=2046-08-20T23%3A46%3A57Z&sp=r" + wget -O smartmontools_$(SMARTMONTOOLS_VERSION_FULL).debian.tar.xz -N "https://sonicstorage.blob.core.windows.net/packages/debian/smartmontools_$(SMARTMONTOOLS_VERSION_FULL).debian.tar.xz?sv=2015-04-05&sr=b&sig=H0RFeC41MCvhTQCln85DuPLn5v2goozwz%2FB9sA9p5eQ%3D&se=2046-08-20T23%3A46%3A02Z&sp=r" + dpkg-source -x smartmontools_$(SMARTMONTOOLS_VERSION_FULL).dsc + + pushd smartmontools-$(SMARTMONTOOLS_VERSION_MAJOR) + dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + mv $* $(DEST)/