move flatpak install from chroot to container

cleaner, allows caching
This commit is contained in:
Ian Monroe
2024-12-12 22:29:23 -08:00
parent 208b0c530d
commit 6cbe5099cf
4 changed files with 39 additions and 29 deletions

View File

@@ -59,6 +59,7 @@ pacman --sync --refresh --noconfirm --sysupgrade \
dosfstools \
duperemove \
erofs-utils \
flatpak \
git \
go \
openssh \

View File

@@ -30,6 +30,37 @@ make_debug_archive () {
zstd --threads=0 --rm -15 "$DEBUG_TAR" # --threads=0 automatically uses the optimal number
}
download_flatpaks() {
[ -f /usr/lib/os-release ] || false
cat /usr/lib/os-release
mkdir flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Do this separately, when used as part of remote-add it complains about GPG for unknown reasons
flatpak remote-modify --collection-id=org.flathub.Stable flathub
# Only check out en. We don't really support other languages on the live image at this time.
flatpak config --set languages en
flatpak install --noninteractive --assumeyes \
org.kde.ark \
org.kde.dolphin \
org.kde.elisa \
org.kde.gwenview \
org.kde.kate \
org.kde.haruna \
org.kde.konsole \
org.kde.kwalletmanager5 \
org.kde.kwrite \
org.kde.okular \
org.mozilla.firefox
# And restore default
flatpak config --unset languages
}
VERSION=$(date +%Y%m%d%H%M) # Build version, will just be YYYYmmddHHMM for now
OUTPUT=mkosi.output/kde-linux_$VERSION # Built rootfs path (mkosi uses this directory by default)
@@ -135,11 +166,13 @@ mkdir @etc-overlay/upper \
@var-overlay/upper \
@var-overlay/work
# Create read-only subvolumes from /live, /flatpak and /.
download_flatpaks
# Create read-only subvolumes from chroot's /live and /.
# and from the container's /var/lib/flatpak.
cp --archive --recursive "${OUTPUT}/live/." @live
cp --archive --recursive "${OUTPUT}/flatpak/." @flatpak
cp --archive --recursive "/var/lib/flatpak/." @flatpak
rm --recursive "${OUTPUT}/live"
rm --recursive "${OUTPUT}/flatpak"
cp --archive --recursive "${OUTPUT}/." "@kde-linux_$VERSION"
btrfs property set @live ro true
btrfs property set @flatpak ro true

View File

@@ -54,6 +54,7 @@ if [ "$CONTAINER_RUNTIME" = "podman" ]; then
# podman requires the volume mount points to exist already
mkdir -p "${SCRIPT_DIR}/kde-linux.cache/pacman"
mkdir -p "${SCRIPT_DIR}/kde-linux.cache/mkosi.pacman"
mkdir -p "${SCRIPT_DIR}/kde-linux.cache/flatpak"
fi
# Exit if Docker or Podman are not available.
@@ -119,6 +120,7 @@ $CONTAINER_RUNTIME run \
--volume="${SCRIPT_DIR}:/workspace" \
--volume="${SCRIPT_DIR}/kde-linux.cache/pacman:/var/cache/pacman/pkg" \
--volume="${SCRIPT_DIR}/kde-linux.cache/mkosi.pacman:/var/cache/mkosi.pacman" \
--volume="${SCRIPT_DIR}/kde-linux.cache/flatpak:/var/lib/flatpak" \
--volume="/dev:/dev" \
--workdir="/workspace" \
--rm \

View File

@@ -59,32 +59,6 @@ EOF
[ -f /usr/lib/os-release ] || false
cat /usr/lib/os-release
mkdir flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# Do this separately, when used as part of remote-add it complains about GPG for unknown reasons
flatpak remote-modify --collection-id=org.flathub.Stable flathub
# Only check out en. We don't really support other languages on the live image at this time.
flatpak config --set languages en
flatpak install --noninteractive --assumeyes \
org.kde.ark \
org.kde.dolphin \
org.kde.elisa \
org.kde.gwenview \
org.kde.kate \
org.kde.haruna \
org.kde.konsole \
org.kde.kwalletmanager5 \
org.kde.kwrite \
org.kde.okular \
org.mozilla.firefox
# And restore default
flatpak config --unset languages
mv /var/lib/flatpak / # we'll extract this and later mount it into place
# Fetch latest distrobox config from the kde-linux-containers repo
mkdir -p /usr/share/distrobox
curl --output /usr/share/distrobox/distrobox.conf \