diff --git a/Containerfile b/Containerfile index 042af9d225..15092009bc 100644 --- a/Containerfile +++ b/Containerfile @@ -280,9 +280,7 @@ RUN rpm-ostree install \ ln -s /usr/share/fonts/google-noto-sans-cjk-fonts /usr/share/fonts/noto-cjk && \ wget https://raw.githubusercontent.com/KyleGospo/steam-proton-mf-wmv/master/installcab.py -O /usr/bin/installcab && \ wget https://github.com/KyleGospo/steam-proton-mf-wmv/blob/master/install-mf-wmv.sh -O /usr/bin/install-mf-wmv && \ - wget https://raw.githubusercontent.com/jlu5/icoextract/master/exe-thumbnailer.thumbnailer -O /usr/share/thumbnailers/exe-thumbnailer.thumbnailer && \ - wget https://gitlab.com/popsulfr/steamos-btrfs/-/raw/11114e4ff791eb2c385814c2fcbac6a83f144f35/files/usr/lib/systemd/system/btrfs-dedup@.service -O /usr/lib/systemd/system/btrfs-dedup@.service && \ - wget https://gitlab.com/popsulfr/steamos-btrfs/-/raw/11114e4ff791eb2c385814c2fcbac6a83f144f35/files/usr/lib/systemd/system/btrfs-dedup@.timer -O /usr/lib/systemd/system/btrfs-dedup@.timer + wget https://raw.githubusercontent.com/jlu5/icoextract/master/exe-thumbnailer.thumbnailer -O /usr/share/thumbnailers/exe-thumbnailer.thumbnailer # Install Steam & Lutris, plus supporting packages RUN rpm-ostree install \ diff --git a/system_files/desktop/shared/usr/lib/systemd/system/btrfs-dedup@.service b/system_files/desktop/shared/usr/lib/systemd/system/btrfs-dedup@.service new file mode 100644 index 0000000000..3b5dbba5ac --- /dev/null +++ b/system_files/desktop/shared/usr/lib/systemd/system/btrfs-dedup@.service @@ -0,0 +1,30 @@ +[Unit] +Description=Btrfs deduplication on %f +ConditionPathIsMountPoint=%f +RequiresMountsFor=%f + +[Service] +Type=oneshot +MemoryHigh=1G +ExecCondition=sh -c '[ "$(stat -f -c "%%T" "$1")" = btrfs ]' _ %f/ +ExecStartPre=-find %f/ -mindepth 1 -maxdepth 1 -mtime +14 -name .duperemove.hash -exec rm -f '{}' \; +ExecStartPre=-cp -a %f/.duperemove.hash duperemove.hash +ExecStartPre=-compsize %f/ +ExecStart=rmlint --hidden --types="duplicates" --config=sh:handler=clone %f/ +ExecStart=sh -c 'exec ./rmlint.sh -d -p -r -k' +ExecStart=-compsize %f/ +ExecStart=-sh -c '[ "$(sqlite3 -readonly duperemove.hash "SELECT keyval FROM config where keyname=''version_major''")" -ge 4 ] || rm -f duperemove.hash' +ExecStart=duperemove -r -d -h -q --hashfile=duperemove.hash --skip-zeroes --exclude="%f/.duperemove.hash" --exclude="%f/@swapfile/swapfile" %f/ +ExecStartPost=-compsize %f/ +ExecStopPost=-cp -a duperemove.hash %f/.duperemove.hash +TimeoutStartSec=4h +RuntimeDirectory=%p/%i +WorkingDirectory=%t/%p/%i +Nice=19 +CPUSchedulingPolicy=batch +IOSchedulingClass=best-effort +IOSchedulingPriority=7 +OOMScoreAdjust=1000 +CPUWeight=30 +CPUQuota=300% +IOWeight=30 diff --git a/system_files/desktop/shared/usr/lib/systemd/system/btrfs-dedup@.timer b/system_files/desktop/shared/usr/lib/systemd/system/btrfs-dedup@.timer new file mode 100644 index 0000000000..66a3a0ad42 --- /dev/null +++ b/system_files/desktop/shared/usr/lib/systemd/system/btrfs-dedup@.timer @@ -0,0 +1,11 @@ +[Unit] +Description=Weekly Btrfs deduplication on %f + +[Timer] +OnCalendar=weekly +AccuracySec=1h +RandomizedDelaySec=1d +Persistent=true + +[Install] +WantedBy=timers.target