From bfab8cc793561ab877cb3aaa0f4da7dd6f79313d Mon Sep 17 00:00:00 2001 From: Hadi Chokr Date: Wed, 25 Feb 2026 16:38:21 +0100 Subject: [PATCH] Why doenst this work? --- mkosi.extra/etc/ld.so.conf.d/opt-local.conf | 2 + .../etc/ld.so.conf.d/opt-local.conf.license | 2 + mkosi.extra/etc/man_db.conf | 134 ++++++++++++++++++ .../etc/profile.d/99-local-precedence.sh | 17 +++ .../live/{usr => opt}/local/bin/calamares | 5 +- .../environment.d/40-kde-linux-local-bin.conf | 0 .../lib/environment.d/40-kde-linux-path.conf | 8 -- .../lib/systemd/sysext.conf.d/mutable.conf | 6 + .../usr/lib/tmpfiles.d/sysext-trigger.conf | 6 + mkosi.extra/usr/lib/tmpfiles.d/usr-local.conf | 28 ++++ .../actions/org.kde.linux.calamares.policy | 2 +- mkosi.finalize.d/40-core.sh.chroot | 3 + 12 files changed, 202 insertions(+), 11 deletions(-) create mode 100644 mkosi.extra/etc/ld.so.conf.d/opt-local.conf create mode 100644 mkosi.extra/etc/ld.so.conf.d/opt-local.conf.license create mode 100644 mkosi.extra/etc/man_db.conf create mode 100644 mkosi.extra/etc/profile.d/99-local-precedence.sh rename mkosi.extra/live/{usr => opt}/local/bin/calamares (71%) delete mode 100644 mkosi.extra/usr/lib/environment.d/40-kde-linux-local-bin.conf delete mode 100644 mkosi.extra/usr/lib/environment.d/40-kde-linux-path.conf create mode 100644 mkosi.extra/usr/lib/systemd/sysext.conf.d/mutable.conf create mode 100644 mkosi.extra/usr/lib/tmpfiles.d/sysext-trigger.conf create mode 100644 mkosi.extra/usr/lib/tmpfiles.d/usr-local.conf diff --git a/mkosi.extra/etc/ld.so.conf.d/opt-local.conf b/mkosi.extra/etc/ld.so.conf.d/opt-local.conf new file mode 100644 index 0000000..0b5732c --- /dev/null +++ b/mkosi.extra/etc/ld.so.conf.d/opt-local.conf @@ -0,0 +1,2 @@ +/opt/local/lib +/opt/local/lib64 diff --git a/mkosi.extra/etc/ld.so.conf.d/opt-local.conf.license b/mkosi.extra/etc/ld.so.conf.d/opt-local.conf.license new file mode 100644 index 0000000..476b32b --- /dev/null +++ b/mkosi.extra/etc/ld.so.conf.d/opt-local.conf.license @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL +# SPDX-FileCopyrightText: 2026 Hadi Chokr diff --git a/mkosi.extra/etc/man_db.conf b/mkosi.extra/etc/man_db.conf new file mode 100644 index 0000000..01d7222 --- /dev/null +++ b/mkosi.extra/etc/man_db.conf @@ -0,0 +1,134 @@ +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL +# SPDX-FileCopyrightText: 2026 Hadi Chokr +# +# man_db.conf +# +# This file is used by the man-db package to configure the man and cat paths. +# It is also used to provide a manpath for those without one by examining +# their PATH environment variable. For details see the manpath(5) man page. +# +# Lines beginning with `#' are comments and are ignored. Any combination of +# tabs or spaces may be used as `whitespace' separators. +# +# There are three mappings allowed in this file: +# -------------------------------------------------------- +# MANDATORY_MANPATH manpath_element +# MANPATH_MAP path_element manpath_element +# MANDB_MAP global_manpath [relative_catpath] +#--------------------------------------------------------- +# every automatically generated MANPATH includes these fields +# +#MANDATORY_MANPATH /usr/src/pvm3/man +# +MANDATORY_MANPATH /usr/man +MANDATORY_MANPATH /usr/share/man +MANDATORY_MANPATH /opt/local/share/man +#--------------------------------------------------------- +# set up PATH to MANPATH mapping +# ie. what man tree holds man pages for what binary directory. +# +# *PATH* -> *MANPATH* +# +MANPATH_MAP /bin /usr/share/man +MANPATH_MAP /usr/bin /usr/share/man +MANPATH_MAP /sbin /usr/share/man +MANPATH_MAP /usr/sbin /usr/share/man +MANPATH_MAP /opt/local/bin /opt/local/man +MANPATH_MAP /opt/local/bin /opt/local/share/man +MANPATH_MAP /opt/local/sbin /opt/local/man +MANPATH_MAP /opt/local/sbin /opt/local/share/man +MANPATH_MAP /usr/X11R6/bin /opt/X11R6/man +MANPATH_MAP /usr/bin/X11 /opt/X11R6/man +MANPATH_MAP /usr/games /usr/share/man +MANPATH_MAP /opt/bin /opt/man +MANPATH_MAP /opt/sbin /opt/man +#--------------------------------------------------------- +# For a manpath element to be treated as a system manpath (as most of those +# above should normally be), it must be mentioned below. Each line may have +# an optional extra string indicating the catpath associated with the +# manpath. If no catpath string is used, the catpath will default to the +# given manpath. +# +# You *must* provide all system manpaths, including manpaths for alternate +# operating systems, locale specific manpaths, and combinations of both, if +# they exist, otherwise the permissions of the user running man/mandb will +# be used to manipulate the manual pages. Also, mandb will not initialise +# the database cache for any manpaths not mentioned below unless explicitly +# requested to do so. +# +# In a per-user configuration file, this directive only controls the +# location of catpaths and the creation of database caches; it has no effect +# on privileges. +# +# Any manpaths that are subdirectories of other manpaths must be mentioned +# *before* the containing manpath. E.g. /usr/man/preformat must be listed +# before /usr/man. +# +# *MANPATH* -> *CATPATH* +# +MANDB_MAP /usr/man /var/cache/man/fsstnd +MANDB_MAP /usr/share/man /var/cache/man +MANDB_MAP /opt/local/man /var/cache/man/oldlocal +MANDB_MAP /opt/local/share/man /var/cache/man/local +MANDB_MAP /usr/X11R6/man /var/cache/man/X11R6 +MANDB_MAP /opt/man /var/cache/man/opt +# +#--------------------------------------------------------- +# Program definitions. These are commented out by default as the value +# of the definition is already the default. To change: uncomment a +# definition and modify it. +# +#DEFINE pager less +#DEFINE cat cat +#DEFINE tr tr '\255\267\264\327' '\055\157\047\170' +#DEFINE grep grep +#DEFINE troff groff -mandoc +#DEFINE nroff nroff -mandoc +#DEFINE eqn eqn +#DEFINE neqn neqn +#DEFINE tbl tbl +#DEFINE col col +#DEFINE vgrind +#DEFINE refer refer +#DEFINE grap +#DEFINE pic pic -S +# +#DEFINE compressor gzip -c7 +#--------------------------------------------------------- +# Misc definitions: same as program definitions above. +# +#DEFINE whatis_grep_flags -i +#DEFINE apropos_grep_flags -iEw +#DEFINE apropos_regex_grep_flags -iE +#--------------------------------------------------------- +# Section names. Manual sections will be searched in the order listed here; +# the default is 1, n, l, 8, 3, 0, 2, 3type, 5, 4, 9, 6, 7. Multiple SECTION +# directives may be given for clarity, and will be concatenated together in +# the expected way. +# If a particular extension is not in this list (say, 1mh), it will be +# displayed with the rest of the section it belongs to. The effect of this +# is that you only need to explicitly list extensions if you want to force a +# particular order. Sections with extensions should usually be adjacent to +# their main section (e.g. "1 1mh 8 ..."). +# +SECTION 1 1p n l 8 3 3p 0 0p 2 3type 5 4 9 6 7 +# +#--------------------------------------------------------- +# Range of terminal widths permitted when displaying cat pages. If the +# terminal falls outside this range, cat pages will not be created (if +# missing) or displayed. +# +#MINCATWIDTH 80 +#MAXCATWIDTH 80 +# +# If CATWIDTH is set to a non-zero number, cat pages will always be +# formatted for a terminal of the given width, regardless of the width of +# the terminal actually being used. This should generally be within the +# range set by MINCATWIDTH and MAXCATWIDTH. +# +#CATWIDTH 0 +# +#--------------------------------------------------------- +# Flags. +# NOCACHE keeps man from creating cat pages. +#NOCACHE diff --git a/mkosi.extra/etc/profile.d/99-local-precedence.sh b/mkosi.extra/etc/profile.d/99-local-precedence.sh new file mode 100644 index 0000000..437e535 --- /dev/null +++ b/mkosi.extra/etc/profile.d/99-local-precedence.sh @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL +# SPDX-FileCopyrightText: 2026 Hadi Chokr + +# Setup PATH to let ~/.local and after that /opt/local mask everything +export PATH="$HOME/.local/bin:$HOME/.local/sbin:/opt/local/sbin:/opt/local/bin:$PATH" + +# Prefixes +export LOCAL_PREFIX=/opt/local +export PREFIX=/opt/local +export DESTDIR=/opt/local + +# For .desktop files and systemd +export XDG_DATA_DIRS="$HOME/.local/share:/opt/local/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" +export XDG_CONFIG_DIRS="$HOME/.config:/opt/local/etc/xdg:${XDG_CONFIG_DIRS:-/etc/xdg}" + +# pkgconfig +export PKG_CONFIG_PATH="$HOME/.local/lib/pkgconfig:/opt/local/lib/pkgconfig:/opt/local/share/pkgconfig:${PKG_CONFIG_PATH:-}" diff --git a/mkosi.extra/live/usr/local/bin/calamares b/mkosi.extra/live/opt/local/bin/calamares similarity index 71% rename from mkosi.extra/live/usr/local/bin/calamares rename to mkosi.extra/live/opt/local/bin/calamares index 38b29cb..2ee0f25 100755 --- a/mkosi.extra/live/usr/local/bin/calamares +++ b/mkosi.extra/live/opt/local/bin/calamares @@ -1,9 +1,10 @@ -#!/bin/sh +#!/usr/bin/env bash # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL # SPDX-FileCopyrightText: 2023 Harald Sitter +# SPDX-FileCopyrightText: 2026 Hadi Chokr if [ "$(id -u)" != "0" ]; then - exec pkexec /usr/local/bin/calamares "$@" + exec pkexec /opt/local/bin/calamares "$@" fi export KDE_FULL_SESSION=TRUE diff --git a/mkosi.extra/usr/lib/environment.d/40-kde-linux-local-bin.conf b/mkosi.extra/usr/lib/environment.d/40-kde-linux-local-bin.conf deleted file mode 100644 index e69de29..0000000 diff --git a/mkosi.extra/usr/lib/environment.d/40-kde-linux-path.conf b/mkosi.extra/usr/lib/environment.d/40-kde-linux-path.conf deleted file mode 100644 index 3c11c9c..0000000 --- a/mkosi.extra/usr/lib/environment.d/40-kde-linux-path.conf +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL -# SPDX-FileCopyrightText: 2025 Harald Sitter -# SPDX-FileCopyrightText: 2026 Thomas Duckworth - -# Explicitly set PATH so we always have /usr/local binary paths in front, which we need -# to mask binaries in /usr/bin. -# Also, kde-builder wants .local/bin in the PATH and will fail if it is not. -PATH=$HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin diff --git a/mkosi.extra/usr/lib/systemd/sysext.conf.d/mutable.conf b/mkosi.extra/usr/lib/systemd/sysext.conf.d/mutable.conf new file mode 100644 index 0000000..674a85b --- /dev/null +++ b/mkosi.extra/usr/lib/systemd/sysext.conf.d/mutable.conf @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL +# SPDX-FileCopyrightText: 2026 Hadi Chokr + +[SysExt] +Mutable=auto + diff --git a/mkosi.extra/usr/lib/tmpfiles.d/sysext-trigger.conf b/mkosi.extra/usr/lib/tmpfiles.d/sysext-trigger.conf new file mode 100644 index 0000000..42d2ceb --- /dev/null +++ b/mkosi.extra/usr/lib/tmpfiles.d/sysext-trigger.conf @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL +# SPDX-FileCopyrightText: 2026 Hadi Chokr + +# Will trigger the systemd-sysext.service Condition to merge Extensions +# TODO: Remove when https://github.com/systemd/systemd/issues/40827 is fixed +f /etc/extensions/enable-sysext 0644 root root - diff --git a/mkosi.extra/usr/lib/tmpfiles.d/usr-local.conf b/mkosi.extra/usr/lib/tmpfiles.d/usr-local.conf new file mode 100644 index 0000000..92dbaef --- /dev/null +++ b/mkosi.extra/usr/lib/tmpfiles.d/usr-local.conf @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL +# SPDX-FileCopyrightText: 2026 Hadi Chokr + +# Local admin prefix replacing /usr/local + +d /opt/local 0755 root root - +d /opt/local/bin 0755 root root - +d /opt/local/sbin 0755 root root - +d /opt/local/lib 0755 root root - +d /opt/local/lib64 0755 root root - +d /opt/local/include 0755 root root - +d /opt/local/share 0755 root root - +d /opt/local/share/man 0755 root root - +d /opt/local/share/info 0755 root root - +d /opt/local/share/doc 0755 root root - +d /opt/local/etc 0755 root root - +d /opt/local/games 0755 root root - +d /opt/local/src 0755 root root - +d /opt/local/etc/xdg 0755 root root - +d /opt/local/lib/pkgconfig 0755 root root - +d /opt/local/share/pkgconfig 0755 root root - + +# sysext-routing +d /var/lib/extensions.mutable 0755 root root - +d /var/lib/extensions.mutable/usr 0755 root root - + +# Route /usr/local → /opt/local +L /var/lib/extensions.mutable/usr/local - - - - /opt/local diff --git a/mkosi.extra/usr/share/polkit-1/actions/org.kde.linux.calamares.policy b/mkosi.extra/usr/share/polkit-1/actions/org.kde.linux.calamares.policy index f227c83..a1d048b 100644 --- a/mkosi.extra/usr/share/polkit-1/actions/org.kde.linux.calamares.policy +++ b/mkosi.extra/usr/share/polkit-1/actions/org.kde.linux.calamares.policy @@ -19,7 +19,7 @@ no auth_admin - /usr/local/bin/calamares + /opt/local/bin/calamares true diff --git a/mkosi.finalize.d/40-core.sh.chroot b/mkosi.finalize.d/40-core.sh.chroot index b6426a2..78f803f 100755 --- a/mkosi.finalize.d/40-core.sh.chroot +++ b/mkosi.finalize.d/40-core.sh.chroot @@ -133,6 +133,9 @@ rm -rf \ /usr/lib/modules/*/vdso \ /usr/src/* +## Get rid of /usr/local for /opt/local +rm -rf /usr/local + ## Replace Falkon with Firefox as the default browser, since that's what we pre-install. sed -i 's/org.kde.falkon.desktop/org.mozilla.firefox.desktop/' /usr/share/applications/kde-mimeapps.list