Skip to content

Commit 9bb0887

Browse files
authored
feat(liveiso): Migrate to experimental Titanoboa (ublue-os#4141)
* feat(liveiso): Migrate to experimental Titanoboa Includes full support for Ventoy Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com> * ci(liveiso): force btrfs mount Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com> * ci(liveiso): point podman to installer directory Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com> --------- Signed-off-by: Zeglius <33781398+Zeglius@users.noreply.github.com>
1 parent 823361f commit 9bb0887

File tree

6 files changed

+141
-15
lines changed

6 files changed

+141
-15
lines changed

.github/workflows/build_iso_titanoboa.yml

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@ jobs:
5454
if: ${{ steps.check_mnt.outputs.mnt_is_there == '1' }}
5555
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
5656

57-
- name: Mount BTRFS for podman storage
58-
if: ${{ steps.check_mnt.outputs.mnt_is_there == '1' }}
59-
uses: ublue-os/container-storage-action@dc1f4c8f17b672069e921f001132f7cf98a423a6
60-
with:
61-
target-dir: /var/lib/containers
62-
continue-on-error: true
57+
- name: Mount Container Storage BTRFS Loopback
58+
run: |
59+
sudo truncate -s 70G /mnt/podman-storage.img
60+
sudo mkfs.btrfs -f /mnt/podman-storage.img
61+
sudo podman system reset --force
62+
sudo systemctl stop podman.service
63+
sudo mount -o compress-force=zstd:2 /mnt/podman-storage.img /var/lib/containers/storage
64+
sudo systemctl start podman.service
6365
6466
- name: Checkout Repo
6567
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
@@ -82,13 +84,13 @@ jobs:
8284
id: generate-flatpak-dir-shortname
8385
shell: bash
8486
run: |
85-
FLATPAK_DIR_SHORTNAME="installer/kde_flatpaks"
87+
FLATPAK_DIR_SHORTNAME="kde_flatpaks"
8688
8789
if [[ "${{ matrix.image_name }}" =~ "gnome" ]]; then
88-
FLATPAK_DIR_SHORTNAME="installer/gnome_flatpaks"
90+
FLATPAK_DIR_SHORTNAME="gnome_flatpaks"
8991
fi
9092
91-
echo "flatpak-dir-shortname=$(realpath ${FLATPAK_DIR_SHORTNAME})" >> $GITHUB_OUTPUT
93+
echo "flatpak-dir-shortname=${FLATPAK_DIR_SHORTNAME}" >> $GITHUB_OUTPUT
9294
9395
# Docker requires lowercase registry references
9496
- name: Lowercase Registry
@@ -118,17 +120,27 @@ jobs:
118120
fi
119121
echo "ref=${ref}" >> $GITHUB_OUTPUT
120122
123+
- name: Build Container Image
124+
run: |
125+
BASE_IMAGE="${{ steps.registry_case.outputs.lowercase }}/${{ steps.get-nondeck-ref.outputs.ref }}:${{ steps.generate-tag.outputs.tag }}"
126+
INSTALL_IMAGE_PAYLOAD="${{ steps.registry_case.outputs.lowercase }}/${{ matrix.image_name }}:${{ steps.generate-tag.outputs.tag }}"
127+
FLATPAK_DIR_SHORTNAME="${{ steps.generate-flatpak-dir-shortname.outputs.flatpak-dir-shortname }}"
128+
129+
sudo podman build \
130+
--cap-add sys_admin \
131+
--security-opt label=disable \
132+
--build-arg BASE_IMAGE="$BASE_IMAGE" \
133+
--build-arg INSTALL_IMAGE_PAYLOAD="$INSTALL_IMAGE_PAYLOAD" \
134+
--build-arg FLATPAK_DIR_SHORTNAME="$FLATPAK_DIR_SHORTNAME" \
135+
-t localhost/payload:latest installer/
136+
121137
- name: Build ISOs
122-
uses: ublue-os/titanoboa@main
138+
uses: Zeglius/titanoboa@revamp-pr
123139
id: build
124140
with:
125-
image-ref: ${{ steps.registry_case.outputs.lowercase }}/${{ steps.get-nondeck-ref.outputs.ref }}:${{ steps.generate-tag.outputs.tag }}
126-
container-image: ${{ steps.registry_case.outputs.lowercase }}/${{ matrix.image_name }}:${{ steps.generate-tag.outputs.tag }}
141+
image-ref: localhost/payload:latest
127142
# TODO (@Zeglius): Remove "liveiso" prefix once this becomes the main ISO
128143
iso-dest: ${{ matrix.image_name }}-${{ steps.generate-tag.outputs.tag }}-live-amd64.iso
129-
flatpaks-list: ${{ steps.generate-flatpak-dir-shortname.outputs.flatpak-dir-shortname }}/flatpaks
130-
hook-pre-initramfs: ${{ github.workspace }}/installer/titanoboa_hook_preinitramfs.sh
131-
hook-post-rootfs: ${{ github.workspace }}/installer/titanoboa_hook_postrootfs.sh
132144

133145
- name: Move ISOs to Upload Directory
134146
id: upload-directory

installer/Containerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# run with --cap-add sys_admin --security-opt label=disable
2+
3+
ARG BASE_IMAGE=${BASE_IMAGE:-ghcr.io/ublue-os/bazzite:latest}
4+
ARG INSTALL_IMAGE_PAYLOAD=${INSTALL_IMAGE_PAYLOAD:-ghcr.io/ublue-os/bazzite:latest}
5+
ARG FLATPAK_DIR_SHORTNAME=${FLATPAK_DIR_SHORTNAME:-kde_flatpaks}
6+
7+
8+
FROM $BASE_IMAGE
9+
ARG BASE_IMAGE
10+
ARG INSTALL_IMAGE_PAYLOAD
11+
ARG FLATPAK_DIR_SHORTNAME
12+
RUN --mount=type=bind,source=./.,target=/src \
13+
env \
14+
BASE_IMAGE="$BASE_IMAGE" \
15+
INSTALL_IMAGE_PAYLOAD="$INSTALL_IMAGE_PAYLOAD" \
16+
FLATPAK_DIR_SHORTNAME="$FLATPAK_DIR_SHORTNAME" \
17+
/src/build.sh

installer/build.sh

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/usr/bin/bash
2+
# Ref: https://github.com/ondrejbudai/bootc-isos/blob/3b3a185e4a57947f57baf53d2be5aee469274f98/bazzite/src/build.sh
3+
4+
set -exo pipefail
5+
6+
{ export PS4='+( ${BASH_SOURCE}:${LINENO} ): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'; } 2>/dev/null
7+
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
BASE_IMAGE=${BASE_IMAGE:?}
10+
INSTALL_IMAGE_PAYLOAD=${INSTALL_IMAGE_PAYLOAD:?}
11+
FLATPAK_DIR_SHORTNAME=${FLATPAK_DIR_SHORTNAME:?}
12+
13+
# Create the directory that /root is symlinked to
14+
mkdir -p "$(realpath /root)"
15+
16+
# bwrap tries to write /proc/sys/user/max_user_namespaces which is mounted as ro
17+
# so we need to remount it as rw
18+
mount -o remount,rw /proc/sys
19+
20+
# Install flatpaks
21+
curl --retry 3 -Lo /etc/flatpak/remotes.d/flathub.flatpakrepo https://dl.flathub.org/repo/flathub.flatpakrepo
22+
xargs -r flatpak install -y --noninteractive <"/src/$FLATPAK_DIR_SHORTNAME/flatpaks"
23+
24+
# Pull the container image to be installed
25+
podman pull "$INSTALL_IMAGE_PAYLOAD"
26+
27+
# Run the preinitramfs hook
28+
"$SCRIPT_DIR/titanoboa_hook_preinitramfs.sh"
29+
30+
# Install dracut-live and regenerate the initramfs
31+
dnf install -y dracut-live
32+
kernel=$(kernel-install list --json pretty | jq -r '.[] | select(.has_kernel == true) | .version')
33+
DRACUT_NO_XATTR=1 dracut -v --force --zstd --reproducible --no-hostonly \
34+
--add "dmsquash-live dmsquash-live-autooverlay" \
35+
"/usr/lib/modules/${kernel}/initramfs.img" "${kernel}"
36+
37+
# Install livesys-scripts and configure them
38+
dnf install -y livesys-scripts
39+
if [[ ${BASE_IMAGE} == *-gnome* ]]; then
40+
sed -i "s/^livesys_session=.*/livesys_session=gnome/" /etc/sysconfig/livesys
41+
else
42+
sed -i "s/^livesys_session=.*/livesys_session=kde/" /etc/sysconfig/livesys
43+
fi
44+
systemctl enable livesys.service livesys-late.service
45+
46+
# Run the postrootfs hook
47+
"$SCRIPT_DIR/titanoboa_hook_postrootfs.sh"
48+
49+
# image-builder needs gcdx64.efi
50+
dnf install -y grub2-efi-x64-cdboot
51+
52+
# image-builder expects the EFI directory to be in /boot/efi
53+
mkdir -p /boot/efi
54+
cp -av /usr/lib/efi/*/*/EFI /boot/efi/
55+
56+
# Remove fallback efi
57+
cp -v /boot/efi/EFI/fedora/grubx64.efi /boot/efi/EFI/BOOT/fbx64.efi # NOTE: remove this line if breaks bootloader
58+
59+
# Set the timezone to UTC
60+
rm -f /etc/localtime
61+
systemd-firstboot --timezone UTC
62+
63+
# / in a booted live ISO is an overlayfs with upperdir pointed somewhere under /run
64+
# This means that /var/tmp is also technically under /run.
65+
# /run is of course a tmpfs, but set with quite a small size.
66+
# ostree needs quite a lot of space on /var/tmp for temporary files so /run is not enough.
67+
# Mount a larger tmpfs to /var/tmp at boot time to avoid this issue.
68+
rm -rf /var/tmp
69+
mkdir /var/tmp
70+
cat >/etc/systemd/system/var-tmp.mount <<'EOF'
71+
[Unit]
72+
Description=Larger tmpfs for /var/tmp on live system
73+
74+
[Mount]
75+
What=tmpfs
76+
Where=/var/tmp
77+
Type=tmpfs
78+
Options=size=50%%,nr_inodes=1m,x-systemd.graceful-option=usrquota
79+
80+
[Install]
81+
WantedBy=local-fs.target
82+
EOF
83+
systemctl enable var-tmp.mount
84+
85+
# Copy in the iso config for image-builder
86+
mkdir -p /usr/lib/bootc-image-builder
87+
cp /src/iso.yaml /usr/lib/bootc-image-builder/iso.yaml
88+
89+
# Clean up dnf cache to save space
90+
dnf clean all

installer/iso.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
label: "Bazzite-Live"
2+
grub2:
3+
timeout: 3
4+
entries:
5+
- name: "Launch Bazzite Installer"
6+
linux: "/images/pxeboot/vmlinuz quiet rhgb root=live:CDLABEL=Bazzite-Live enforcing=0 rd.live.image"
7+
initrd: "/images/pxeboot/initrd.img"

installer/titanoboa_hook_postrootfs.sh

100644100755
File mode changed.

installer/titanoboa_hook_preinitramfs.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)