From b3584319c5126abaf49c6249c9751233b089adc9 Mon Sep 17 00:00:00 2001
From: j1nx
Date: Sat, 2 Dec 2023 14:22:47 +0000
Subject: [PATCH] [ALL][RPI4] More work on pre-shipping containers
---
buildroot-external/board/ovos/raspberrypi/post-build.sh | 2 +-
.../raspberrypi/rootfs-overlay/etc/udev/rules.d/99-com.rules | 2 +-
.../ovos/.config/containers/systemd/ovos_audio.container | 3 ++-
.../home/ovos/.config/containers/systemd/ovos_cli.container | 2 +-
.../home/ovos/.config/containers/systemd/ovos_core.container | 3 ++-
.../home/ovos/.config/containers/systemd/ovos_gui.container | 4 ++--
.../.config/containers/systemd/ovos_gui_websocket.container | 2 +-
.../ovos/.config/containers/systemd/ovos_listener.container | 3 ++-
.../.config/containers/systemd/ovos_messagebus.container | 2 +-
.../home/ovos/.config/containers/systemd/ovos_phal.container | 3 ++-
.../.config/containers/systemd/ovos_phal_admin.container | 2 +-
buildroot-external/configs/rpi4_64_defconfig | 2 +-
.../package/ovos-containers/fetch-container-image.sh | 4 ++--
.../{10-combined-output.conf => 99-combined-output.conf} | 0
.../ovos/.config/containers/systemd/ovos_venv_audio.volume | 5 +++++
.../ovos/.config/containers/systemd/ovos_venv_core.volume | 5 +++++
.../.config/containers/systemd/ovos_venv_listener.volume | 5 +++++
.../ovos/.config/containers/systemd/ovos_venv_phal.volume | 5 +++++
.../rootfs-overlay/home/ovos/ovos/config/skills.list | 2 --
buildroot-external/rootfs-overlay/home/ovos/ovos/tmp/.empty | 0
.../usr/lib/udev/rules.d/50-udev-default.rules | 2 +-
21 files changed, 40 insertions(+), 18 deletions(-)
rename buildroot-external/rootfs-overlay/etc/pipewire/pipewire.conf.d/{10-combined-output.conf => 99-combined-output.conf} (100%)
create mode 100644 buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_audio.volume
create mode 100644 buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_core.volume
create mode 100644 buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_listener.volume
create mode 100644 buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_phal.volume
create mode 100644 buildroot-external/rootfs-overlay/home/ovos/ovos/tmp/.empty
diff --git a/buildroot-external/board/ovos/raspberrypi/post-build.sh b/buildroot-external/board/ovos/raspberrypi/post-build.sh
index 3c552677..c55a99e9 100755
--- a/buildroot-external/board/ovos/raspberrypi/post-build.sh
+++ b/buildroot-external/board/ovos/raspberrypi/post-build.sh
@@ -59,7 +59,7 @@ done
# Prepare home data
rm -f ${BINARIES_DIR}/homefs.ext4
-truncate --size="5G" ${BINARIES_DIR}/homefs.ext4
+truncate --size="6G" ${BINARIES_DIR}/homefs.ext4
mkfs.ext4 -L "homefs" -E lazy_itable_init=0,lazy_journal_init=0 ${BINARIES_DIR}/homefs.ext4
# Mount home image
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/etc/udev/rules.d/99-com.rules b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/etc/udev/rules.d/99-com.rules
index a3166119..bbb43c59 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/etc/udev/rules.d/99-com.rules
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/etc/udev/rules.d/99-com.rules
@@ -1,4 +1,4 @@
-SUBSYSTEM=="input", GROUP="input", MODE="0660"
+SUBSYSTEM=="input", GROUP="input", MODE="0666"
SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660"
SUBSYSTEM=="spidev", GROUP="spi", MODE="0660"
SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660"
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_audio.container b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_audio.container
index b68f7397..31ce8618 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_audio.container
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_audio.container
@@ -22,10 +22,11 @@ UserNS=keep-id:uid=%U,gid=%G
EnvironmentFile=%h/.config/containers/env
AddDevice=/dev/snd
Volume=%h/ovos/config:/home/ovos/.config/mycroft
-Volume=/dev/shm:/tmp
+Volume=%h/ovos/tmp:/tmp
Volume=%t/pipewire-0:/run/user/1000/pipewire-0:ro
Volume=%t/bus:/run/user/1000/bus:ro
Volume=ovos_tts_cache:/home/ovos/.cache/mycroft
+Volume=ovos_venv_audio:/home/ovos/.venv
[Service]
TimeoutStartSec=900
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_cli.container b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_cli.container
index 00767d7e..c6b40f97 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_cli.container
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_cli.container
@@ -14,7 +14,7 @@ Network=host
Timezone=local
UserNS=keep-id:uid=%U,gid=%G
Volume=%h/ovos/config:/home/ovos/.config/mycroft
-Volume=/dev/shm:/tmp
+Volume=%h/ovos/tmp:/tmp
Volume=/var/log/ovos:/var/log/mycroft
[Service]
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_core.container b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_core.container
index a5cd3d6a..7c2057b9 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_core.container
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_core.container
@@ -23,9 +23,10 @@ EnvironmentFile=%h/.config/containers/env
AddDevice=/dev/snd
AddDevice=/dev/gpiomem
Volume=%h/ovos/config:/home/ovos/.config/mycroft
-Volume=/dev/shm:/tmp
+Volume=%h/ovos/tmp:/tmp
Volume=%t/pipewire-0:/run/user/1000/pipewire-0:ro
Volume=ovos_nltk:/home/ovos/nltk_data
+Volume=ovos_venv_core:/home/ovos/.venv
Volume=%h/ovos/share:/home/ovos/.local/share/mycroft
[Service]
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui.container b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui.container
index 66277987..b0c37a78 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui.container
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui.container
@@ -10,7 +10,7 @@ After=ovos_messagebus.service
Wants=ovos_phal.service
After=ovos_phal.service
Wants=ovos_gui_websocket.service
-After=ovos_gui_websocker.service
+After=ovos_gui_websocket.service
[Container]
ContainerName=ovos_gui
@@ -27,7 +27,7 @@ AddDevice=/dev/dri
AddDevice=/dev/vchiq
AddDevice=/dev/input
Volume=%h/ovos/config:/home/ovos/.config/mycroft
-Volume=/dev/shm:/tmp
+Volume=%h/ovos/tmp:/tmp
Volume=%t/pipewire-0:/run/user/1000/pipewire-0:ro
Volume=%t/bus:/run/user/1000/bus:ro
Volume=%h/ovos/share:/home/ovos/.local/share/mycroft
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui_websocket.container b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui_websocket.container
index 97c77bb7..0103ce13 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui_websocket.container
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui_websocket.container
@@ -16,7 +16,7 @@ Network=host
Timezone=local
UserNS=keep-id:uid=%U,gid=%G
Volume=%h/ovos/config:/home/ovos/.config/mycroft:ro
-Volume=/dev/shm:/tmp
+Volume=%h/ovos/tmp:/tmp
Volume=ovos_gui_files:/home/ovos/.cache/ovos_gui_file_server
[Service]
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_listener.container b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_listener.container
index a7c5a7e7..78fa2481 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_listener.container
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_listener.container
@@ -22,11 +22,12 @@ UserNS=keep-id:uid=%U,gid=%G
EnvironmentFile=%h/.config/containers/env
AddDevice=/dev/snd
Volume=%h/ovos/config:/home/ovos/.config/mycroft:ro
-Volume=/dev/shm:/tmp
+Volume=%h/ovos/tmp:/tmp
Volume=%t/pipewire-0:/run/user/1000/pipewire-0:ro
Volume=ovos_listener_records:/home/ovos/.local/share/mycroft/listener
Volume=ovos_models:/home/ovos/.local/share/precise-lite
Volume=ovos_vosk:/home/ovos/.local/share/vosk
+Volume=ovos_venv_listener:/home/ovos/.venv
[Service]
TimeoutStartSec=900
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_messagebus.container b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_messagebus.container
index 265133b2..a221b134 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_messagebus.container
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_messagebus.container
@@ -14,7 +14,7 @@ Network=host
Timezone=local
UserNS=keep-id:uid=%U,gid=%G
Volume=%h/ovos/config:/home/ovos/.config/mycroft:ro
-Volume=/dev/shm:/tmp
+Volume=%h/ovos/tmp:/tmp
[Service]
TimeoutStartSec=900
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_phal.container b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_phal.container
index 561e69dd..1bc28f9f 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_phal.container
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_phal.container
@@ -21,8 +21,9 @@ EnvironmentFile=%h/.config/containers/env
AddDevice=/dev/snd
AddDevice=/dev/gpiomem
Volume=%h/ovos/config:/home/ovos/.config/mycroft
-Volume=/dev/shm:/tmp
+Volume=%h/ovos/tmp:/tmp
Volume=%t/pipewire-0:/run/user/1000/pipewire-0:ro
+Volume=ovos_venv_phal:/home/ovos/.venv
[Service]
TimeoutStartSec=900
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_phal_admin.container b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_phal_admin.container
index 724668c7..a33f8d16 100644
--- a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_phal_admin.container
+++ b/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_phal_admin.container
@@ -17,7 +17,7 @@ Timezone=local
UserNS=keep-id:uid=%U,gid=%G
AddDevice=/dev/gpiomem
Volume=%h/ovos/config:/home/ovos/.config/mycroft
-Volume=/dev/shm:/tmp
+Volume=%h/ovos/tmp:/tmp
Volume=/sys:/sys:ro
Volume=/dev:/dev:ro
diff --git a/buildroot-external/configs/rpi4_64_defconfig b/buildroot-external/configs/rpi4_64_defconfig
index c57d812e..2df69c58 100644
--- a/buildroot-external/configs/rpi4_64_defconfig
+++ b/buildroot-external/configs/rpi4_64_defconfig
@@ -305,7 +305,7 @@ BR2_PACKAGE_HOST_PKGCONF=y
BR2_PACKAGE_HOSTNAME_SERVICE=y
BR2_PACKAGE_NCPAMIXER=y
BR2_PACKAGE_OVOS_CONTAINERS=y
-BR2_PACKAGE_OVOS_CONTAINERS_ARCH="aarch64"
+BR2_PACKAGE_OVOS_CONTAINERS_ARCH="arm64"
BR2_PACKAGE_OVOS_CONTAINERS_IMAGES="ovos-messagebus"
BR2_PACKAGE_OVOS_SPLASH=y
BR2_PACKAGE_RESPEAKER=y
diff --git a/buildroot-external/package/ovos-containers/fetch-container-image.sh b/buildroot-external/package/ovos-containers/fetch-container-image.sh
index 23f3e9c8..1a65a9c0 100755
--- a/buildroot-external/package/ovos-containers/fetch-container-image.sh
+++ b/buildroot-external/package/ovos-containers/fetch-container-image.sh
@@ -12,7 +12,7 @@ dst_dir=$4
image_name="docker.io/smartgic/${image}"
full_image_name="${image_name}:alpha"
-image_digest=$(skopeo inspect --retry-times=5 "docker://${full_image_name}" | jq -r '.Digest')
+image_digest=$(skopeo --override-arch "${arch}" inspect --retry-times=5 "docker://${full_image_name}" | jq -r '.Digest')
image_file_name="${full_image_name//[:\/]/_}@${image_digest//[:\/]/_}"
image_file_path="${dl_dir}/${image_file_name}.tar"
@@ -24,7 +24,7 @@ dst_image_file_path="${dst_dir}/${image_file_name}.tar"
if [ ! -f "${image_file_path}" ]
then
echo "Fetching image: ${full_image_name} (digest ${image_digest})"
- skopeo copy "docker://${image_name}@${image_digest}" "docker-archive:${image_file_path}:${full_image_name}"
+ skopeo --override-arch "${arch}" copy "docker://${image_name}@${image_digest}" "docker-archive:${image_file_path}:${full_image_name}"
else
echo "Skipping download of existing image: ${full_image_name} (digest ${image_digest})"
fi
diff --git a/buildroot-external/rootfs-overlay/etc/pipewire/pipewire.conf.d/10-combined-output.conf b/buildroot-external/rootfs-overlay/etc/pipewire/pipewire.conf.d/99-combined-output.conf
similarity index 100%
rename from buildroot-external/rootfs-overlay/etc/pipewire/pipewire.conf.d/10-combined-output.conf
rename to buildroot-external/rootfs-overlay/etc/pipewire/pipewire.conf.d/99-combined-output.conf
diff --git a/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_audio.volume b/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_audio.volume
new file mode 100644
index 00000000..3023974b
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_audio.volume
@@ -0,0 +1,5 @@
+[Volume]
+User=ovos
+Group=ovos
+Copy=true
+Label=name=ovos_venv_audio
diff --git a/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_core.volume b/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_core.volume
new file mode 100644
index 00000000..b8c19e35
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_core.volume
@@ -0,0 +1,5 @@
+[Volume]
+User=ovos
+Group=ovos
+Copy=true
+Label=name=ovos_venv_core
diff --git a/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_listener.volume b/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_listener.volume
new file mode 100644
index 00000000..92457321
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_listener.volume
@@ -0,0 +1,5 @@
+[Volume]
+User=ovos
+Group=ovos
+Copy=true
+Label=name=ovos_venv_listener
diff --git a/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_phal.volume b/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_phal.volume
new file mode 100644
index 00000000..8a5826b5
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_venv_phal.volume
@@ -0,0 +1,5 @@
+[Volume]
+User=ovos
+Group=ovos
+Copy=true
+Label=name=ovos_venv_phal
diff --git a/buildroot-external/rootfs-overlay/home/ovos/ovos/config/skills.list b/buildroot-external/rootfs-overlay/home/ovos/ovos/config/skills.list
index 520f3146..b3c1c66e 100644
--- a/buildroot-external/rootfs-overlay/home/ovos/ovos/config/skills.list
+++ b/buildroot-external/rootfs-overlay/home/ovos/ovos/config/skills.list
@@ -1,12 +1,10 @@
git+https://github.com/OpenVoiceOS/skill-ovos-homescreen.git
git+https://github.com/openVoiceOS/skill-ovos-date-time.git
git+https://github.com/openVoiceOS/skill-ovos-naptime.git
-git+https://github.com/openVoiceOS/skill-ovos-news.git
git+https://github.com/OpenVoiceOS/skill-ovos-personal.git
git+https://github.com/OpenVoiceOS/skill-ovos-stop.git
git+https://github.com/OpenVoiceOS/skill-ovos-volume.git
git+https://github.com/OpenVoiceOS/skill-ovos-weather.git
-git+https://github.com/OpenVoiceOS/skill-ovos-youtube-music.git
git+https://github.com/OpenVoiceOS/skill-ovos-fallback-unknown.git
git+https://github.com/OpenVoiceOS/skill-ovos-wikipedia.git
git+https://github.com/OpenVoiceOS/skill-ovos-wolfie.git
diff --git a/buildroot-external/rootfs-overlay/home/ovos/ovos/tmp/.empty b/buildroot-external/rootfs-overlay/home/ovos/ovos/tmp/.empty
new file mode 100644
index 00000000..e69de29b
diff --git a/buildroot-external/rootfs-overlay/usr/lib/udev/rules.d/50-udev-default.rules b/buildroot-external/rootfs-overlay/usr/lib/udev/rules.d/50-udev-default.rules
index e73ecb39..9e179a01 100644
--- a/buildroot-external/rootfs-overlay/usr/lib/udev/rules.d/50-udev-default.rules
+++ b/buildroot-external/rootfs-overlay/usr/lib/udev/rules.d/50-udev-default.rules
@@ -30,7 +30,7 @@ KERNEL=="tty[A-Z]*[0-9]|ttymxc[0-9]*|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0
SUBSYSTEM=="mem", KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640"
-SUBSYSTEM=="input", GROUP="input"
+SUBSYSTEM=="input", GROUP="input", MODE="0666"
SUBSYSTEM=="input", KERNEL=="js[0-9]*", MODE="0664"
SUBSYSTEM=="video4linux", GROUP="video"