From e3c9cfc3a2bf6d64c9fe6b3ad49c26dfbecb4c84 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus <915544+detiber@users.noreply.github.com> Date: Mon, 16 Dec 2024 05:34:48 -0500 Subject: [PATCH] retrofit unwrap PR from bluefin upstream (#4) * retrofit unwrap PR from bluefin upstream https://github.com/ublue-os/bluefin/pull/1954 * add tig * fix os-release for bluefin-dx build * update readme --- README.md | 4 ++-- variants/bluefin/Containerfile | 6 ++++-- .../bluefin/build_files/base/04-packages.sh | 11 ++++++----- .../bluefin/build_files/dx/03-packages-dx.sh | 11 ++++++----- .../{base => shared}/00-image-info.sh | 0 .../bluefin/build_files/shared/build-base.sh | 19 ++++++++++++++++++- .../bluefin/build_files/shared/build-dx.sh | 7 ++----- .../bluefin/build_files/shared/clean-stage.sh | 5 ++--- variants/bluefin/packages.json | 4 +++- 9 files changed, 43 insertions(+), 24 deletions(-) rename variants/bluefin/build_files/{base => shared}/00-image-info.sh (100%) diff --git a/README.md b/README.md index df40095..8a0e07c 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ [![Latest Images](https://github.com/detiber/beardy-os/actions/workflows/bluefin-latest.yml/badge.svg)](https://github.com/detiber/beardy-os/actions/workflows/bluefin-latest.yml) [![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/beardy-os)](https://artifacthub.io/packages/search?repo=beardy-os) -See the [BlueBuild docs](https://blue-build.org/how-to/setup/) for quick setup instructions for setting up your own repository based on this template. +## NOTE: -After setup, it is recommended you update this README to describe your custom image. +This repo is used for building os images layered upon various upstream bootc/ublue-os based images. Use at your own risk, and without any support. ## Installation diff --git a/variants/bluefin/Containerfile b/variants/bluefin/Containerfile index ada49d4..c941b68 100644 --- a/variants/bluefin/Containerfile +++ b/variants/bluefin/Containerfile @@ -16,7 +16,8 @@ ARG UBLUE_IMAGE_TAG="stable" ARG FEDORA_MAJOR_VERSION="41" # Build, cleanup, commit. -RUN --mount=type=cache,dst=/var/cache/rpm-ostree \ +RUN --mount=type=cache,dst=/var/cache/libdnf5 \ + --mount=type=cache,dst=/var/cache/rpm-ostree \ --mount=type=bind,from=ctx,source=/,target=/ctx \ /ctx/build_files/shared/build-base.sh @@ -31,6 +32,7 @@ ARG UBLUE_IMAGE_TAG="stable" ARG FEDORA_MAJOR_VERSION="41" # Build, Clean-up, Commit -RUN --mount=type=cache,dst=/var/cache/rpm-ostree \ +RUN --mount=type=cache,dst=/var/cache/libdnf5 \ + --mount=type=cache,dst=/var/cache/rpm-ostree \ --mount=type=bind,from=ctx,source=/,target=/ctx \ /ctx/build_files/shared/build-dx.sh diff --git a/variants/bluefin/build_files/base/04-packages.sh b/variants/bluefin/build_files/base/04-packages.sh index 6c453e3..045de99 100755 --- a/variants/bluefin/build_files/base/04-packages.sh +++ b/variants/bluefin/build_files/base/04-packages.sh @@ -26,14 +26,15 @@ fi # simple case to install where no packages need excluding if [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 && "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -eq 0 ]]; then - rpm-ostree install \ + dnf -y install \ ${INCLUDED_PACKAGES[@]} # install/excluded packages both at same time elif [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 && "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then - rpm-ostree override remove \ - ${INSTALLED_EXCLUDED_PACKAGES[@]} \ - $(printf -- "--install=%s " ${INCLUDED_PACKAGES[@]}) + dnf5 -y remove \ + ${INSTALLED_EXCLUDED_PACKAGES[@]} && \ + dnf5 -y install \ + ${INCLUDED_PACKAGES[@]} else echo "No packages to install." fi @@ -46,6 +47,6 @@ fi # remove any excluded packages which are still present on image if [[ "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then - rpm-ostree override remove \ + dnf5 -y remove \ ${INSTALLED_EXCLUDED_PACKAGES[@]} fi diff --git a/variants/bluefin/build_files/dx/03-packages-dx.sh b/variants/bluefin/build_files/dx/03-packages-dx.sh index 7850d48..da032a5 100755 --- a/variants/bluefin/build_files/dx/03-packages-dx.sh +++ b/variants/bluefin/build_files/dx/03-packages-dx.sh @@ -30,14 +30,15 @@ fi # simple case to install where no packages need excluding if [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 && "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -eq 0 ]]; then - rpm-ostree install \ + dnf -y install \ ${INCLUDED_PACKAGES[@]} # install/excluded packages both at same time elif [[ "${#INCLUDED_PACKAGES[@]}" -gt 0 && "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then - rpm-ostree override remove \ - ${INSTALLED_EXCLUDED_PACKAGES[@]} \ - $(printf -- "--install=%s " ${INCLUDED_PACKAGES[@]}) + dnf5 -y remove \ + ${INSTALLED_EXCLUDED_PACKAGES[@]} && \ + dnf5 -y install \ + ${INCLUDED_PACKAGES[@]} else echo "No packages to install." fi @@ -50,6 +51,6 @@ fi # remove any excluded packages which are still present on image if [[ "${#INSTALLED_EXCLUDED_PACKAGES[@]}" -gt 0 ]]; then - rpm-ostree override remove \ + dnf5 -y remove \ ${INSTALLED_EXCLUDED_PACKAGES[@]} fi diff --git a/variants/bluefin/build_files/base/00-image-info.sh b/variants/bluefin/build_files/shared/00-image-info.sh similarity index 100% rename from variants/bluefin/build_files/base/00-image-info.sh rename to variants/bluefin/build_files/shared/00-image-info.sh diff --git a/variants/bluefin/build_files/shared/build-base.sh b/variants/bluefin/build_files/shared/build-base.sh index 1a17fd0..d65e9ed 100755 --- a/variants/bluefin/build_files/shared/build-base.sh +++ b/variants/bluefin/build_files/shared/build-base.sh @@ -2,6 +2,23 @@ set -eoux pipefail +# there is no 'rpm-ostree cliwrap uninstall-from-root', but this is close enough. See: +# https://github.com/coreos/rpm-ostree/blob/6d2548ddb2bfa8f4e9bafe5c6e717cf9531d8001/rust/src/cliwrap.rs#L25-L32 +if [ -d /usr/libexec/rpm-ostree/wrapped ]; then + # binaries which could be created if they did not exist thus may not be in wrapped dir + rm -f \ + /usr/bin/yum \ + /usr/bin/dnf \ + /usr/bin/kernel-install + # binaries which were wrapped + mv -f /usr/libexec/rpm-ostree/wrapped/* /usr/bin + rm -fr /usr/libexec/rpm-ostree +fi + +if [ ${FEDORA_MAJOR_VERSION} -lt 41 ]; then + rpm-ostree install --idempotent dnf5 dnf5-plugins +fi + # Make Alternatives Directory mkdir -p /var/lib/alternatives @@ -13,7 +30,7 @@ rsync -rvK /ctx/system_files/shared/ / rsync -rvK /ctx/system_files/"${BASE_IMAGE_NAME}"/ / # Generate image-info.json -/ctx/build_files/base/00-image-info.sh +/ctx/build_files/shared/00-image-info.sh # # Build Fix - Fix known skew offenders # /ctx/build_files/base/01-build-fix.sh diff --git a/variants/bluefin/build_files/shared/build-dx.sh b/variants/bluefin/build_files/shared/build-dx.sh index 7eda0a4..49c21b9 100755 --- a/variants/bluefin/build_files/shared/build-dx.sh +++ b/variants/bluefin/build_files/shared/build-dx.sh @@ -12,8 +12,8 @@ rsync -rvK /ctx/system_files/dx/ / # Apply IP Forwarding before installing Docker to prevent messing with LXC networking sysctl -p -# Generate image-info.json (Not Needed?) -# /ctx/build_files/shared/image-info.sh +# Generate image-info.json +/ctx/build_files/shared/00-image-info.sh # # COPR Repos # /ctx/build_files/dx/01-install-copr-repos-dx.sh @@ -27,9 +27,6 @@ sysctl -p # # Fetch Install # /ctx/build_files/dx/04-override-install-dx.sh -# Branding Changes -sed -i '/^PRETTY_NAME/s/Bluefin/Bluefin-dx/' /usr/lib/os-release - # # Systemd and Disable Repos # /ctx/build_files/dx/09-cleanup-dx.sh diff --git a/variants/bluefin/build_files/shared/clean-stage.sh b/variants/bluefin/build_files/shared/clean-stage.sh index 064dd0b..336472c 100755 --- a/variants/bluefin/build_files/shared/clean-stage.sh +++ b/variants/bluefin/build_files/shared/clean-stage.sh @@ -1,8 +1,7 @@ #!/usr/bin/bash set -eoux pipefail -shopt -s extglob rm -rf /tmp/* || true -rm -rf /var/!(cache) -rm -rf /var/cache/!(rpm-ostree) +find /var/* -maxdepth 0 -type d \! -name cache -exec rm -fr {} \; +find /var/cache/* -maxdepth 0 -type d \! -name libdnf5 \! -name rpm-ostree -exec rm -fr {} \; diff --git a/variants/bluefin/packages.json b/variants/bluefin/packages.json index b3a5841..0e7e0d7 100644 --- a/variants/bluefin/packages.json +++ b/variants/bluefin/packages.json @@ -1,7 +1,9 @@ { "all": { "include": { - "all": [], + "all": [ + "tig" + ], "silverblue": [], "dx": [] },