2016-09-23 09:20:57 -07:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
TOMLV_COMMIT=9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
|
2016-09-29 11:02:38 -07:00
|
|
|
RUNC_COMMIT=02f8fa7863dd3f82909a73e2061897828460d52f
|
2016-10-17 19:49:36 +02:00
|
|
|
CONTAINERD_COMMIT=52ef1ceb4b660c42cf4ea9013180a5663968d4c7
|
Update init to fe069a03affd2547fdb05e5b8b07202d2e4
diff:
```patch
diff --git a/Makefile b/Makefile
index 0b2b063..70df01b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,4 @@
+GIT_VERSION := $(shell git describe --abbrev=40 --long --dirty --always --tags)
all:
- gcc -O2 -o init -static grimes.c
+ gcc -O2 -DVERSION=\"$(GIT_VERSION)\" -o init -static grimes.c
diff --git a/grimes.c b/grimes.c
index d0f836b..ffeea98 100644
--- a/grimes.c
+++ b/grimes.c
@@ -29,7 +29,7 @@ typedef struct reaper_t {
} reaper_t;
// reaper_new initializes the reaper with the provided process.
-// it also sets up the signal handlers and child handlers for restore
+// it also sets up the signal handlers and child handlers for restore
// when the child is execed
int reaper_new(reaper_t * reaper, process_t * process)
{
@@ -57,7 +57,7 @@ int reaper_new(reaper_t * reaper, process_t * process)
return 0;
}
-// reaper_exit closes the reaper's signalfd and exits with the
+// reaper_exit closes the reaper's signalfd and exits with the
// child's exit status
void reaper_exit(reaper_t * reaper, int status)
{
@@ -68,11 +68,11 @@ void reaper_exit(reaper_t * reaper, int status)
exit(WEXITSTATUS(status));
}
-// reaper_reap reaps any dead processes. If the process that is reaped
+// reaper_reap reaps any dead processes. If the process that is reaped
// is the child process that we spawned get its exit status and exit this program
int reaper_reap(reaper_t * reaper)
{
- int status, child_exited, child_status = 0;
+ int status = 0, child_exited = 0, child_status = 0;
for (;;) {
pid_t pid = waitpid(-1, &status, WNOHANG);
switch (pid) {
@@ -140,6 +140,12 @@ int main(int argc, char **argv)
{
process_t process;
reaper_t reaper;
+
+ if (argc == 2 && !strcmp(argv[1], "--version")) {
+ printf("grimes version %s\n", VERSION);
+ exit(0);
+ }
+
if (reaper_new(&reaper, &process) != 0) {
bail("initialize reaper %s", strerror(errno));
}
```
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-11-02 09:27:54 -07:00
|
|
|
GRIMES_COMMIT=fe069a03affd2547fdb05e5b8b07202d2e41735b
|
2016-10-19 00:30:47 +01:00
|
|
|
LIBNETWORK_COMMIT=0f534354b813003a754606689722fe253101bc4e
|
2016-09-23 09:20:57 -07:00
|
|
|
|
2016-10-27 16:52:56 -07:00
|
|
|
RM_GOPATH=0
|
|
|
|
|
|
|
|
TMP_GOPATH=${TMP_GOPATH:-""}
|
|
|
|
|
|
|
|
if [ -z "$TMP_GOPATH" ]; then
|
|
|
|
export GOPATH="$(mktemp -d)"
|
|
|
|
RM_GOPATH=1
|
|
|
|
else
|
|
|
|
export GOPATH="$TMP_GOPATH"
|
|
|
|
fi
|
2016-09-23 09:20:57 -07:00
|
|
|
|
2016-10-19 11:49:10 -07:00
|
|
|
RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp apparmor selinux"}"
|
|
|
|
|
|
|
|
install_runc() {
|
|
|
|
echo "Install runc version $RUNC_COMMIT"
|
|
|
|
git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc"
|
|
|
|
cd "$GOPATH/src/github.com/opencontainers/runc"
|
|
|
|
git checkout -q "$RUNC_COMMIT"
|
|
|
|
make BUILDTAGS="$RUNC_BUILDTAGS" $1
|
|
|
|
cp runc /usr/local/bin/docker-runc
|
|
|
|
}
|
|
|
|
|
|
|
|
install_containerd() {
|
|
|
|
echo "Install containerd version $CONTAINERD_COMMIT"
|
|
|
|
git clone https://github.com/docker/containerd.git "$GOPATH/src/github.com/docker/containerd"
|
|
|
|
cd "$GOPATH/src/github.com/docker/containerd"
|
|
|
|
git checkout -q "$CONTAINERD_COMMIT"
|
|
|
|
make $1
|
|
|
|
cp bin/containerd /usr/local/bin/docker-containerd
|
|
|
|
cp bin/containerd-shim /usr/local/bin/docker-containerd-shim
|
|
|
|
cp bin/ctr /usr/local/bin/docker-containerd-ctr
|
|
|
|
}
|
|
|
|
|
2016-10-27 16:52:56 -07:00
|
|
|
install_proxy() {
|
|
|
|
echo "Install docker-proxy version $LIBNETWORK_COMMIT"
|
|
|
|
git clone https://github.com/docker/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork"
|
|
|
|
cd "$GOPATH/src/github.com/docker/libnetwork"
|
|
|
|
git checkout -q "$LIBNETWORK_COMMIT"
|
|
|
|
go build -ldflags="$PROXY_LDFLAGS" -o /usr/local/bin/docker-proxy github.com/docker/libnetwork/cmd/proxy
|
|
|
|
}
|
|
|
|
|
2016-09-23 09:20:57 -07:00
|
|
|
for prog in "$@"
|
|
|
|
do
|
|
|
|
case $prog in
|
|
|
|
tomlv)
|
|
|
|
echo "Install tomlv version $TOMLV_COMMIT"
|
|
|
|
git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml"
|
|
|
|
cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT"
|
|
|
|
go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv
|
|
|
|
;;
|
|
|
|
|
|
|
|
runc)
|
2016-10-19 11:49:10 -07:00
|
|
|
install_runc static
|
|
|
|
;;
|
|
|
|
|
|
|
|
runc-dynamic)
|
|
|
|
install_runc
|
2016-09-23 09:20:57 -07:00
|
|
|
;;
|
|
|
|
|
|
|
|
containerd)
|
2016-10-19 11:49:10 -07:00
|
|
|
install_containerd static
|
|
|
|
;;
|
|
|
|
|
|
|
|
containerd-dynamic)
|
|
|
|
install_containerd
|
2016-09-23 09:20:57 -07:00
|
|
|
;;
|
|
|
|
|
|
|
|
grimes)
|
|
|
|
echo "Install grimes version $GRIMES_COMMIT"
|
|
|
|
git clone https://github.com/crosbymichael/grimes.git "$GOPATH/grimes"
|
|
|
|
cd "$GOPATH/grimes"
|
|
|
|
git checkout -q "$GRIMES_COMMIT"
|
|
|
|
make
|
|
|
|
cp init /usr/local/bin/docker-init
|
|
|
|
;;
|
|
|
|
|
2016-10-19 00:30:47 +01:00
|
|
|
proxy)
|
2016-10-27 16:52:56 -07:00
|
|
|
export CGO_ENABLED=0
|
|
|
|
install_proxy
|
|
|
|
;;
|
|
|
|
|
|
|
|
proxy-dynamic)
|
|
|
|
PROXY_LDFLAGS="-linkmode=external" install_proxy
|
2016-10-19 00:30:47 +01:00
|
|
|
;;
|
|
|
|
|
2016-09-23 09:20:57 -07:00
|
|
|
*)
|
2016-10-19 00:30:47 +01:00
|
|
|
echo echo "Usage: $0 [tomlv|runc|containerd|grimes|proxy]"
|
2016-09-23 09:20:57 -07:00
|
|
|
exit 1
|
|
|
|
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2016-10-27 16:52:56 -07:00
|
|
|
if [ $RM_GOPATH -eq 1 ]; then
|
|
|
|
rm -rf "$GOPATH"
|
|
|
|
fi
|