Skip to content

Commit ca4766a

Browse files
committed
chore: move to container based titanoboa
1 parent a33fcb7 commit ca4766a

6 files changed

Lines changed: 176 additions & 27 deletions

File tree

.github/workflows/reusable-build-iso-anaconda.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,31 @@ jobs:
8181
id: flatpak_list
8282
run: |
8383
set -eoux pipefail
84-
FILE_LIST="$(mktemp)"
85-
cat common/system_files/shared/usr/share/ublue-os/homebrew/system-flatpaks.Brewfile | grep -v '#' | grep -F -e "flatpak" | sed 's/flatpak //' | tr -d '"' | tee "${FILE_LIST}"
86-
echo "file_list_path=${FILE_LIST}" | tee "${GITHUB_OUTPUT}"
84+
mkdir -p iso_files
85+
cat common/system_files/shared/usr/share/ublue-os/homebrew/system-flatpaks.Brewfile | grep -v '#' | grep -F -e "flatpak" | sed 's/flatpak //' | tr -d '"' | tee iso_files/flatpaks.list
86+
87+
- name: Pull base image
88+
run: |
89+
sudo podman pull "${{ steps.image_ref.outputs.image_ref }}:${{ matrix.image_version }}"
90+
91+
- name: Build Live Container Image
92+
id: build-container
93+
run: |
94+
IMAGE_NAME="aurora-live-${{ matrix.flavor }}:${{ matrix.image_version }}"
95+
sudo podman build \
96+
--cap-add sys_admin \
97+
--security-opt label=disable \
98+
--build-arg BASE_IMAGE=${{ steps.image_ref.outputs.image_ref }}:${{ matrix.image_version }} \
99+
--tag "${IMAGE_NAME}" \
100+
-f Containerfile \
101+
.
102+
echo "image_name=${IMAGE_NAME}" >> "${GITHUB_OUTPUT}"
87103
88104
- name: Build ISO
89105
id: build
90-
uses: ublue-os/titanoboa@840217d97bd0bc9a52466508c54d8dda5c5ba2fd
106+
uses: ublue-os/titanoboa@5c457c3d0518bd17e754be0fd98a60d29d26abb4
91107
with:
92-
image-ref: ${{ steps.image_ref.outputs.image_ref }}:${{ matrix.image_version }}
93-
flatpaks-list: ${{ steps.flatpak_list.outputs.file_list_path }}
94-
hook-post-rootfs: ${{ github.workspace }}/${{ inputs.hook_script }}
95-
kargs: ${{ steps.image_ref.outputs.kargs }}
108+
image-ref: ${{ steps.build-container.outputs.image_name }}
96109

97110
- name: Rename ISO
98111
id: rename

Containerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# run with --cap-add sys_admin --security-opt label=disable --squash
2+
ARG BASE_IMAGE
3+
FROM ${BASE_IMAGE}
4+
ENV BASE_IMAGE=${BASE_IMAGE}
5+
6+
COPY iso_files/ /src/iso_files/
7+
RUN --mount=type=cache,target=/var/tmp/libdnf5,id=libdnf5 \
8+
bash /src/iso_files/build.sh

Justfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ clean:
5151
rm -rf output/
5252
rm -rf common/
5353
rm -f *.iso*
54-
rm -f flatpaks.list
54+
rm -f iso_files/flatpaks.list
5555

5656
# Check if valid combo
5757
[group('Utility')]
@@ -121,7 +121,7 @@ generate-flatpak-list:
121121
grep -F -e "flatpak" | \
122122
sed 's/flatpak //' | \
123123
tr -d '"' | \
124-
tee flatpaks.list
124+
tee iso_files/flatpaks.list
125125

126126
# Verify Container with Cosign
127127
[group('Utility')]
@@ -161,5 +161,6 @@ verify-container container="" registry="ghcr.io/ublue-os" key="":
161161
test-iso-config:
162162
#!/usr/bin/bash
163163
set -eoux pipefail
164-
bash -n iso_files/configure_iso_anaconda-webui.sh
164+
bash -n iso_files/configure_iso_anaconda.sh
165+
bash -n iso_files/build.sh
165166
echo "ISO configuration script syntax is valid"

