diff --git a/Containerfile b/Containerfile index 27e39463..9427d897 100644 --- a/Containerfile +++ b/Containerfile @@ -421,6 +421,7 @@ RUN --mount=type=cache,dst=/var/cache/rpm-ostree \ ydotool \ yafti \ stress-ng \ + btrfs-assistant \ lsb_release && \ rpm-ostree install \ ublue-update && \ @@ -430,6 +431,7 @@ RUN --mount=type=cache,dst=/var/cache/rpm-ostree \ sed -i 's/max_cpu_load_percent.*/max_cpu_load_percent = 100.0/' /etc/ublue-update/ublue-update.toml && \ sed -i 's/max_mem_percent.*/max_mem_percent = 90.0/' /etc/ublue-update/ublue-update.toml && \ sed -i 's/dbus_notify.*/dbus_notify = false/' /etc/ublue-update/ublue-update.toml && \ + sed -i 's/ --xdg-runtime=\\"${XDG_RUNTIME_DIR}\\"//g' /usr/bin/btrfs-assistant-launcher && \ curl -Lo /usr/bin/installcab https://raw.githubusercontent.com/KyleGospo/steam-proton-mf-wmv/master/installcab.py && \ chmod +x /usr/bin/installcab && \ curl -Lo /usr/bin/install-mf-wmv https://github.com/KyleGospo/steam-proton-mf-wmv/blob/master/install-mf-wmv.sh && \ @@ -720,6 +722,7 @@ RUN rm -f /etc/profile.d/toolbox.sh && \ systemctl enable bazzite-hardware-setup.service && \ systemctl disable tailscaled.service && \ systemctl enable dev-hugepages1G.mount && \ + systemctl enable bazzite-snapper-setup && \ systemctl --global enable bazzite-user-setup.service && \ systemctl --global enable podman.socket && \ systemctl --global enable systemd-tmpfiles-setup.service && \ diff --git a/system_files/desktop/shared/usr/lib/systemd/system/bazzite-snapper-setup.service b/system_files/desktop/shared/usr/lib/systemd/system/bazzite-snapper-setup.service new file mode 100644 index 00000000..db052fa2 --- /dev/null +++ b/system_files/desktop/shared/usr/lib/systemd/system/bazzite-snapper-setup.service @@ -0,0 +1,10 @@ +[Unit] +Description=Create a default snapper config if snapper is unconfigured +After=local-fs.target + +[Service] +Type=oneshot +ExecStart=/usr/libexec/bazzite-snapper-setup + +[Install] +WantedBy=multi-user.target diff --git a/system_files/desktop/shared/usr/libexec/bazzite-snapper-setup b/system_files/desktop/shared/usr/libexec/bazzite-snapper-setup new file mode 100755 index 00000000..1307b88f --- /dev/null +++ b/system_files/desktop/shared/usr/libexec/bazzite-snapper-setup @@ -0,0 +1,4 @@ +#!/bin/bash +if ! snapper get-config >/dev/null 2>&1; then + snapper create-config /var/home +fi diff --git a/system_files/desktop/shared/usr/share/snapper/config-templates/default b/system_files/desktop/shared/usr/share/snapper/config-templates/default new file mode 100644 index 00000000..aeeb8eaf --- /dev/null +++ b/system_files/desktop/shared/usr/share/snapper/config-templates/default @@ -0,0 +1,63 @@ +# subvolume to snapshot +# With ostree it is pointless to snapshot /, +# so we set the root config to snapshot /var/home instead +SUBVOLUME="/var/home" + +# filesystem type +FSTYPE="btrfs" + + +# btrfs qgroup for space aware cleanup algorithms +QGROUP="" + + +# fraction or absolute size of the filesystems space the snapshots may use +SPACE_LIMIT="0.5" + +# fraction or absolute size of the filesystems space that should be free +FREE_LIMIT="0.2" + + +# users and groups allowed to work with config +ALLOW_USERS="" +ALLOW_GROUPS="" + +# sync users and groups from ALLOW_USERS and ALLOW_GROUPS to .snapshots +# directory +SYNC_ACL="no" + + +# start comparing pre- and post-snapshot in background after creating +# post-snapshot +BACKGROUND_COMPARISON="yes" + + +# run daily number cleanup +NUMBER_CLEANUP="yes" + +# limit for number cleanup +NUMBER_MIN_AGE="1800" +NUMBER_LIMIT="50" +NUMBER_LIMIT_IMPORTANT="10" + + +# create hourly snapshots +TIMELINE_CREATE="yes" + +# cleanup hourly snapshots after some time +TIMELINE_CLEANUP="yes" + +# limits for timeline cleanup +TIMELINE_MIN_AGE="1800" +TIMELINE_LIMIT_HOURLY="8" +TIMELINE_LIMIT_DAILY="4" +TIMELINE_LIMIT_WEEKLY="4" +TIMELINE_LIMIT_MONTHLY="3" +TIMELINE_LIMIT_YEARLY="0" + + +# cleanup empty pre-post-pairs +EMPTY_PRE_POST_CLEANUP="yes" + +# limits for empty pre-post-pair cleanup +EMPTY_PRE_POST_MIN_AGE="90"