From 20cfa2af2ce18a9d6041bd4560f5a970bc8fa4a9 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 25 Apr 2017 13:50:42 +0100 Subject: [PATCH] Switch fallback hostname to linuxkit-* from moby-* This was missed when things were renamed. The intention with this code was (apparently) to provide a (pseudo)unique hostname in the case where something more specific was not provided (e.g. by DHCP). Make this a little clearer by using '(none)' rather than 'linuxkit' as the default, in the normal case this will be overwritten by something more specific and if it isn't we will change it to something somewhat unique derived from the MAC address (as before). nb: '(none)' is already used by Debian so I think it is a safe choice as the sentinel value. The use of both CONFIG_DEFAULT_HOSTNAME and the explicit /etc/hostname from mkimage.sh is likely to be redundant in some cases, but neither seems to completely cover all cases so keep both. Signed-off-by: Ian Campbell --- examples/minimal.yml | 2 +- examples/node_exporter.yml | 2 +- kernel/Makefile | 6 +++--- kernel/kernel_config | 2 +- linuxkit.yml | 2 +- pkg/init/etc/init.d/rcS | 4 ++-- projects/etcd/etcd.yml | 2 +- tools/mkimage-base/mkimage.sh | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/minimal.yml b/examples/minimal.yml index 183d5394a..aec93990e 100644 --- a/examples/minimal.yml +++ b/examples/minimal.yml @@ -2,7 +2,7 @@ kernel: image: "linuxkit/kernel:4.9.x" cmdline: "console=ttyS0 console=tty0 page_poison=1" init: - - linuxkit/init:42fe8cb1508b3afed39eb89821906e3cc7a70551 + - linuxkit/init:1c8cd75ec89313f4058b069449e9bac966cd96b1 - linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9 - linuxkit/containerd:60e2486a74c665ba4df57e561729aec20758daed onboot: diff --git a/examples/node_exporter.yml b/examples/node_exporter.yml index 49c99c61d..dcf39f446 100644 --- a/examples/node_exporter.yml +++ b/examples/node_exporter.yml @@ -3,7 +3,7 @@ kernel: cmdline: "console=ttyS0 page_poison=1" init: - linuxkit/init:63eed9ca7a09d2ce4c0c5e7238ac005fa44f564b - - linuxkit/init:42fe8cb1508b3afed39eb89821906e3cc7a70551 + - linuxkit/init:1c8cd75ec89313f4058b069449e9bac966cd96b1 - linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9 - linuxkit/containerd:fe1b7f438a234cb6481c6538295115eac2a0596d services: diff --git a/kernel/Makefile b/kernel/Makefile index cf20ab529..e341064ca 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -20,18 +20,18 @@ all: bzImage tag # IMAGE_VERSION is used to determine if a new image should be pushed to hub. ifeq ($(KERNEL),v4.4) KERNEL_VERSION=4.4.61 -IMAGE_VERSION=$(KERNEL_VERSION)-0 +IMAGE_VERSION=$(KERNEL_VERSION)-1 IMAGE_MAJOR_VERSION=4.4.x DEPS=Dockerfile.4.4 Makefile kernel_config kernel_config.debug kernel_config.4.4 patches-4.4 else ifeq ($(KERNEL),v4.10) KERNEL_VERSION=4.10.10 -IMAGE_VERSION=$(KERNEL_VERSION)-0 +IMAGE_VERSION=$(KERNEL_VERSION)-1 IMAGE_MAJOR_VERSION=4.10.x DEPS=Dockerfile.4.10 Makefile kernel_config kernel_config.debug patches-4.10 else KERNEL_VERSION=4.9.22 -IMAGE_VERSION=$(KERNEL_VERSION)-0 +IMAGE_VERSION=$(KERNEL_VERSION)-1 IMAGE_MAJOR_VERSION=4.9.x DEPS=Dockerfile Makefile kernel_config kernel_config.debug patches-4.9 endif diff --git a/kernel/kernel_config b/kernel/kernel_config index 691f9ccf7..0cb4088f2 100644 --- a/kernel/kernel_config +++ b/kernel/kernel_config @@ -67,7 +67,7 @@ CONFIG_KERNEL_GZIP=y # CONFIG_KERNEL_XZ is not set # CONFIG_KERNEL_LZO is not set # CONFIG_KERNEL_LZ4 is not set -CONFIG_DEFAULT_HOSTNAME="moby" +CONFIG_DEFAULT_HOSTNAME="(none)" CONFIG_SWAP=y CONFIG_SYSVIPC=y CONFIG_SYSVIPC_SYSCTL=y diff --git a/linuxkit.yml b/linuxkit.yml index 61de49b8f..f10ead771 100644 --- a/linuxkit.yml +++ b/linuxkit.yml @@ -2,7 +2,7 @@ kernel: image: "linuxkit/kernel:4.9.x" cmdline: "console=ttyS0 console=tty0 page_poison=1" init: - - linuxkit/init:42fe8cb1508b3afed39eb89821906e3cc7a70551 + - linuxkit/init:1c8cd75ec89313f4058b069449e9bac966cd96b1 - linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9 - linuxkit/containerd:60e2486a74c665ba4df57e561729aec20758daed - linuxkit/ca-certificates:eabc5a6e59f05aa91529d80e9a595b85b046f935 diff --git a/pkg/init/etc/init.d/rcS b/pkg/init/etc/init.d/rcS index fdd1faea4..40aefe377 100755 --- a/pkg/init/etc/init.d/rcS +++ b/pkg/init/etc/init.d/rcS @@ -83,10 +83,10 @@ then hostname -F /etc/hostname fi -if [ $(hostname) = "moby" -a -f /sys/class/net/eth0/address ] +if [ $(hostname) = "(none)" -a -f /sys/class/net/eth0/address ] then mac=$(cat /sys/class/net/eth0/address) - hostname moby-$(echo $mac | sed 's/://g') + hostname linuxkit-$(echo $mac | sed 's/://g') fi # set system clock from hwclock diff --git a/projects/etcd/etcd.yml b/projects/etcd/etcd.yml index 5334cc5eb..208f0e852 100644 --- a/projects/etcd/etcd.yml +++ b/projects/etcd/etcd.yml @@ -2,7 +2,7 @@ kernel: image: "linuxkit/kernel:4.9.x" cmdline: "console=ttyS0 console=tty0 page_poison=1" init: - - linuxkit/init:42fe8cb1508b3afed39eb89821906e3cc7a70551 + - linuxkit/init:1c8cd75ec89313f4058b069449e9bac966cd96b1 - linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9 - linuxkit/containerd:fe1b7f438a234cb6481c6538295115eac2a0596d - linuxkit/ca-certificates:eabc5a6e59f05aa91529d80e9a595b85b046f935 diff --git a/tools/mkimage-base/mkimage.sh b/tools/mkimage-base/mkimage.sh index 635a89897..fcb0cfae5 100755 --- a/tools/mkimage-base/mkimage.sh +++ b/tools/mkimage-base/mkimage.sh @@ -39,7 +39,7 @@ nameserver 2001:4860:4860::8888 nameserver 2001:4860:4860::8844 EOF -printf 'linuxkit' > etc/hostname +printf '(none)' > etc/hostname ln -s /proc/mounts etc/mtab