iso_files/build.sh

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#!/usr/bin/bash
2+
3+
set -exo pipefail
4+
5+
{ export PS4='+( ${BASH_SOURCE}:${LINENO} ): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'; } 2>/dev/null
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
9+
# Create the directory that /root is symlinked to
10+
mkdir -p "$(realpath /root)"
11+
12+
# bwrap tries to write /proc/sys/user/max_user_namespaces which is mounted as ro
13+
# so we need to remount it as rw
14+
mount -o remount,rw /proc/sys
15+
16+
# Install flatpaks if list exists
17+
if [[ -f "$SCRIPT_DIR/flatpaks.list" ]]; then
18+
echo "Installing flatpaks..."
19+
curl --retry 3 -Lo /etc/flatpak/remotes.d/flathub.flatpakrepo https://dl.flathub.org/repo/flathub.flatpakrepo
20+
xargs -r flatpak install -y --noninteractive < "$SCRIPT_DIR/flatpaks.list" || true
21+
fi
22+
23+
# Configure podman temporarily to write to /usr/lib/containers/storage
24+
# This avoids storing the huge base image in /var/lib/containers/storage
25+
# (which is empty/tmpfs in the booted live environment and would exhaust RAM)
26+
mkdir -p /etc/containers
27+
cat >/etc/containers/storage.conf <<'EOF'
28+
[storage]
29+
driver = "overlay"
30+
runroot = "/run/containers/storage"
31+
graphroot = "/usr/lib/containers/storage"
32+
EOF
33+
34+
# Pull the container image to be installed
35+
if [[ -n "${BASE_IMAGE:-}" ]]; then
36+
podman pull "${BASE_IMAGE}"
37+
else
38+
# Fallback to reading image-info.json if BASE_IMAGE not set
39+
IMAGE_INFO="$(cat /usr/share/ublue-os/image-info.json)"
40+
IMAGE_TAG="$(jq -c -r '."image-tag"' <<<"$IMAGE_INFO")"
41+
IMAGE_REF="$(jq -c -r '."image-ref"' <<<"$IMAGE_INFO")"
42+
IMAGE_REF="${IMAGE_REF##*://}"
43+
podman pull "${IMAGE_REF}:${IMAGE_TAG}"
44+
fi
45+
46+
# Clean up the temporary storage configuration so that runtime podman uses the default
47+
rm -f /etc/containers/storage.conf
48+
49+
# Install required packages
50+
dnf install -y \
51+
dracut-live \
52+
livesys-scripts \
53+
git \
54+
jq \
55+
rsync \
56+
desktop-file-utils \
57+
anaconda-live \
58+
anaconda-webui \
59+
libblockdev-btrfs \
60+
libblockdev-lvm \
61+
libblockdev-dm
62+
63+
kernel=$(find /usr/lib/modules -maxdepth 1 -type d -printf '%P\n' | grep . | head -1)
64+
DRACUT_NO_XATTR=1 dracut -v --force --zstd --reproducible --no-hostonly \
65+
--add "dmsquash-live dmsquash-live-autooverlay" \
66+
"/usr/lib/modules/${kernel}/initramfs.img" "${kernel}"
67+
68+
# Configure livesys-scripts
69+
sed -i "s/^livesys_session=.*/livesys_session=kde/" /etc/sysconfig/livesys
70+
systemctl enable livesys.service livesys-late.service
71+
72+
# Run the configure/postrootfs hook
73+
# We pass BASE_IMAGE so it can be used inside the script
74+
export BASE_IMAGE="${BASE_IMAGE:-}"
75+
bash "$SCRIPT_DIR/configure_iso_anaconda.sh"
76+
77+
# image-builder needs gcdx64.efi / grub modules
78+
_arch=$(uname -m)
79+
if [[ $_arch == "x86_64" ]]; then
80+
dnf install -y grub2-efi-x64-cdboot
81+
elif [[ $_arch == "aarch64" ]]; then
82+
dnf install -y grub2-efi-aa64-modules
83+
fi
84+
85+
# image-builder expects the EFI directory to be in /boot/efi
86+
mkdir -p /boot/efi
87+
cp -av /usr/lib/efi/*/*/EFI /boot/efi/
88+
89+
# Remove fallback efi
90+
_arch=$(uname -m)
91+
if [[ $_arch == "x86_64" ]]; then
92+
cp -v /boot/efi/EFI/fedora/grubx64.efi /boot/efi/EFI/BOOT/fbx64.efi
93+
elif [[ $_arch == "aarch64" ]]; then
94+
cp -v /boot/efi/EFI/fedora/grubaa64.efi /boot/efi/EFI/BOOT/fbaa64.efi
95+
fi
96+
97+
# Set the timezone to UTC
98+
rm -f /etc/localtime
99+
systemd-firstboot --timezone UTC
100+
101+
# Mount a larger tmpfs to /var/tmp at boot time to avoid disk space issues
102+
mkdir -p /var/tmp
103+
cat >/etc/systemd/system/var-tmp.mount <<'EOF'
104+
[Unit]
105+
Description=Larger tmpfs for /var/tmp on live system
106+
107+
[Mount]
108+
What=tmpfs
109+
Where=/var/tmp
110+
Type=tmpfs
111+
Options=size=50%,nr_inodes=1m,x-systemd.graceful-option=usrquota
112+
113+
[Install]
114+
WantedBy=local-fs.target
115+
EOF
116+
systemctl enable var-tmp.mount
117+
118+
# Copy in the iso config for image-builder
119+
mkdir -p /usr/lib/bootc-image-builder
120+
cp "$SCRIPT_DIR/iso.yaml" /usr/lib/bootc-image-builder/iso.yaml
121+
122+
# Clean up dnf cache to save space
123+
dnf clean all

