From 8b0cfe7a53b7bcf65e51f747955b5ccf2b619142 Mon Sep 17 00:00:00 2001 From: Matheson Steplock Date: Thu, 15 Sep 2022 03:00:29 -0400 Subject: [PATCH] Expose systemd-journal-gatewayd (#235) * Expose systemd-journal-gatewayd * Enable and start systemd-journal-gatewayd.socket * add systemd-journal-remote to requirements * add systemd-journal-remote to requirements --- README.md | 3 ++- homeassistant-supervised/DEBIAN/control | 2 +- homeassistant-supervised/DEBIAN/postinst | 7 +++++++ .../systemd/system/hassio-supervisor.service | 4 ++-- .../system/systemd-journal-gatewayd.socket | 18 ++++++++++++++++++ .../usr/sbin/hassio-supervisor | 1 + 6 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 homeassistant-supervised/usr/lib/systemd/system/systemd-journal-gatewayd.socket diff --git a/README.md b/README.md index 8f7ef9f..7546b7c 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ curl \ udisks2 \ libglib2.0-bin \ network-manager \ -dbus -y +dbus \ +systemd-journal-remote -y ``` Step 2: Install Docker-CE with the following command: diff --git a/homeassistant-supervised/DEBIAN/control b/homeassistant-supervised/DEBIAN/control index 88906eb..cd2be0a 100755 --- a/homeassistant-supervised/DEBIAN/control +++ b/homeassistant-supervised/DEBIAN/control @@ -3,7 +3,7 @@ Section: base Version: 1.2.2 Priority: optional Architecture: all -Depends: curl, bash, docker-ce, dbus, network-manager, apparmor, jq, systemd, os-agent +Depends: curl, bash, docker-ce, dbus, network-manager, apparmor, jq, systemd, os-agent, systemd-journal-remote Maintainer: Matheson Steplock Homepage: https://www.home-assistant.io/ Description: Home Assistant Supervised diff --git a/homeassistant-supervised/DEBIAN/postinst b/homeassistant-supervised/DEBIAN/postinst index e6332a7..8b03d6b 100755 --- a/homeassistant-supervised/DEBIAN/postinst +++ b/homeassistant-supervised/DEBIAN/postinst @@ -31,6 +31,13 @@ if [ "$(systemctl is-active systemd-resolved)" = 'inactive' ]; then systemctl start systemd-resolved.service> /dev/null 2>&1; fi +# Enable and start systemd-journal-gatewayd +if [ "$(systemctl is-active systemd-journal-gatewayd.socket)" = 'inactive' ]; then + info "Enable systemd-journal-gatewayd" + systemctl enable systemd-journal-gatewayd.socket> /dev/null 2>&1; + systemctl start systemd-journal-gatewayd.socket> /dev/null 2>&1; +fi + # Restart Docker service info "Restarting docker service" systemctl restart "${SERVICE_DOCKER}" diff --git a/homeassistant-supervised/etc/systemd/system/hassio-supervisor.service b/homeassistant-supervised/etc/systemd/system/hassio-supervisor.service index ed885d7..39fb77a 100644 --- a/homeassistant-supervised/etc/systemd/system/hassio-supervisor.service +++ b/homeassistant-supervised/etc/systemd/system/hassio-supervisor.service @@ -1,8 +1,8 @@ [Unit] Description=Hass.io supervisor Requires=docker.service dbus.service -Wants=network-online.target hassio-apparmor.service time-sync.target -After=docker.service dbus.service network-online.target hassio-apparmor.service time-sync.target +Wants=network-online.target hassio-apparmor.service time-sync.target systemd-journal-gatewayd.socket +After=docker.service dbus.service network-online.target hassio-apparmor.service time-sync.target systemd-journal-gatewayd.socket StartLimitIntervalSec=60 StartLimitBurst=5 ConditionPathExists=/run/dbus/system_bus_socket diff --git a/homeassistant-supervised/usr/lib/systemd/system/systemd-journal-gatewayd.socket b/homeassistant-supervised/usr/lib/systemd/system/systemd-journal-gatewayd.socket new file mode 100644 index 0000000..a48e519 --- /dev/null +++ b/homeassistant-supervised/usr/lib/systemd/system/systemd-journal-gatewayd.socket @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Journal Gateway Service Socket +Documentation=man:systemd-journal-gatewayd(8) + +[Socket] +ListenStream=/run/systemd-journal-gatewayd.sock + +[Install] +WantedBy=sockets.target \ No newline at end of file diff --git a/homeassistant-supervised/usr/sbin/hassio-supervisor b/homeassistant-supervised/usr/sbin/hassio-supervisor index 77c6369..b90840f 100644 --- a/homeassistant-supervised/usr/sbin/hassio-supervisor +++ b/homeassistant-supervised/usr/sbin/hassio-supervisor @@ -82,6 +82,7 @@ if [ -z "${SUPERVISOR_CONTAINER_ID}" ]; then --name hassio_supervisor \ --privileged --security-opt apparmor="hassio-supervisor" \ -v /run/docker.sock:/run/docker.sock:rw \ + -v /run/systemd-journal-gatewayd.sock:/run/systemd-journal-gatewayd.sock:rw \ -v /run/dbus:/run/dbus:ro \ -v /run/supervisor:/run/os:rw \ -v /run/udev:/run/udev:ro \