From e43faa65d6a0ac3fdc820aae0849a019dbc599a4 Mon Sep 17 00:00:00 2001
From: j1nx
Date: Tue, 12 Dec 2023 14:03:35 +0000
Subject: [PATCH] [ALL] First step in splitting containers pre-installed system
---
buildroot-external/configs/rpi4_64_defconfig | 2 +-
.../package/ovos-containers/Config.in | 38 +++++++++++++++++--
.../ovos-containers/ovos-containers.mk | 23 ++++++++++-
.../ovos-containers}/ovos_gui.container | 0
.../ovos_gui_websocket.container | 0
5 files changed, 57 insertions(+), 6 deletions(-)
rename buildroot-external/{board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd => package/ovos-containers}/ovos_gui.container (100%)
rename buildroot-external/{board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd => package/ovos-containers}/ovos_gui_websocket.container (100%)
diff --git a/buildroot-external/configs/rpi4_64_defconfig b/buildroot-external/configs/rpi4_64_defconfig
index 229036a8..f2efc822 100644
--- a/buildroot-external/configs/rpi4_64_defconfig
+++ b/buildroot-external/configs/rpi4_64_defconfig
@@ -306,7 +306,7 @@ BR2_PACKAGE_HOSTNAME_SERVICE=y
BR2_PACKAGE_NCPAMIXER=y
BR2_PACKAGE_OVOS_CONTAINERS=y
BR2_PACKAGE_OVOS_CONTAINERS_ARCH="arm64"
-BR2_PACKAGE_OVOS_CONTAINERS_IMAGES="ovos-messagebus"
+BR2_PACKAGE_OVOS_CONTAINERS_GUI=y
BR2_PACKAGE_OVOS_SPLASH=y
BR2_PACKAGE_RESPEAKER=y
BR2_PACKAGE_RPI_EEPROM=y
diff --git a/buildroot-external/package/ovos-containers/Config.in b/buildroot-external/package/ovos-containers/Config.in
index dd214ee2..e834cdec 100644
--- a/buildroot-external/package/ovos-containers/Config.in
+++ b/buildroot-external/package/ovos-containers/Config.in
@@ -13,9 +13,41 @@ config BR2_PACKAGE_OVOS_CONTAINERS_ARCH
help
Architecture for which we should be pull.
-config BR2_PACKAGE_OVOS_CONTAINERS_IMAGES
- string "Images"
+choice
+ prompt "Containers to pre-install"
+ default BR2_PACKAGE_OVOS_CONTAINERS_HEADLESS
+
+config BR2_PACKAGE_OVOS_CONTAINERS_HEADLESS
+ bool "Headless"
help
- Space separated list of images to pull.
+ This install all minimal required containers
+ to run the OVOS framework headless.
+
+ Install: - ovos -messagebus
+ - ovos-phal
+ - ovos-phal-admin
+ - ovos-listener-dinkum
+ - ovos-audio
+ - ovos-core
+ - ovos-cli
+
+config BR2_PACKAGE_OVOS_CONTAINERS_GUI
+ bool "Graphical User Interface"
+ help
+ This install all required containers
+ to run the OVOS framework with the QT5
+ Graphical User Interface enabled.
+
+ Install: - ovos -messagebus
+ - ovos-phal
+ - ovos-phal-admin
+ - ovos-listener-dinkum
+ - ovos-audio
+ - ovos-core
+ - ovos-cli
+ - ovos-gui-websocket
+ - ovos-gui-shell
+
+endchoice
endif
diff --git a/buildroot-external/package/ovos-containers/ovos-containers.mk b/buildroot-external/package/ovos-containers/ovos-containers.mk
index dc9a23d4..fa2d239b 100644
--- a/buildroot-external/package/ovos-containers/ovos-containers.mk
+++ b/buildroot-external/package/ovos-containers/ovos-containers.mk
@@ -10,8 +10,20 @@ OVOS_CONTAINERS_LICENSE_FILES = $(BR2_EXTERNAL_OPENVOICEOS_PATH)/../LICENSE
OVOS_CONTAINERS_SITE = $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/ovos-containers
OVOS_CONTAINERS_SITE_METHOD = local
-#OVOS_CONTAINERS_IMAGES = $(call qstrip, $(BR2_PACKAGE_OVOS_CONTAINERS))
-OVOS_CONTAINERS_IMAGES = ovos-messagebus ovos-phal ovos-phal-admin ovos-listener-dinkum ovos-audio ovos-core ovos-cli ovos-gui-websocket ovos-gui-shell
+OVOS_CONTAINERS_IMAGES = ovos-messagebus \
+ ovos-phal \
+ ovos-phal-admin \
+ ovos-listener-dinkum \
+ ovos-audio \
+ ovos-core \
+ ovos-cli
+
+ifeq ($(BR2_PACKAGE_OVOS_CONTAINERS_GUI),y)
+OVOS_CONTAINERS_IMAGES += ovos-gui-websocket \
+ ovos-gui-shell
+
+OVOS_CONTAINERS_INSTALL_GUI = YES
+endif
define OVOS_CONTAINERS_BUILD_CMDS
$(Q)mkdir -p $(@D)/images
@@ -31,4 +43,11 @@ define OVOS_CONTAINERS_INSTALL_IMAGES_CMDS
rm -rf $(TARGET_DIR)/home/ovos/.local/share/containers/storage/libpod
endef
+define OVOS_CONTAINERS_INSTALL_GUI
+ $(INSTALL) -D -m 644 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/ovos-containers/ovos_gui_websocket.container \
+ $(TARGET_DIR)/home/ovos/.config/containers/systemd/ovos_gui_websocket.container
+ $(INSTALL) -D -m 644 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/ovos-containers/ovos_gui.container \
+ $(TARGET_DIR)/home/ovos/.config/containers/systemd/ovos_gui.container
+endef
+
$(eval $(generic-package))
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui.container b/buildroot-external/package/ovos-containers/ovos_gui.container
similarity index 100%
rename from buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui.container
rename to buildroot-external/package/ovos-containers/ovos_gui.container
diff --git a/buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui_websocket.container b/buildroot-external/package/ovos-containers/ovos_gui_websocket.container
similarity index 100%
rename from buildroot-external/board/ovos/raspberrypi/rootfs-overlay/home/ovos/.config/containers/systemd/ovos_gui_websocket.container
rename to buildroot-external/package/ovos-containers/ovos_gui_websocket.container