iso_files/configure_iso_anaconda.sh

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22

33
set -eoux pipefail
44

5-
IMAGE_INFO="$(cat /usr/share/ublue-os/image-info.json)"
6-
IMAGE_TAG="$(jq -c -r '."image-tag"' <<<"$IMAGE_INFO")"
7-
IMAGE_REF="$(jq -c -r '."image-ref"' <<<"$IMAGE_INFO")"
8-
IMAGE_REF="${IMAGE_REF##*://}"
5+
if [[ -n "${BASE_IMAGE:-}" ]]; then
6+
IMAGE_REF="${BASE_IMAGE%%:*}"
7+
IMAGE_TAG="${BASE_IMAGE##*:}"
8+
else
9+
IMAGE_INFO="$(cat /usr/share/ublue-os/image-info.json)"
10+
IMAGE_TAG="$(jq -c -r '."image-tag"' <<<"$IMAGE_INFO")"
11+
IMAGE_REF="$(jq -c -r '."image-ref"' <<<"$IMAGE_INFO")"
12+
IMAGE_REF="${IMAGE_REF##*://}"
13+
fi
914
sbkey='https://github.com/ublue-os/akmods/raw/main/certs/public_key.der'
1015

1116
# Configure Live Environment
@@ -24,21 +29,10 @@ rm /usr/share/applications/dev.getaurora.system-update.desktop
2429

2530
systemctl --global disable bazaar.service
2631

27-
# Configure Anaconda
28-
29-
SPECS=(
30-
"libblockdev-btrfs"
31-
"libblockdev-lvm"
32-
"libblockdev-dm"
33-
"anaconda-live"
34-
"anaconda-webui"
35-
)
36-
37-
dnf install -y "${SPECS[@]}"
38-
3932
# Anaconda Profile Detection
4033

4134
# Aurora
35+
mkdir -p /etc/anaconda/profile.d
4236
tee /etc/anaconda/profile.d/aurora.conf <<'EOF'
4337
# Anaconda configuration file for Aurora
4438

iso_files/iso.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
label: "Aurora-Live"
2+
grub2:
3+
timeout: 10
4+
entries:
5+
- name: "Aurora Live ISO"
6+
linux: "/images/pxeboot/vmlinuz quiet rhgb root=live:CDLABEL=Aurora-Live enforcing=0 rd.live.image"
7+
initrd: "/images/pxeboot/initrd.img"
8+
- name: "Aurora Live ISO (Safe Graphics Mode)"
9+
linux: "/images/pxeboot/vmlinuz quiet rhgb root=live:CDLABEL=Aurora-Live enforcing=0 rd.live.image nomodeset"
10+
initrd: "/images/pxeboot/initrd.img"

0 commit comments

Comments
 (0)