From 9bbc0ecbeea043d85bbb3bbb017a9be06b33fc4a Mon Sep 17 00:00:00 2001 From: David Scott Date: Sun, 1 Jul 2018 14:00:56 +0100 Subject: [PATCH] projects/logging: delete the remaining unused bits Signed-off-by: David Scott --- projects/logging/pkg/init/.gitignore | 2 - projects/logging/pkg/init/Dockerfile | 6 - projects/logging/pkg/init/Makefile | 14 --- .../logging/pkg/init/etc/init.d/containerd | 9 -- .../logging/pkg/init/etc/init.d/containers | 36 ------ projects/logging/pkg/init/etc/init.d/rcS | 112 ----------------- projects/logging/pkg/init/etc/inittab | 15 --- projects/logging/pkg/init/etc/issue | 12 -- projects/logging/pkg/init/init | 45 ------- projects/logging/pkg/memlogd/.gitignore | 5 - .../logging/pkg/memlogd/Dockerfile.memlogd | 3 - projects/logging/pkg/memlogd/Makefile | 66 ---------- projects/logging/pkg/memlogd/config.json | 115 ------------------ 13 files changed, 440 deletions(-) delete mode 100644 projects/logging/pkg/init/.gitignore delete mode 100644 projects/logging/pkg/init/Dockerfile delete mode 100644 projects/logging/pkg/init/Makefile delete mode 100755 projects/logging/pkg/init/etc/init.d/containerd delete mode 100755 projects/logging/pkg/init/etc/init.d/containers delete mode 100755 projects/logging/pkg/init/etc/init.d/rcS delete mode 100644 projects/logging/pkg/init/etc/inittab delete mode 100644 projects/logging/pkg/init/etc/issue delete mode 100755 projects/logging/pkg/init/init delete mode 100644 projects/logging/pkg/memlogd/.gitignore delete mode 100644 projects/logging/pkg/memlogd/Dockerfile.memlogd delete mode 100644 projects/logging/pkg/memlogd/Makefile delete mode 100644 projects/logging/pkg/memlogd/config.json diff --git a/projects/logging/pkg/init/.gitignore b/projects/logging/pkg/init/.gitignore deleted file mode 100644 index cf40cde3b..000000000 --- a/projects/logging/pkg/init/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -sbin/ -usr/ diff --git a/projects/logging/pkg/init/Dockerfile b/projects/logging/pkg/init/Dockerfile deleted file mode 100644 index 5ef49b03f..000000000 --- a/projects/logging/pkg/init/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -# Use sha256 here to get a fixed version -FROM alpine:edge@sha256:99588bc8883c955c157d18fc3eaa4a3c1400c223e6c7cabca5f600a3e9f8d5cd -ENTRYPOINT [] -CMD [] -WORKDIR / -COPY . ./ diff --git a/projects/logging/pkg/init/Makefile b/projects/logging/pkg/init/Makefile deleted file mode 100644 index bc5b840d6..000000000 --- a/projects/logging/pkg/init/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -.PHONY: tag push -default: push - -IMAGE=init -DEPS=Dockerfile init $(wildcard etc/*) $(wildcard etc/init.d/*) - -HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}') - -tag: $(DEPS) - docker build --no-cache --network=none -t linuxkit/$(IMAGE):$(HASH) . - -push: tag - docker pull linuxkit/$(IMAGE):$(HASH) || \ - docker push linuxkit/$(IMAGE):$(HASH) diff --git a/projects/logging/pkg/init/etc/init.d/containerd b/projects/logging/pkg/init/etc/init.d/containerd deleted file mode 100755 index f62710d7e..000000000 --- a/projects/logging/pkg/init/etc/init.d/containerd +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# bring up containerd -ulimit -n 1048576 -ulimit -p unlimited - -printf "\nStarting containerd\n" -mkdir -p /var/log -exec /usr/bin/containerd diff --git a/projects/logging/pkg/init/etc/init.d/containers b/projects/logging/pkg/init/etc/init.d/containers deleted file mode 100755 index fefaf9d25..000000000 --- a/projects/logging/pkg/init/etc/init.d/containers +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# start memlogd container - -/usr/bin/startmemlogd - -# start onboot containers, run to completion - -if [ -d /containers/onboot ] -then - for f in $(find /containers/onboot -mindepth 1 -maxdepth 1 | sort) - do - base="$(basename $f)" - /bin/mount --bind "$f/rootfs" "$f/rootfs" - mount -o remount,rw "$f/rootfs" - /usr/bin/logwrite -n "$(basename $f)" /usr/bin/runc run --bundle "$f" "$(basename $f)" - printf " - $base\n" - done -fi - -# start service containers - -if [ -d /containers/services ] -then - for f in $(find /containers/services -mindepth 1 -maxdepth 1 | sort) - do - base="$(basename $f)" - /bin/mount --bind "$f/rootfs" "$f/rootfs" - mount -o remount,rw "$f/rootfs" - log="/var/log/$base.log" - /usr/bin/logwrite -n "$(basename $f)" ctr run --runtime-config "$f/config.json" --rootfs "$f/rootfs" --id "$(basename $f)" $log >$log & - printf " - $base\n" - done -fi - -wait diff --git a/projects/logging/pkg/init/etc/init.d/rcS b/projects/logging/pkg/init/etc/init.d/rcS deleted file mode 100755 index 339a428ba..000000000 --- a/projects/logging/pkg/init/etc/init.d/rcS +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/sh - -# mount filesystems -mount -n -t proc proc /proc -o nodev,nosuid,noexec,relatime - -mount -n -t tmpfs tmpfs /run -o nodev,nosuid,noexec,relatime,size=10%,mode=755 -mount -n -t tmpfs tmpfs /tmp -o nodev,nosuid,noexec,relatime,size=10%,mode=1777 - -# mount devfs -mount -n -t devtmpfs dev /dev -o nosuid,noexec,relatime,size=10m,nr_inodes=248418,mode=755 -# devices -[ -c /dev/console ] || mknod -m 600 /dev/console c 5 1 -[ -c /dev/tty1 ] || mknod -m 620 /dev/tty1 c 4 1 -[ -c /dev/tty ] || mknod -m 666 /dev/tty c 5 0 - -[ -c /dev/null ] || mknod -m 666 /dev/null c 1 3 -[ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11 - -# extra symbolic links not provided by default -[ -e /dev/fd ] || ln -snf /proc/self/fd /dev/fd -[ -e /dev/stdin ] || ln -snf /proc/self/fd/0 /dev/stdin -[ -e /dev/stdout ] || ln -snf /proc/self/fd/1 /dev/stdout -[ -e /dev/stderr ] || ln -snf /proc/self/fd/2 /dev/stderr -[ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core - -# devfs filesystems -mkdir -p -m 1777 /dev/mqueue -mkdir -p -m 1777 /dev/shm -mkdir -p -m 0755 /dev/pts -mount -n -t mqueue -o noexec,nosuid,nodev mqueue /dev/mqueue -mount -n -t tmpfs -o noexec,nosuid,nodev,mode=1777 shm /dev/shm -mount -n -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts - -# mount sysfs -sysfs_opts=nodev,noexec,nosuid -mount -n -t sysfs -o ${sysfs_opts} sysfs /sys -[ -d /sys/kernel/security ] && mount -n -t securityfs -o ${sysfs_opts} securityfs /sys/kernel/security -[ -d /sys/kernel/debug ] && mount -n -t debugfs -o ${sysfs_opts} debugfs /sys/kernel/debug -[ -d /sys/kernel/config ] && mount -n -t configfs -o ${sysfs_opts} configfs /sys/kernel/config -[ -d /sys/fs/fuse/connections ] && mount -n -t fusectl -o ${sysfs_opts} fusectl /sys/fs/fuse/connections -[ -d /sys/fs/selinux ] && mount -n -t selinuxfs -o nosuid,noexec selinuxfs /sys/fs/selinux -[ -d /sys/fs/pstore ] && mount -n -t pstore pstore -o ${sysfs_opts} /sys/fs/pstore -[ -d /sys/firmware/efi/efivars ] && mount -n -t efivarfs -o ro,${sysfs_opts} efivarfs /sys/firmware/efi/efivars - -# misc /proc mounted fs -[ -d /proc/sys/fs/binfmt_misc ] && mount -t binfmt_misc -o nodev,noexec,nosuid binfmt_misc /proc/sys/fs/binfmt_misc - -# mount cgroups -mount -n -t tmpfs -o nodev,noexec,nosuid,mode=755,size=10m cgroup_root /sys/fs/cgroup - -while read name hier groups enabled rest -do - case "${enabled}" in - 1) mkdir -p /sys/fs/cgroup/${name} - mount -n -t cgroup -o ${sysfs_opts},${name} ${name} /sys/fs/cgroup/${name} - ;; - esac -done < /proc/cgroups - -# use hierarchy for memory -echo 1 > /sys/fs/cgroup/memory/memory.use_hierarchy - -# for compatibility -mkdir -p /sys/fs/cgroup/systemd -mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd - -# start mdev for hotplug -echo "/sbin/mdev" > /proc/sys/kernel/hotplug - -# mdev -s will not create /dev/usb[1-9] devices with recent kernels -# so we trigger hotplug events for usb for now -for i in $(find /sys/devices -name 'usb[0-9]*'); do - [ -e $i/uevent ] && echo add > $i/uevent -done - -mdev -s - -# set hostname -if [ -s /etc/hostname ] -then - hostname -F /etc/hostname -fi - -if [ $(hostname) = "(none)" -a -f /sys/class/net/eth0/address ] -then - mac=$(cat /sys/class/net/eth0/address) - hostname linuxkit-$(echo $mac | sed 's/://g') -fi - -# set system clock from hwclock -hwclock --hctosys --utc - -# bring up loopback interface -ip addr add 127.0.0.1/8 dev lo brd + scope host -ip route add 127.0.0.0/8 dev lo scope host -ip link set lo up - -# for containerising dhcpcd and other containers that need writable etc -mkdir /tmp/etc -mv /etc/resolv.conf /tmp/etc/resolv.conf -ln -snf /tmp/etc/resolv.conf /etc/resolv.conf - -# remount rootfs as readonly -mount -o remount,ro / - -# make /var writeable and shared -mount -o bind /var /var -mount -o remount,rw,nodev,nosuid,noexec,relatime /var /var -mount --make-rshared /var - -# make / rshared -mount --make-rshared / diff --git a/projects/logging/pkg/init/etc/inittab b/projects/logging/pkg/init/etc/inittab deleted file mode 100644 index 8ef3e8565..000000000 --- a/projects/logging/pkg/init/etc/inittab +++ /dev/null @@ -1,15 +0,0 @@ -# /etc/inittab - -::sysinit:/etc/init.d/rcS -::once:/etc/init.d/containerd -::once:/etc/init.d/containers - -# Stuff to do for the 3-finger salute -::ctrlaltdel:/sbin/reboot - -# Stuff to do before rebooting -::shutdown:/usr/sbin/killall5 -15 -::shutdown:/bin/sleep 5 -::shutdown:/usr/sbin/killall5 -9 -::shutdown:/bin/echo "Unmounting filesystems" -::shutdown:/bin/umount -a -r diff --git a/projects/logging/pkg/init/etc/issue b/projects/logging/pkg/init/etc/issue deleted file mode 100644 index 946b06234..000000000 --- a/projects/logging/pkg/init/etc/issue +++ /dev/null @@ -1,12 +0,0 @@ - -Welcome to LinuxKit - - ## . - ## ## ## == - ## ## ## ## ## === - /"""""""""""""""""\___/ === - { / ===- - \______ O __/ - \ \ __/ - \____\_______/ - diff --git a/projects/logging/pkg/init/init b/projects/logging/pkg/init/init deleted file mode 100755 index f27b647b0..000000000 --- a/projects/logging/pkg/init/init +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -setup_console() { - tty=${1%,*} - speed=${1#*,} - inittab="$2" - securetty="$3" - line= - term="linux" - [ "$speed" = "$1" ] && speed=115200 - - case "$tty" in - ttyS*|ttyAMA*|ttyUSB*|ttyMFD*) - line="-L" - term="vt100" - ;; - tty?) - line="" - speed="38400" - term="" - ;; - esac - # skip consoles already in inittab - grep -q "^$tty:" "$inittab" && return - - echo "$tty::once:cat /etc/issue" >> "$inittab" - echo "$tty::respawn:/sbin/getty -n -l /bin/sh $line $speed $tty $term" >> "$inittab" - if ! grep -q -w "$tty" "$securetty"; then - echo "$tty" >> "$securetty" - fi -} - -/bin/mount -t tmpfs tmpfs /mnt - -/bin/cp -a / /mnt 2>/dev/null - -/bin/mount -t proc -o noexec,nosuid,nodev proc /proc -for opt in $(cat /proc/cmdline); do - case "$opt" in - console=*) - setup_console ${opt#console=} /mnt/etc/inittab /mnt/etc/securetty;; - esac -done - -exec /bin/busybox switch_root /mnt /sbin/init diff --git a/projects/logging/pkg/memlogd/.gitignore b/projects/logging/pkg/memlogd/.gitignore deleted file mode 100644 index d1be63e32..000000000 --- a/projects/logging/pkg/memlogd/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -usr -hash -containers -.* -sbin diff --git a/projects/logging/pkg/memlogd/Dockerfile.memlogd b/projects/logging/pkg/memlogd/Dockerfile.memlogd deleted file mode 100644 index 2d5fd9d28..000000000 --- a/projects/logging/pkg/memlogd/Dockerfile.memlogd +++ /dev/null @@ -1,3 +0,0 @@ -FROM scratch -COPY . ./ -CMD ["/usr/bin/memlogd","-fd","3"] diff --git a/projects/logging/pkg/memlogd/Makefile b/projects/logging/pkg/memlogd/Makefile deleted file mode 100644 index 2d7f1db0f..000000000 --- a/projects/logging/pkg/memlogd/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -GO_COMPILE=mobylinux/go-compile:3afebc59c5cde31024493c3f91e6102d584a30b9@sha256:e0786141ea7df8ba5735b63f2a24b4ade9eae5a02b0e04c4fca33b425ec69b0a - -SHA_IMAGE=alpine:3.5@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8 - -MEMLOGD_BINARY=usr/bin/memlogd -LOGWRITE_BINARY=usr/bin/logwrite -STARTMEMLOGD_BINARY=usr/bin/startmemlogd -LOGREAD_BINARY=sbin/logread - -IMAGE=memlogd - -.PHONY: tag push clean container -default: tag - -DEPS=$(MEMLOGD_BINARY) $(LOGWRITE_BINARY) $(STARTMEMLOGD_BINARY) $(LOGREAD_BINARY) - -$(MEMLOGD_BINARY): cmd/memlogd/main.go - mkdir -p $(dir $@) - tar -Ccmd/memlogd -cf - main.go | docker run --rm --net=none --log-driver=none -i $(GO_COMPILE) -o $@ | tar xf - - -$(LOGWRITE_BINARY): cmd/logwrite/main.go - mkdir -p $(dir $@) - tar -Ccmd/logwrite -cf - main.go | docker run --rm --net=none --log-driver=none -i $(GO_COMPILE) -o $@ | tar xf - - -$(STARTMEMLOGD_BINARY): cmd/startmemlogd/main.go - mkdir -p $(dir $@) - tar -Ccmd/startmemlogd -cf - main.go | docker run --rm --net=none --log-driver=none -i $(GO_COMPILE) -o $@ | tar xf - - -$(LOGREAD_BINARY): cmd/logread/main.go - mkdir -p $(dir $@) - tar -Ccmd/logread -cf - main.go | docker run --rm --net=none --log-driver=none -i $(GO_COMPILE) -o $@ | tar xf - - -containers: $(MEMLOGD_BINARY) Dockerfile.memlogd config.json - mkdir -p containers/init/memlogd/rootfs - tar -cf - $^ | docker build -f Dockerfile.memlogd -t $(IMAGE):build1 --no-cache - - docker create --name $(IMAGE)-build1 $(IMAGE):build1 - docker export $(IMAGE)-build1 | tar -Ccontainers/init/memlogd/rootfs -xv - - docker rm $(IMAGE)-build1 - docker rmi $(IMAGE):build1 - mv containers/init/memlogd/rootfs/Dockerfile.memlogd containers/init/memlogd/rootfs/Dockerfile - mv containers/init/memlogd/rootfs/config.json containers/init/memlogd - -container: Dockerfile $(LOGWRITE_BINARY) $(STARTMEMLOGD_BINARY) $(LOGREAD_BINARY) containers - tar cf - $^ | docker build --no-cache -t $(IMAGE):build - - -hash: Dockerfile Dockerfile.memlogd $(DEPS) - find $^ -type f | xargs cat | docker run --rm -i $(SHA_IMAGE) sha1sum - | sed 's/ .*//' > hash - -push: hash container - docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ - (docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) && \ - docker push linuxkit/$(IMAGE):$(shell cat hash)) - docker rmi $(IMAGE):build - rm -f hash - -tag: hash container - docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ - docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) - docker rmi $(IMAGE):build - rm -f hash - -clean: - rm -rf hash usr containers sbin - -.DELETE_ON_ERROR: - diff --git a/projects/logging/pkg/memlogd/config.json b/projects/logging/pkg/memlogd/config.json deleted file mode 100644 index d2b188a27..000000000 --- a/projects/logging/pkg/memlogd/config.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "ociVersion": "1.0.0-rc5-dev", - "platform": { - "os": "linux", - "arch": "amd64" - }, - "process": { - "consoleSize": { - "height": 0, - "width": 0 - }, - "user": { - "uid": 0, - "gid": 0 - }, - "args": [ - "/usr/bin/memlogd", - "-fd-log", - "3", - "-fd-query", - "4" - ], - "env": [ - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - ], - "cwd": "/", - "capabilities": {} - }, - "root": { - "path": "rootfs", - "readonly": true - }, - "mounts": [ - { - "destination": "/proc", - "type": "proc", - "source": "proc", - "options": [ - "nosuid", - "nodev", - "noexec", - "relatime" - ] - }, - { - "destination": "/dev", - "type": "tmpfs", - "source": "tmpfs", - "options": [ - "nosuid", - "strictatime", - "mode=755", - "size=65536k", - "ro" - ] - }, - { - "destination": "/sys", - "type": "sysfs", - "source": "sysfs", - "options": [ - "nosuid", - "noexec", - "nodev", - "ro" - ] - }, - { - "destination": "/dev/pts", - "type": "devpts", - "source": "devpts", - "options": [ - "nosuid", - "noexec", - "newinstance", - "ptmxmode=0666", - "mode=0620" - ] - }, - { - "destination": "/sys/fs/cgroup", - "type": "cgroup", - "source": "cgroup", - "options": [ - "nosuid", - "noexec", - "nodev", - "relatime", - "ro" - ] - } - ], - "linux": { - "resources": { - "disableOOMKiller": false - }, - "namespaces": [ - { - "type": "network" - }, - { - "type": "pid" - }, - { - "type": "ipc" - }, - { - "type": "uts" - }, - { - "type": "mount" - } - ] - } -}