Skip to content

Commit

Permalink
[docker-platform-monitor]: Add smartmontools 6.6-1 (#2703)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirut Getbamrung authored and lguohan committed Apr 11, 2019
1 parent d993d6f commit 27803ec
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
10 changes: 10 additions & 0 deletions dockers/docker-platform-monitor/base_image_files/smartctl
Original file line number Diff line number Diff line change
@@ -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 "$@"
3 changes: 2 additions & 1 deletion rules/docker-platform-monitor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
13 changes: 13 additions & 0 deletions rules/smartmontools.mk
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 7 additions & 1 deletion sonic-slave-stretch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions src/smartmontools/Makefile
Original file line number Diff line number Diff line change
@@ -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)/

0 comments on commit 27803ec

Please sign in to comment.