From c7d187d224f524541f868ef25ef953c6bbb332fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Wed, 10 Jun 2026 19:31:31 +0000 Subject: [PATCH] install tools --- cookbooks/base/Makefile | 5 ++++- .../install-tools.d/fastfetch.sh} | 0 .../examples/{fastfetch.env => install-tools.env} | 0 cookbooks/base/config/install-tools.sh | 15 +++++++++++++++ cookbooks/base/hooks.mk | 5 +++++ cookbooks/base/install-fastfetch.service | 15 --------------- cookbooks/base/install-tools.service | 14 ++++++++++++++ .../base/profile.d/{ => examples}/fastfetch.sh | 0 8 files changed, 38 insertions(+), 16 deletions(-) rename cookbooks/base/config/{install-fastfetch.sh => examples/install-tools.d/fastfetch.sh} (100%) rename cookbooks/base/config/examples/{fastfetch.env => install-tools.env} (100%) create mode 100755 cookbooks/base/config/install-tools.sh create mode 100644 cookbooks/base/hooks.mk delete mode 100644 cookbooks/base/install-fastfetch.service create mode 100644 cookbooks/base/install-tools.service rename cookbooks/base/profile.d/{ => examples}/fastfetch.sh (100%) diff --git a/cookbooks/base/Makefile b/cookbooks/base/Makefile index 56af166..4e10fa1 100644 --- a/cookbooks/base/Makefile +++ b/cookbooks/base/Makefile @@ -1,11 +1,14 @@ SYSTEMD_MAIN_UNIT_NAMES := var-lib-virtiofs-data.mount SYSTEMD_MAIN_UNIT_NAMES += rpm-ostree-install-qemu-guest-agent.service -SYSTEMD_MAIN_UNIT_NAMES += install-fastfetch.service +SYSTEMD_MAIN_UNIT_NAMES += install-tools.service # Include common Makefile include ../../scripts/common.mk +$(TARGET_CHROOT)/etc/quadlets/base/install-tools.d: + install -d -m 0755 -o root -g root -D $@ + pre-requisites:: @set -Eeuo pipefail; \ for tool in rpm-ostree; do \ diff --git a/cookbooks/base/config/install-fastfetch.sh b/cookbooks/base/config/examples/install-tools.d/fastfetch.sh similarity index 100% rename from cookbooks/base/config/install-fastfetch.sh rename to cookbooks/base/config/examples/install-tools.d/fastfetch.sh diff --git a/cookbooks/base/config/examples/fastfetch.env b/cookbooks/base/config/examples/install-tools.env similarity index 100% rename from cookbooks/base/config/examples/fastfetch.env rename to cookbooks/base/config/examples/install-tools.env diff --git a/cookbooks/base/config/install-tools.sh b/cookbooks/base/config/install-tools.sh new file mode 100755 index 0000000..3b22f2d --- /dev/null +++ b/cookbooks/base/config/install-tools.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -Eeuo pipefail + +ret=0 +for tool in /etc/quadlets/base/install-tools.d/*.sh; do + tool_name="$(basename "$tool" .sh)" + echo "Installing $tool_name..." + if ! "$tool"; then + echo "Failed to install $tool_name!" >&2 + ret=1 + fi +done + +exit $ret diff --git a/cookbooks/base/hooks.mk b/cookbooks/base/hooks.mk new file mode 100644 index 0000000..8eec4ec --- /dev/null +++ b/cookbooks/base/hooks.mk @@ -0,0 +1,5 @@ +# Tools installation scripts +TARGET_INSTALL_TOOLS_FILES = $(patsubst other/base/install-tools.d/%, $(TARGET_CHROOT)/etc/quadlets/base/install-tools.d/%, $(wildcard other/base/install-tools.d/*)) +TARGET_EXAMPLE_FILES += $(TARGET_INSTALL_TOOLS_FILES) +$(TARGET_CHROOT)/etc/quadlets/base/install-tools.d/%.sh: other/base/install-tools.d/%.sh + install -m 0755 -o root -g root $< $@ diff --git a/cookbooks/base/install-fastfetch.service b/cookbooks/base/install-fastfetch.service deleted file mode 100644 index 8e467d6..0000000 --- a/cookbooks/base/install-fastfetch.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Install fastfetch -Wants=network-online.target -After=network-online.target -ConditionPathExists=!/usr/local/bin/fastfetch -ConditionPathExists=/etc/quadlets/base/fastfetch.env - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/etc/quadlets/base/install-fastfetch.sh -EnvironmentFile=/etc/quadlets/base/fastfetch.env - -[Install] -WantedBy=multi-user.target diff --git a/cookbooks/base/install-tools.service b/cookbooks/base/install-tools.service new file mode 100644 index 0000000..d40777d --- /dev/null +++ b/cookbooks/base/install-tools.service @@ -0,0 +1,14 @@ +[Unit] +Description=Install tools +Wants=network-online.target +After=network-online.target +ConditionPathExists=/etc/quadlets/base/install-tools.env + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/etc/quadlets/base/install-tools.sh +EnvironmentFile=/etc/quadlets/base/install-tools.env + +[Install] +WantedBy=multi-user.target diff --git a/cookbooks/base/profile.d/fastfetch.sh b/cookbooks/base/profile.d/examples/fastfetch.sh similarity index 100% rename from cookbooks/base/profile.d/fastfetch.sh rename to cookbooks/base/profile.d/examples/fastfetch.sh