*: add pause binary as a build target
Take the pause binary's source code (from kubernetes/pause) and make it part of the build setup for cri-o. This is necessary to remove the Docker requirement for setting up the pause container, at least until the storage API is set up so that we can make this far more flexible (namely that we can pull the image from a registry or other transport, even from an archive). Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
parent
37affbfd7a
commit
1313f0dd72
|
@ -2,5 +2,7 @@
|
|||
/ocic
|
||||
conmon/conmon
|
||||
conmon/conmon.o
|
||||
pause/pause
|
||||
pause/pause.o
|
||||
/docs/ocid.8
|
||||
vendor/src/github.com/kubernetes-incubator/cri-o
|
||||
|
|
18
Makefile
18
Makefile
|
@ -34,6 +34,9 @@ ${OCID_LINK}:
|
|||
conmon:
|
||||
make -C $@
|
||||
|
||||
pause:
|
||||
make -C $@
|
||||
|
||||
ocid: ${OCID_LINK}
|
||||
go build -o ocid ./cmd/server/
|
||||
|
||||
|
@ -44,6 +47,7 @@ clean:
|
|||
rm -f ocic ocid
|
||||
rm -f ${OCID_LINK}
|
||||
rm -f conmon/conmon.o conmon/conmon
|
||||
rm -f pause/pause.o pause/pause
|
||||
rm -f docs/*.1 docs/*.8
|
||||
find . -name \*~ -delete
|
||||
find . -name \#\* -delete
|
||||
|
@ -64,7 +68,7 @@ integration: ocidimage
|
|||
localintegration: binaries
|
||||
./test/test_runner.sh ${TESTFLAGS}
|
||||
|
||||
binaries: ${OCID_LINK} ocid ocic conmon
|
||||
binaries: ${OCID_LINK} ocid ocic conmon pause
|
||||
|
||||
MANPAGES_MD = $(wildcard docs/*.md)
|
||||
|
||||
|
@ -82,12 +86,13 @@ install: binaries docs
|
|||
install -D -m 755 ocid ${INSTALLDIR}/ocid
|
||||
install -D -m 755 ocic ${INSTALLDIR}/ocic
|
||||
install -D -m 755 conmon/conmon $(PREFIX)/libexec/ocid/conmon
|
||||
install -D -m 755 pause/pause $(PREFIX)/libexec/ocid/pause
|
||||
install -d $(PREFIX)/share/man/man8
|
||||
install -m 644 $(basename $(MANPAGES_MD)) $(PREFIX)/share/man/man8
|
||||
|
||||
uninstall:
|
||||
rm -f ${INSTALLDIR}/{ocid,ocic}
|
||||
rm -f $(PREFIX)/libexec/ocid/conmon
|
||||
rm -f $(PREFIX)/libexec/ocid/{conmon,pause}
|
||||
for i in $(basename $(MANPAGES_MD)); do \
|
||||
rm -f $(PREFIX)/share/man/man8/$$(basename $${i}); \
|
||||
done
|
||||
|
@ -118,13 +123,14 @@ install.tools: .install.gitvalidation .install.gometalinter .install.md2man
|
|||
|
||||
.PHONY: \
|
||||
binaries \
|
||||
clean \
|
||||
conmon \
|
||||
default \
|
||||
docs \
|
||||
ocid \
|
||||
ocic \
|
||||
clean \
|
||||
lint \
|
||||
help \
|
||||
install \
|
||||
lint \
|
||||
ocic \
|
||||
ocid \
|
||||
pause \
|
||||
uninstall
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
/.container-*
|
||||
/.push-*
|
||||
/bin
|
|
@ -0,0 +1,13 @@
|
|||
src = $(wildcard *.c)
|
||||
obj = $(src:.c=.o)
|
||||
|
||||
override LIBS +=
|
||||
override CFLAGS += -Os -Wall -Wextra -static
|
||||
|
||||
pause: $(obj)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
strip $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(obj) pause
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void sigdown(int signo) {
|
||||
psignal(signo, "shutting down, got signal");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main() {
|
||||
if (signal(SIGINT, sigdown) == SIG_ERR)
|
||||
return 1;
|
||||
if (signal(SIGTERM, sigdown) == SIG_ERR)
|
||||
return 2;
|
||||
signal(SIGKILL, sigdown);
|
||||
for (;;) pause();
|
||||
fprintf(stderr, "error: infinite loop terminated\n");
|
||||
return 42;
|
||||
}
|
Loading…
Reference in New Issue