Skip to content

Commit

Permalink
retrofit unwrap PR from bluefin upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
detiber committed Dec 16, 2024
1 parent 080a583 commit 3620da9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 15 deletions.
6 changes: 4 additions & 2 deletions variants/bluefin/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
11 changes: 6 additions & 5 deletions variants/bluefin/build_files/base/04-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
11 changes: 6 additions & 5 deletions variants/bluefin/build_files/dx/03-packages-dx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
17 changes: 17 additions & 0 deletions variants/bluefin/build_files/shared/build-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions variants/bluefin/build_files/shared/clean-stage.sh
Original file line number Diff line number Diff line change
@@ -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 {} \;

0 comments on commit 3620da9

Please sign in to comment.