Apply sugesstion

This commit is contained in:
Hadi Chokr
2026-05-05 08:03:36 +02:00
parent 04b1729a00
commit ba213c61cc
6 changed files with 47 additions and 16 deletions

View File

@@ -0,0 +1,5 @@
#!/usr/bin/bash
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2026 Hadi Chokr <hadichokr@icloud.com>
rm -rf /opt/local

View File

@@ -1,15 +0,0 @@
#!/usr/bin/bash
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2026 Hadi Chokr <hadichokr@icloud.com>
CMDLINE=$(cat /proc/cmdline)
if echo "$CMDLINE" | grep -q 'nuke_local=1'; then
rm -rf /opt/local
elif echo "$CMDLINE" | grep -q 'mask_local=1'; then
mkdir -p /var/opt/local
mount --bind /opt/local /var/opt/local
mount --make-private /var/opt/local # isolate it before masking
mount -t tmpfs tmpfs /opt/local
fi

View File

@@ -0,0 +1,8 @@
#!/usr/bin/bash
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2026 Hadi Chokr <hadichokr@icloud.com>
mkdir -p /var/opt/local
mount --bind /opt/local /var/opt/local
mount --make-private /var/opt/local
mount -t tmpfs tmpfs /opt/local

View File

@@ -50,8 +50,9 @@ enable kde-linux-openqa-setup.service
enable kde-linux-powertop.service
enable kde-linux-volatile-var-lib-flatpak.service
enable kde-linux-sysupdated.socket
enable kde-linux-opt-cleaner-nuke.service
enable kde-linux-opt-cleaner-mask.service
enable plasma-setup-live-system.service
enable kde-linux-opt-kleaner.service
# KMSCON
enable kmsconvt@

View File

@@ -0,0 +1,16 @@
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2026 Hadi Chokr <hadichokr@icloud.com>
[Unit]
Description=Mask /opt/local with tmpfs when kde-linux.mask_local=1 is set
DefaultDependencies=no
ConditionKernelCommandLine=kde-linux.mask_local=1
Before=local-fs.target sysinit.target
After=systemd-remount-fs.service
[Service]
Type=oneshot
ExecStart=/usr/lib/opt-masker
[Install]
WantedBy=local-fs.target

View File

@@ -0,0 +1,16 @@
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2026 Hadi Chokr <hadichokr@icloud.com>
[Unit]
Description=Nuke /opt/local when kde-linux.nuke_local=1 is set
DefaultDependencies=no
ConditionKernelCommandLine=kde-linux.nuke_local=1
Before=local-fs.target sysinit.target
After=systemd-remount-fs.service
[Service]
Type=oneshot
ExecStart=/usr/lib/opt-cleaner
[Install]
WantedBy=local-fs.target