From 7b036d3d1024da1ab29df1f4c1feea12a7a9d326 Mon Sep 17 00:00:00 2001 From: ER Date: Sat, 26 Aug 2023 15:52:28 +0300 Subject: [PATCH] feat: ublue-os/bling module this makes all bling components optional, while making more of them accessible --- Containerfile | 15 ++++--------- config/README.md | 2 +- config/recipe.yml | 22 ++++++++++++++----- modules/bling/README.md | 19 ++++++++++++++++ modules/bling/bling.sh | 17 ++++++++++++++ modules/bling/installers/dconf-update-service | 6 +++++ modules/bling/installers/devpod.sh | 6 +++++ modules/bling/installers/fonts.sh | 6 +++++ modules/bling/installers/justfiles.sh | 6 +++++ modules/bling/installers/nix-installer.sh | 6 +++++ .../bling/installers/ublue-os-wallpapers.sh | 6 +++++ modules/bling/installers/ublue-update.sh | 6 +++++ 12 files changed, 100 insertions(+), 17 deletions(-) create mode 100644 modules/bling/README.md create mode 100644 modules/bling/bling.sh create mode 100644 modules/bling/installers/dconf-update-service create mode 100644 modules/bling/installers/devpod.sh create mode 100644 modules/bling/installers/fonts.sh create mode 100644 modules/bling/installers/justfiles.sh create mode 100644 modules/bling/installers/nix-installer.sh create mode 100644 modules/bling/installers/ublue-os-wallpapers.sh create mode 100644 modules/bling/installers/ublue-update.sh diff --git a/Containerfile b/Containerfile index 935be850bd..a622d04079 100644 --- a/Containerfile +++ b/Containerfile @@ -34,13 +34,10 @@ COPY cosign.pub /usr/share/ublue-os/cosign.pub COPY config /usr/share/ublue-os/startingpoint -# Copy the bling from ublue-os/bling into the image: -# * wallpapers -# * justfiles -# * nix installer -COPY --from=ghcr.io/ublue-os/bling:latest /rpms/ublue-os-wallpapers-0.1-1.fc38.noarch.rpm /tmp/ublue-os-wallpapers-0.1-1.fc38.noarch.rpm -COPY --from=ghcr.io/ublue-os/bling:latest /files/usr/share/ublue-os/just /usr/share/ublue-os/just -COPY --from=ghcr.io/ublue-os/bling:latest /files/usr/bin/ublue-nix* /usr/bin +# Copy the bling from ublue-os/bling into tmp, to be installed later by the bling module +# Feel free to remove these lines if you want to speed up image builds and don't want any bling +COPY --from=ghcr.io/ublue-os/bling:latest /rpms /tmp/bling/rpms +COPY --from=ghcr.io/ublue-os/bling:latest /files /tmp/bling/files # "yq" used in build.sh and the "setup-flatpaks" just-action to read recipe.yml. # Copied from the official container image since it's not available as an RPM. @@ -55,7 +52,3 @@ COPY modules /tmp/modules/ # Run the build script, then clean up temp files and finalize container build. RUN chmod +x /tmp/build.sh && /tmp/build.sh && \ rm -rf /tmp/* /var/* && ostree container commit - -# Storage -# TODO turn this bling installation stuff into a module -# rpm-ostree install /tmp/ublue-os-wallpapers-0.1-1.fc38.noarch.rpm \ No newline at end of file diff --git a/config/README.md b/config/README.md index 7725c48fd0..42dd6fd6ba 100644 --- a/config/README.md +++ b/config/README.md @@ -18,7 +18,7 @@ At the top of the recipe, there are four mandatory configuration options. The core of startingpoint's configuration is built around the idea of modules. Modules are scripts in the [`../modules`](../modules/) directory that you list out under `modules:` in the recipe. They are executed in order, and can run arbitrary shell commands and write any files. -This repository comes with three modules out of the box, [`rpm-ostree`](../modules/rpm-ostree) for pseudo-declarative package management, [`yafti`](../modules/yafti) for installing [yafti](https://github.com/ublue-os/yafti) and easing basic configuration, and [`script`](../modules/script) for running small custom scripts at the build stage, like pulling in configuration or setting up `rpm-ostree` support for proper signing (see [`signing.sh`](./scripts/signing.sh)). +This repository comes with three modules out of the box, [`rpm-ostree`](../modules/rpm-ostree) for pseudo-declarative package management, [`yafti`](../modules/yafti) for installing [yafti](https://github.com/ublue-os/yafti) and easing basic configuration, [`bling`](../modules/bling) for pulling extra components from [`ublue-os/bling`](https://github.com/ublue-os/bling), and [`script`](../modules/script) for running small custom scripts at the build stage, like pulling in configuration or setting up `rpm-ostree` support for proper signing (see [`signing.sh`](./scripts/signing.sh)). For more in-depth documentation on each module, check out the README.md files in each module folder. diff --git a/config/recipe.yml b/config/recipe.yml index d6f76cd5c6..24f60e18d0 100644 --- a/config/recipe.yml +++ b/config/recipe.yml @@ -20,12 +20,24 @@ modules: - firefox - firefox-langpacks - - type: script - scripts: - # this sets up the proper policy & signing files for signed images to work - - signing.sh + - type: bling # configure what to pull in from ublue-os/bling + install: + - fonts # selection of common good free fonts + - justfiles # add "!include /usr/share/ublue-os/just/bling.just" + # in your custom.just (added by default) or local justfile + - nix-installer # these are the silverblue nix installer scripts from dnkmmr69420 + - ublue-os-wallpapers + # - ublue-update # https://github.com/ublue-os/ublue-update + # - dconf-update-service # a service unit that updates the dconf db on boot + # - devpod # https://devpod.sh/ as an rpm + - type: yafti # if included, https://github.com/ublue-os/yafti will be installed and set up custom-flatpaks: # this section is optional - Celluloid: io.github.celluloid_player.Celluloid - - Krita: org.kde.krita \ No newline at end of file + - Krita: org.kde.krita + + - type: script + scripts: + # this sets up the proper policy & signing files for signed images to work + - signing.sh \ No newline at end of file diff --git a/modules/bling/README.md b/modules/bling/README.md new file mode 100644 index 0000000000..e342c4a5d0 --- /dev/null +++ b/modules/bling/README.md @@ -0,0 +1,19 @@ +# [`bling`](https://github.com/ublue-os/bling) module for startingpoint + +The `bling` module allows you to easily declare which general parts of `ublue-os/bling` to pull in to your custom image. It requires the `rpms` and `files` directories from the `bling` container to already exist inside `/tmp/bling/` (pulled inside the Containerfile by default). + +The blingbling to pull in is declared under `install:`, and the code for installing them is all in simple named scripts under the `installers/` directory. The basic code for the `bling` module is very similar to the code of the `script` module. + +Example configuration: +```yml +type: bling # configure what to pull in from ublue-os/bling +install: + - fonts # selection of common good free fonts + - justfiles # add "!include /usr/share/ublue-os/just/bling.just" + # in your custom.just (added by default) or local justfile + - nix-installer # these are the silverblue nix installer scripts from dnkmmr69420 + - ublue-os-wallpapers + # - ublue-update # https://github.com/ublue-os/ublue-update + # - dconf-update-service # a service unit that updates the dconf db on boot + # - devpod # https://devpod.sh/ as an rpm +``` \ No newline at end of file diff --git a/modules/bling/bling.sh b/modules/bling/bling.sh new file mode 100644 index 0000000000..be6fd17248 --- /dev/null +++ b/modules/bling/bling.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# Tell build process to exit if there are any errors. +set -oue pipefail + +get_yaml_array INSTALL '.install[]' "$1" + +export BLING_DIRECTORY="/tmp/bling" + +cd "/tmp/modules/bling/installers" + +find "$PWD" -type f -exec chmod +x {} \; + +for ITEM in "${INSTALL[@]}"; do + echo "Pulling from bling: $ITEM" + eval "$PWD/$ITEM.sh" +done \ No newline at end of file diff --git a/modules/bling/installers/dconf-update-service b/modules/bling/installers/dconf-update-service new file mode 100644 index 0000000000..25aa0c78f4 --- /dev/null +++ b/modules/bling/installers/dconf-update-service @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Tell build process to exit if there are any errors. +set -oue pipefail + +cp -r "$BLING_DIRECTORY/files/usr/etc/systemd/system/dconf-update.service" "/usr/etc/systemd/system/dconf-update.service" \ No newline at end of file diff --git a/modules/bling/installers/devpod.sh b/modules/bling/installers/devpod.sh new file mode 100644 index 0000000000..9bb86993ed --- /dev/null +++ b/modules/bling/installers/devpod.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Tell build process to exit if there are any errors. +set -oue pipefail + +rpm-ostree install "$BLING_DIRECTORY"/rpms/devpod*.rpm \ No newline at end of file diff --git a/modules/bling/installers/fonts.sh b/modules/bling/installers/fonts.sh new file mode 100644 index 0000000000..0e8015f4a8 --- /dev/null +++ b/modules/bling/installers/fonts.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Tell build process to exit if there are any errors. +set -oue pipefail + +cp -r "$BLING_DIRECTORY/files/usr/share/fonts" "/usr/share/fonts" \ No newline at end of file diff --git a/modules/bling/installers/justfiles.sh b/modules/bling/installers/justfiles.sh new file mode 100644 index 0000000000..34e9814b63 --- /dev/null +++ b/modules/bling/installers/justfiles.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Tell build process to exit if there are any errors. +set -oue pipefail + +cp -r "$BLING_DIRECTORY/files/usr/share/ublue-os/just" "/usr/share/ublue-os/just" \ No newline at end of file diff --git a/modules/bling/installers/nix-installer.sh b/modules/bling/installers/nix-installer.sh new file mode 100644 index 0000000000..88c6e86b39 --- /dev/null +++ b/modules/bling/installers/nix-installer.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Tell build process to exit if there are any errors. +set -oue pipefail + +cp -r "$BLING_DIRECTORY/files/usr/bin/ublue-nix-install" "/usr/bin/ublue-nix-uninstall" \ No newline at end of file diff --git a/modules/bling/installers/ublue-os-wallpapers.sh b/modules/bling/installers/ublue-os-wallpapers.sh new file mode 100644 index 0000000000..6598bb7d54 --- /dev/null +++ b/modules/bling/installers/ublue-os-wallpapers.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Tell build process to exit if there are any errors. +set -oue pipefail + +rpm-ostree install "$BLING_DIRECTORY"/rpms/ublue-os-wallpapers*.rpm \ No newline at end of file diff --git a/modules/bling/installers/ublue-update.sh b/modules/bling/installers/ublue-update.sh new file mode 100644 index 0000000000..c8b71263f9 --- /dev/null +++ b/modules/bling/installers/ublue-update.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Tell build process to exit if there are any errors. +set -oue pipefail + +rpm-ostree install "$BLING_DIRECTORY"/rpms/ublue-update*.rpm \ No newline at end of file