@@ -101,6 +101,7 @@ TITANOBOA_LIVE_ENV_CTR_IMAGE := ${TITANOBOA_LIVE_ENV_CTR_IMAGE}
101101_TITANOBOA_BUILDER_IMAGE := ${_TITANOBOA_BUILDER_IMAGE}
102102_TITANOBOA_BUILDER_DISTRO := ${TITANOBOA_BUILDER_DISTRO}
103103TITANOBOA_PREINITRAMFS_HOOK := ${TITANOBOA_PREINITRAMFS_HOOK}
104+ TITANOBOA_FLATPAKS_FILE := ${TITANOBOA_FLATPAKS_FILE}
104105EOF
105106 echo " ################################################################################"
106107}
@@ -240,6 +241,30 @@ _build_initramfs() {
240241 echo >&2 " Finished ${FUNCNAME[0]} "
241242}
242243
244+ # Install flatpaks into the live environment rootfs.
245+ _rootfs_include_flatpaks () {
246+
247+ echo >&2 " Executing ${FUNCNAME[0]} ..."
248+
249+ echo >&2 " Installing flatpaks..."
250+ if [[ -n $TITANOBOA_FLATPAKS_FILE ]]; then
251+ echo >&2 " TITANOBOA_FLATPAKS_FILE=$TITANOBOA_FLATPAKS_FILE "
252+ PARAMETERS=" --volume=$TITANOBOA_FLATPAKS_FILE :/run/flatpaks.txt:ro,z" \
253+ _chroot /bin/bash << RUNEOF
254+ set -euxo pipefail
255+ mkdir -p /var/lib/flatpak
256+ pkg install flatpak
257+ flatpak remote-add --if-not-exists flathub "https://dl.flathub.org/repo/flathub.flatpakrepo"
258+ grep -v "#.*" /run/flatpaks.txt |
259+ sort --reverse |
260+ xargs "-i{}" -d "\n" sh -c "flatpak remote-info --arch=${_TITANOBOA_CPU_ARCH} --system flathub {} &>/dev/null && flatpak install --noninteractive -y {}" || true
261+ RUNEOF
262+ fi
263+ echo >&2 " Finished installing flatpaks"
264+
265+ echo >&2 " Finished ${FUNCNAME[0]} "
266+ }
267+
243268# ###### endregion BUILD_STAGES #######
244269
245270#
@@ -266,6 +291,8 @@ main() {
266291
267292 _build_initramfs
268293
294+ _rootfs_include_flatpaks
295+
269296 echo >&2 " TODO"
270297
271298 exit
0 commit comments