From 0cd4ef0c8508f734b7ad8460b37684fb8fc6ddcd Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 13 Aug 2018 01:12:58 -0700 Subject: [PATCH] [socat]: build socat with readline (#1919) support readline in bcmsh Signed-off-by: Guohan Lu --- dockers/docker-base/Dockerfile.j2 | 3 -- .../docker-syncd-brcm/base_image_files/bcmsh | 2 +- platform/broadcom/docker-syncd-brcm/bcmsh | 2 +- rules/docker-base.mk | 1 + rules/socat.mk | 9 ++++++ src/socat/Makefile | 28 +++++++++++++++++++ src/socat/enable_readline.patch | 13 +++++++++ 7 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 rules/socat.mk create mode 100644 src/socat/Makefile create mode 100644 src/socat/enable_readline.patch diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index bd5c91faa9..2aef59241b 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -34,9 +34,6 @@ RUN apt-get -y install \ # eliminating memory leaks RUN apt-get -y -t jessie-backports install rsyslog -# Pre-install troubleshooting packages -RUN apt-get -y install socat - COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] COPY ["root/.vimrc", "/root/.vimrc"] diff --git a/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh b/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh index c3a3874257..3bb78b0da7 100755 --- a/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh +++ b/platform/broadcom/docker-syncd-brcm/base_image_files/bcmsh @@ -1,3 +1,3 @@ #!/bin/bash -docker exec -i syncd bcmsh "$@" +docker exec -it syncd bcmsh "$@" diff --git a/platform/broadcom/docker-syncd-brcm/bcmsh b/platform/broadcom/docker-syncd-brcm/bcmsh index 7d2fa2f4d3..9dfa7874a0 100755 --- a/platform/broadcom/docker-syncd-brcm/bcmsh +++ b/platform/broadcom/docker-syncd-brcm/bcmsh @@ -31,5 +31,5 @@ if [ "$quiet" = false ]; then echo "$banner" fi -/usr/bin/socat - UNIX-CONNECT:/var/run/sswsyncd/sswsyncd.socket +/usr/bin/socat readline UNIX-CONNECT:/var/run/sswsyncd/sswsyncd.socket diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 5ef06c7fc8..55e44e7f34 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -5,6 +5,7 @@ $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base $(DOCKER_BASE)_DEPENDS += $(SUPERVISOR) $(DOCKER_BASE)_DEPENDS += $(LIBWRAP) $(DOCKER_BASE)_DEPENDS += $(BASH) +$(DOCKER_BASE)_DEPENDS += $(SOCAT) ifeq ($(SONIC_INSTALL_DEBUG_TOOLS),y) GDB = gdb diff --git a/rules/socat.mk b/rules/socat.mk new file mode 100644 index 0000000000..b937952236 --- /dev/null +++ b/rules/socat.mk @@ -0,0 +1,9 @@ +# socat packages + +SOCAT_VERSION = 1.7.3.1-2+deb9u1 + +export SOCAT_VERSION + +SOCAT = socat_$(SOCAT_VERSION)_amd64.deb +$(SOCAT)_SRC_PATH = $(SRC_PATH)/socat +SONIC_MAKE_DEBS += $(SOCAT) diff --git a/src/socat/Makefile b/src/socat/Makefile new file mode 100644 index 0000000000..e82208946a --- /dev/null +++ b/src/socat/Makefile @@ -0,0 +1,28 @@ +.ONESHELL: +SHELL = /bin/bash +.SHELLFLAGS += -e + +MAIN_TARGET = socat_$(SOCAT_VERSION)_amd64.deb + +$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : + # Remove any stale files + rm -rf ./socat-1.7.3.1 + + # Get source package + wget -NO socat_$(SOCAT_VERSION).dsc "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.3.1-2+deb9u1.dsc?sv=2015-04-05&sr=b&sig=Ph7aMqb%2F%2FE%2F8qwxMXoXb5oK1YPkfVt6PV8mBBv5Wi%2F4%3D&se=2155-07-05T11%3A42%3A29Z&sp=r" + wget -NO socat_$(SOCAT_VERSION).debian.tar.xz "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.3.1-2+deb9u1.debian.tar.xz?sv=2015-04-05&sr=b&sig=yv77Fr5RtZgRTPmJK3j0lZ0BzsCiGaSs2i7NqQKEy2Y%3D&se=2155-07-05T11%3A39%3A59Z&sp=r" + wget -NO socat_1.7.3.1.orig.tar.gz "https://sonicstorage.blob.core.windows.net/packages/debian/socat_1.7.3.1.orig.tar.gz?sv=2015-04-05&sr=b&sig=0Ai1FM604aGsF5uBu2yN8w9O1a6zNjIDCdaiTo24DyQ%3D&se=2155-07-05T11%3A40%3A14Z&sp=r" + + dpkg-source -x socat_$(SOCAT_VERSION).dsc + + # Build source and Debian packages + pushd socat-1.7.3.1 + patch -p0 < ../enable_readline.patch + dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) + popd + + # Move the newly-built .deb packages to the destination directory + mv $(DERIVED_TARGETS) $* $(DEST)/ + +$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET) + diff --git a/src/socat/enable_readline.patch b/src/socat/enable_readline.patch new file mode 100644 index 0000000000..f1914d3cb4 --- /dev/null +++ b/src/socat/enable_readline.patch @@ -0,0 +1,13 @@ +--- debian/rules.old 2018-08-12 11:48:42.220230100 +0000 ++++ debian/rules 2018-08-12 11:48:52.072230100 +0000 +@@ -12,9 +12,6 @@ + %: + dh $@ --with=autoreconf + +-override_dh_auto_configure: +- dh_auto_configure -- --disable-readline +- + override_dh_auto_test: + +-.PHONY: override_dh_auto_configure override_dh_auto_test ++.PHONY: override_dh_auto_test