commit 39fa50f375541d5d0fb89f3728c8a5fecfab6ed7 (tree)
parent 49946b69a001b87207e3a81619cfc451ca2f822c
Author: Motiejus Jakštys <desired.mta@gmail.com>
Date: Tue, 2 Jun 2020 15:02:44 +0300
more hass things
Diffstat:
3 files changed, 8 insertions(+), 23 deletions(-)
diff --git a/root/rpi4b/etc/containers/storage.conf b/root/rpi4b/etc/containers/storage.conf
@@ -1,18 +0,0 @@
-[storage]
-
-# Default Storage Driver
-driver = "btrfs"
-
-# Temporary storage location
-runroot = "/var/run/containers/storage"
-
-# Primary Read/Write location of container storage
-graphroot = "/var/lib/containers/storage"
-
-[storage.options]
-
-[storage.options.overlay]
-# mountopt specifies comma separated list of extra mount options
-mountopt = "nodev"
-
-[storage.options.thinpool]
diff --git a/root/rpi4b/etc/systemd/system/hass2.service b/root/rpi4b/etc/systemd/system/hass2.service
@@ -2,16 +2,18 @@
Description=home-assistant
Wants=network-online.target systemd-resolved.service
After=network-online.target systemd-resolved.service
+RequiresMountsFor=/var/lib/oci /var/lib/machines
[Service]
-ExecStartPre=dockerlike-root hass2 homeassistant/home-assistant:0.107.7
-ExecStartPre=sh -c "jq 'del(.linux.namespaces[]|select(.type==\"network\"))' /var/lib/oci/hass2/config.json | sponge /var/lib/oci/t2/config.json"
+TimeoutStartSec=600
+ExecStartPre=dockerlike-root hass2 docker://homeassistant/home-assistant:0.107.7
+ExecStartPre=sh -c "jq 'del(.linux.namespaces[]|select(.type==\"network\"))' /var/lib/oci/hass2/config.json | sponge /var/lib/oci/hass2/config.json"
ExecStart=systemd-nspawn \
--keep-unit \
--machine=hass2 \
--capability=CAP_CHOWN \
- --oci-bundle=/var/lib/oci/%i \
- --template=/var/lib/oci/%i/rootfs \
+ --oci-bundle=/var/lib/oci/hass2 \
+ --template=/var/lib/oci/hass2/rootfs \
-U
KillMode=mixed
Type=notify
diff --git a/root/rpi4b/usr/local/bin/dockerlike-root b/root/rpi4b/usr/local/bin/dockerlike-root
@@ -4,7 +4,7 @@ set -euo pipefail
container=$1
url=$2
-TMPDIR=/var/tmp
+TMPDIR=/var/lib/oci/.tmp
CONTAINERDIR=/var/lib/oci
log() {
@@ -28,6 +28,7 @@ mkdir -p "$(dirname "$dir")"
btrfs subvolume create "$dir"
log "done"
+mkdir -p "$TMPDIR"
tmpdir=$(mktemp -d -p "$TMPDIR" $(basename "$container")XXXXX)
cleanup() {
log -n "Removing $tmpdir... "