Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kdesu: provide a script in bin and look for daemon first in /run/wrappers/bin #93306

Merged
merged 4 commits into from Aug 27, 2020
Merged

kdesu: provide a script in bin and look for daemon first in /run/wrappers/bin #93306

merged 4 commits into from Aug 27, 2020

Conversation

romildo
Copy link
Contributor

@romildo romildo commented Jul 16, 2020

Motivation for this change

If looking for the kdesud first in libexec, the eventually wrapped one in /run/wrappers/bin can not be found. With this change it becomes possible to use a wrapped version of the daemon.

Also a shell script is installed at ${plasma-5.kde-cli-tools}/bin/to ease launchingkdesu`.

Fixes #28426.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@romildo romildo requested a review from ttuegel July 16, 2020 21:52
@romildo
Copy link
Contributor Author

romildo commented Jul 16, 2020

One still has to add something like the following in the system configuration in order to be able to use the kdesu daemon.

  security.wrappers.kdesud = {
    source = "${pkgs.kdesu}/libexec/kf5/kdesud";
    setgid = true;
  };

@@ -0,0 +1,38 @@
From 01af4d2a098e5819c09bca37568941dcd4b89d0b Mon Sep 17 00:00:00 2001
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a directory for kdesu in kde-frameworks and move this patch there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -11,4 +11,5 @@ mkDerivation {
buildInputs = [ kcoreaddons ki18n kpty kservice qtbase ];
propagatedBuildInputs = [ kpty ];
outputs = [ "out" "dev" ];
patches = [ ./kdesu-search-for-wrapped-daemon-first.patch ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this file to .../kde-frameworks/kdesu/default.nix and update kde-frameworks/default.nix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

pkgs/desktops/plasma-5/kde-cli-tools.nix Outdated Show resolved Hide resolved
@ofborg ofborg bot requested a review from ttuegel July 19, 2020 19:52
Comment on lines 15 to 20
cat > $out/bin/kdesu <<EOF
#! /bin/sh -e
export PATH="\''${PATH}:${kinit}/bin"
exec -a "\$0" $out/libexec/kf5/kdesu "\$@"
EOF
chmod +x $out/bin/kdesu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preferred way to do this is:

Suggested change
cat > $out/bin/kdesu <<EOF
#! /bin/sh -e
export PATH="\''${PATH}:${kinit}/bin"
exec -a "\$0" $out/libexec/kf5/kdesu "\$@"
EOF
chmod +x $out/bin/kdesu
makeWrapper $out/libexec/kf5/kdesu $out/bin/kdesu \
--suffix PATH : ${lib.getBin kinit}/bin

This requires makeWrapper in nativeBuildInputs.

Copy link
Contributor Author

@romildo romildo Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have wrapped kdesu in libexec and then created a symbolic link to the wrapper in bin.

@ofborg ofborg bot requested a review from ttuegel July 20, 2020 16:57
If looking first in libexec, the eventually wrapped one in
/run/wrappers/bin can not be found.

This allows wrapping the daemon so that it can be run with sgid
privileges.
@romildo
Copy link
Contributor Author

romildo commented Aug 20, 2020

Changed to avoid double wrapping kdesu.

@romildo
Copy link
Contributor Author

romildo commented Aug 25, 2020

@ttuegel can this be merged?

Copy link
Member

@ttuegel ttuegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@ttuegel ttuegel merged commit d9dddc2 into NixOS:master Aug 27, 2020
@ttuegel
Copy link
Member

ttuegel commented Aug 27, 2020

Thanks! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Installing kdesu
2 participants