From 4ddc74337e4de9722574d51cad267e66c2503276 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 24 Apr 2018 23:53:57 +0200 Subject: [PATCH 1/3] Layering hostname/hosts --- .../hassio-bind.target.wants/etc-hostname.mount | 1 + .../hassio-bind.target.wants/etc-hosts.mount | 1 + .../usr/lib/systemd/system/etc-hostname.mount | 14 ++++++++++++++ .../usr/lib/systemd/system/etc-hosts.mount | 14 ++++++++++++++ 4 files changed, 30 insertions(+) create mode 120000 buildroot-external/rootfs-overlay/etc/systemd/system/hassio-bind.target.wants/etc-hostname.mount create mode 120000 buildroot-external/rootfs-overlay/etc/systemd/system/hassio-bind.target.wants/etc-hosts.mount create mode 100644 buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hostname.mount create mode 100644 buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hosts.mount diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/hassio-bind.target.wants/etc-hostname.mount b/buildroot-external/rootfs-overlay/etc/systemd/system/hassio-bind.target.wants/etc-hostname.mount new file mode 120000 index 00000000000..173cae38889 --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/hassio-bind.target.wants/etc-hostname.mount @@ -0,0 +1 @@ +/usr/lib/systemd/system/etc-hostname.mount \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/etc/systemd/system/hassio-bind.target.wants/etc-hosts.mount b/buildroot-external/rootfs-overlay/etc/systemd/system/hassio-bind.target.wants/etc-hosts.mount new file mode 120000 index 00000000000..d22d22eb3ed --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/systemd/system/hassio-bind.target.wants/etc-hosts.mount @@ -0,0 +1 @@ +/usr/lib/systemd/system/etc-hosts.mount \ No newline at end of file diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hostname.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hostname.mount new file mode 100644 index 00000000000..6f2f378f735 --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hostname.mount @@ -0,0 +1,14 @@ +[Unit] +Description=Hostname persistent configuration +Requires=mnt-overlay.mount +After=mnt-overlay.mount +Before=network.target + +[Mount] +What=/mnt/overlay/etc/hostname +Where=/etc/hostname +Type=none +Options=bind + +[Install] +WantedBy=hassio-bind.target diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hosts.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hosts.mount new file mode 100644 index 00000000000..fcffc83ab2b --- /dev/null +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hosts.mount @@ -0,0 +1,14 @@ +[Unit] +Description=Hosts persistent configuration +Requires=mnt-overlay.mount +After=mnt-overlay.mount +Before=network.target + +[Mount] +What=/mnt/overlay/etc/hosts +Where=/etc/hosts +Type=none +Options=bind + +[Install] +WantedBy=hassio-bind.target From 2f54d76d479b44c6045f2905800b2d21d09bef11 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 26 Apr 2018 22:52:49 +0200 Subject: [PATCH 2/3] Fix build --- buildroot-external/package/hassio/builder/hostapp.sh | 4 ++-- scripts/enter.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/buildroot-external/package/hassio/builder/hostapp.sh b/buildroot-external/package/hassio/builder/hostapp.sh index 61e0f53d720..2a7806624a3 100755 --- a/buildroot-external/package/hassio/builder/hostapp.sh +++ b/buildroot-external/package/hassio/builder/hostapp.sh @@ -55,11 +55,11 @@ mkdir -p /mnt/supervisor mkdir -p /mnt/cli # Run dockerd -dockerd -s overlay2 -g /mnt/docker 2> /dev/null & +dockerd -s overlay2 -g /mnt/docker & DOCKER_PID=$! +DOCKER_COUNT=0 until docker info >/dev/null 2>&1; do - DOCKER_COUNT=0 if [ ${DOCKER_COUNT} -gt 30 ]; then exit 1 fi diff --git a/scripts/enter.sh b/scripts/enter.sh index 0be4cb7edd2..1ca96ced3ad 100755 --- a/scripts/enter.sh +++ b/scripts/enter.sh @@ -1,3 +1,4 @@ #!/bin/bash +modprobe overlayfs docker build -t hassbuildroot . docker run -it --rm --privileged -v "$(pwd):/build" hassbuildroot bash From 29b66de0c068161a8bc3d25d4fc7635980d58c39 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Fri, 27 Apr 2018 17:12:00 +0200 Subject: [PATCH 3/3] Use origin files on new overlay --- buildroot-external/rootfs-overlay/etc/tmpfiles.d/hostname.conf | 2 ++ .../rootfs-overlay/usr/lib/systemd/system/etc-hostname.mount | 2 +- .../rootfs-overlay/usr/lib/systemd/system/etc-hosts.mount | 2 +- .../rootfs-overlay/usr/lib/systemd/system/mnt-overlay.mount | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 buildroot-external/rootfs-overlay/etc/tmpfiles.d/hostname.conf diff --git a/buildroot-external/rootfs-overlay/etc/tmpfiles.d/hostname.conf b/buildroot-external/rootfs-overlay/etc/tmpfiles.d/hostname.conf new file mode 100644 index 00000000000..9d64a05167a --- /dev/null +++ b/buildroot-external/rootfs-overlay/etc/tmpfiles.d/hostname.conf @@ -0,0 +1,2 @@ +C /mnt/overlay/etc/hostname - - - - /etc/hostname +C /mnt/overlay/etc/hosts - - - - /etc/hosts diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hostname.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hostname.mount index 6f2f378f735..be4a26beabd 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hostname.mount +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hostname.mount @@ -1,7 +1,7 @@ [Unit] Description=Hostname persistent configuration Requires=mnt-overlay.mount -After=mnt-overlay.mount +After=mnt-overlay.mount systemd-tmpfiles-setup.service Before=network.target [Mount] diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hosts.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hosts.mount index fcffc83ab2b..366be99064f 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hosts.mount +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/etc-hosts.mount @@ -1,7 +1,7 @@ [Unit] Description=Hosts persistent configuration Requires=mnt-overlay.mount -After=mnt-overlay.mount +After=mnt-overlay.mount systemd-tmpfiles-setup.service Before=network.target [Mount] diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-overlay.mount b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-overlay.mount index f648f6bfd47..7af4b28a0c8 100644 --- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-overlay.mount +++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/mnt-overlay.mount @@ -1,7 +1,7 @@ [Unit] Description=Hassio overlay partition DefaultDependencies=no -Before=umount.target +Before=umount.target systemd-tmpfiles-setup.service Conflicts=umount.target [Mount]