mirror of
https://github.com/KDE/kde-linux.git
synced 2026-05-24 08:16:12 -04:00
Apply sugesstion
This commit is contained in:
5
mkosi.extra/usr/lib/opt-cleaner
Normal file
5
mkosi.extra/usr/lib/opt-cleaner
Normal 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
|
||||
@@ -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
|
||||
8
mkosi.extra/usr/lib/opt-masker
Normal file
8
mkosi.extra/usr/lib/opt-masker
Normal 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
|
||||
@@ -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@
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user