Skip to content

Commit 9f56df2

Browse files
RodoMa92HikariKnightKyleGospotrgeigernicknamenamenick
authored
chore: readd rmlint as an optional package (#1102)
* feat(just): add recipe to restart proton (#1091) * feat(just): add recipe to restart proton useful for when a game gets stuck at "launching" or "exiting" * chore: fix grammar * chore: Just syntax fix * chore(gnome): remove MUTTER_DEBUG_FORCE_KMS_MODE (#1094) This is no longer needed for VRR in v40+ and it breaks direct scanout. Signed-off-by: Tayler Geiger <mail@tayler.dev> * fix(ujust): Add --or-update flag for Flatpak command (#1095) * chore(gnome): Add missing 3037 fix to deck images * chore: Remove no longer needed patch from steamdeck-dsp * Readd rmlint as an optional ujust command * Missed a leftover from the old file --------- Signed-off-by: Tayler Geiger <mail@tayler.dev> Co-authored-by: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Co-authored-by: Kyle Gospodnetich <me@kylegospodneti.ch> Co-authored-by: Tayler Geiger <tayler@redhat.com> Co-authored-by: Pat Connors <121328689+nicknamenamenick@users.noreply.github.com>
1 parent 179a9de commit 9f56df2

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

Containerfile

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ RUN curl -Lo /usr/bin/copr https://raw.githubusercontent.com/ublue-os/COPR-comma
4242
curl -Lo /etc/yum.repos.d/_copr_matte-schwartz-sunshine.repo https://copr.fedorainfracloud.org/coprs/matte-schwartz/sunshine/repo/fedora-"${FEDORA_MAJOR_VERSION}"/matte-schwartz-sunshine-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
4343
curl -Lo /etc/yum.repos.d/_copr_rok-cdemu.repo https://copr.fedorainfracloud.org/coprs/rok/cdemu/repo/fedora-"${FEDORA_MAJOR_VERSION}"/rok-cdemu-fedora-"${FEDORA_MAJOR_VERSION}".rep && \
4444
curl -Lo /etc/yum.repos.d/_copr_rodoma92-kde-cdemu-manager.repo https://copr.fedorainfracloud.org/coprs/rodoma92/kde-cdemu-manager/repo/fedora-"${FEDORA_MAJOR_VERSION}"/rodoma92-kde-cdemu-manager-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
45+
curl -Lo /etc/yum.repos.d/_copr_rodoma92-rmlint.repo https://copr.fedorainfracloud.org/coprs/rodoma92/rmlint/repo/fedora-"${FEDORA_MAJOR_VERSION}"/rodoma92-rmlint-fedora-"${FEDORA_MAJOR_VERSION}".repo && \
4546
curl -Lo /etc/yum.repos.d/tailscale.repo https://pkgs.tailscale.com/stable/fedora/tailscale.repo && \
4647
sed -i 's@gpgcheck=1@gpgcheck=0@g' /etc/yum.repos.d/tailscale.repo && \
4748
ostree container commit
@@ -556,6 +557,7 @@ RUN /usr/libexec/containerbuild/build-initramfs && \
556557
echo "import \"/usr/share/ublue-os/just/82-bazzite-apps.just\"" >> /usr/share/ublue-os/justfile && \
557558
echo "import \"/usr/share/ublue-os/just/82-bazzite-cdemu.just\"" >> /usr/share/ublue-os/justfile && \
558559
echo "import \"/usr/share/ublue-os/just/82-bazzite-sunshine.just\"" >> /usr/share/ublue-os/justfile && \
560+
echo "import \"/usr/share/ublue-os/just/82-bazzite-rmlint.just\"" >> /usr/share/ublue-os/justfile && \
559561
echo "import \"/usr/share/ublue-os/just/82-bazzite-waydroid.just\"" >> /usr/share/ublue-os/justfile && \
560562
echo "import \"/usr/share/ublue-os/just/83-bazzite-audio.just\"" >> /usr/share/ublue-os/justfile && \
561563
echo "import \"/usr/share/ublue-os/just/84-bazzite-virt.just\"" >> /usr/share/ublue-os/justfile && \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# vim: set ft=make :
2+
3+
# Reenable rmlint trim feature
4+
enable-rmlint ACTION="":
5+
#!/usr/bin/bash
6+
source /usr/lib/ujust/ujust.sh
7+
OPTION={{ ACTION }}
8+
if [[ ! -f "/etc/systemd/system/btrfs-dedup@.service.d/override.conf" ]]; then
9+
RMLINT_STATE="${red}${b}not enabled{n}"
10+
else
11+
RMLINT_STATE="${green}${b}already enabled${n}"
12+
fi
13+
if [ "$OPTION" == "help" ]; then
14+
echo "Usage: ujust enable-rmlint <option>"
15+
echo " <option>: Specify the quick option to skip the prompt"
16+
echo " Use 'enable' to reenable rmlint functionality"
17+
echo " Use 'disable' to revert to UBlue stock configuration (only duperemove is executed)"
18+
exit 0
19+
elif [ "$OPTION" == "" ]; then
20+
echo "${bold}rmlint configuration${normal}"
21+
echo "rmlint conf is $RMLINT_STATE"
22+
OPTION=$(Choose "Enable rmlint" "Disable rmlint")
23+
fi
24+
if [[ "${OPTION,,}" =~ ^enable ]]; then
25+
if [[ "${RMLINT_STATE,,}" =~ "^already" ]]; then
26+
echo "${red} rmlint has already been enabled!"
27+
exit 0
28+
fi
29+
ublue-update --wait
30+
rpm-ostree install --apply-live -y rmlint
31+
mkdir /etc/systemd/system/btrfs-dedup@.service.d/
32+
bash -c 'cat << EOL > /etc/systemd/system/btrfs-dedup@.service.d/override.conf
33+
[Unit]
34+
Description=Btrfs deduplication on %f
35+
ConditionPathIsMountPoint=%f
36+
RequiresMountsFor=%f
37+
38+
[Service]
39+
Type=oneshot
40+
MemoryHigh=1G
41+
ExecCondition=sh -c '[ "$(stat -f -c "%%T" "$1")" = btrfs ]' _ %f/
42+
ExecStartPre=-find %f/ -mindepth 1 -maxdepth 1 -mtime +14 -name .duperemove.hash -exec rm -f '{}' \;
43+
ExecStartPre=-cp -a %f/.duperemove.hash duperemove.hash
44+
ExecStartPre=-compsize %f/
45+
ExecStart=rmlint --hidden --types="duplicates" --config=sh:handler=clone %f/
46+
ExecStart=sh -c 'exec ./rmlint.sh -d -p -r -k'
47+
ExecStart=-compsize %f/
48+
ExecStart=-sh -c '[ "$(sqlite3 -readonly duperemove.hash "SELECT keyval FROM config where keyname=''version_major''")" -ge 4 ] || rm -f duperemove.hash'
49+
ExecStart=duperemove -r -d -h -q --hashfile=duperemove.hash --skip-zeroes --exclude="%f/.duperemove.hash" --exclude="%f/@swapfile/swapfile" %f/
50+
ExecStartPost=-compsize %f/
51+
ExecStopPost=-cp -a duperemove.hash %f/.duperemove.hash
52+
TimeoutStartSec=4h
53+
RuntimeDirectory=%p/%i
54+
WorkingDirectory=%t/%p/%i
55+
Nice=19
56+
CPUSchedulingPolicy=batch
57+
IOSchedulingClass=best-effort
58+
IOSchedulingPriority=7
59+
OOMScoreAdjust=1000
60+
CPUWeight=30
61+
CPUQuota=300%
62+
IOWeight=30
63+
EOL'
64+
echo "rmlint has been reenabled!"
65+
elif [[ "${OPTION,,}" =~ ^(disable|uninstall) ]]; then
66+
if [[ "${RMLINT_STATE,,}" =~ "^not" ]]; then
67+
echo "${red} rmlint has already been disabled!"
68+
exit 0
69+
fi
70+
ublue-update --wait
71+
rpm-ostree remove -y rmlint
72+
rm /etc/systemd/system/btrfs-dedup@.service.d/override.conf
73+
rmdir /etc/systemd/system/btrfs-dedup@.service.d/
74+
echo "rmlint has been disabled."
75+
fi

0 commit comments

Comments
 (0)