257.65. kdesu-6.31.0
KDE Frameworks: running programs as another user through sudo
6.31.0-1 · GPL-2.0-only AND LGPL-2.0-or-later · 0.8 SBU · 330.5 KiB, 29 files · 43_toolkits, 196 of 344 · ports/core/kf6/kdesu
Homepage: https://invent.kde.org/frameworks/kdesu
Why it is in KDOS. The comment above the 61 ports from karchive to kfilemetadata in script/phases/43_toolkits/packages.d/kf6.txt:
The libraries KDE applications are built on, without Plasma.
KDESu runs a program as another user, root by default, from a KDE program: it drives sudo (or su, or doas) on a pseudo-terminal from kpty, answers its password prompt with the password the user typed into a dialog, and starts the program through kdesu_stub, which passes on the environment the program needs. The kdesu command of kde-cli-tools is its front end.
Depends on: cmake, ninja, extra-cmake-modules, qt6-qtbase, kconfig, kcoreaddons, ki18n, kpty, libX11, sudo.
Required by (2): kde-cli-tools, konqueror.
Sources: kdesu-6.31.0.tar.xz (56.1 KiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/43_toolkits/phase.env && kpkg install kdesu'
build.sh:
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D KDE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
-D BUILD_TESTING=OFF \
-D KF_SKIP_PO_PROCESSING=ON \
-D KDESU_USE_SUDO_DEFAULT=ON \
-D KDESU_USE_DOAS_DEFAULT=OFF \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
-D KDESU_USE_SUDO_DEFAULT=ON— Usesudoas the default backend, which asks for the user’s own password. The installer locks the root account by default and makes the first user a member ofwheel, which sudo’s policy lets run anything (see The pages), so upstream’s default,su, would ask for a root password that does not exist. sudo is independsfor it.-D KDESU_USE_DOAS_DEFAULT=OFF— Do not makedoasthe default; upstream refuses a configure that asks for both, and this states which one the recipe chose.-D KF_SKIP_PO_PROCESSING=ON— Build none of the gettext catalogues underpo/, whichki18n_install()would compile into.mofiles. The strings in the source are English, and the package-wide English-only rule (see Size and language policy) would remove every catalogue in another language.
Libraries: libKF6Su.so.
Directories: /usr/include/KF6/KDESu, /usr/lib/cmake/KF6Su, /usr/share/licenses/kdesu.
The configure looks for libX11 as optional and, finding it, lets kdesu_stub pass the X authority on to the program it starts, for a program that runs under Xwayland; libX11 is in depends so that this is always built.
The password exchange needs sudo to print nothing before its prompt: KDESu takes the first line that ends in a colon with nothing after it for the prompt. sudo is built --without-lecture for this; a lecture in front of the prompt fails every attempt as a wrong password.