diff --git a/build/pause/Makefile b/build/pause/Makefile index 4be3f8ea2e9..151396d4c80 100644 --- a/build/pause/Makefile +++ b/build/pause/Makefile @@ -18,14 +18,15 @@ REGISTRY ?= k8s.gcr.io IMAGE = $(REGISTRY)/pause-$(ARCH) LEGACY_AMD64_IMAGE = $(REGISTRY)/pause -TAG = 3.0 +TAG = 3.1 +REV = $(shell git describe --contains --always --match='v*') # Architectures supported: amd64, arm, arm64, ppc64le and s390x ARCH ?= amd64 ALL_ARCH = amd64 arm arm64 ppc64le s390x -CFLAGS = -Os -Wall -Werror -static +CFLAGS = -Os -Wall -Werror -static -DVERSION=v$(TAG)-$(REV) KUBE_CROSS_IMAGE ?= k8s.gcr.io/kube-cross KUBE_CROSS_VERSION ?= $(shell cat ../build-image/cross/VERSION) @@ -37,7 +38,7 @@ ifeq ($(ARCH),amd64) endif ifeq ($(ARCH),arm) - TRIPLE ?= arm-linux-gnueabi + TRIPLE ?= arm-linux-gnueabihf endif ifeq ($(ARCH),arm64) diff --git a/build/pause/pause.c b/build/pause/pause.c index f2e21b41d55..95966f4384d 100644 --- a/build/pause/pause.c +++ b/build/pause/pause.c @@ -17,20 +17,37 @@ limitations under the License. #include #include #include +#include #include #include #include +#define STRINGIFY(x) #x +#define VERSION_STRING(x) STRINGIFY(x) + +#ifndef VERSION +#define VERSION HEAD +#endif + static void sigdown(int signo) { psignal(signo, "Shutting down, got signal"); exit(0); } static void sigreap(int signo) { - while (waitpid(-1, NULL, WNOHANG) > 0); + while (waitpid(-1, NULL, WNOHANG) > 0) + ; } -int main() { +int main(int argc, char **argv) { + int i; + for (i = 1; i < argc; ++i) { + if (!strcasecmp(argv[i], "-v")) { + printf("pause.c %s\n", VERSION_STRING(VERSION)); + return 0; + } + } + if (getpid() != 1) /* Not an error because pause sees use outside of infra containers. */ fprintf(stderr, "Warning: pause should be the first process\n");