Finding kdesu binary

Andrius Štikonas andrius at stikonas.eu
Fri Jan 29 16:41:01 UTC 2016


2016 m. sausio 29 d., penktadienis 17:30:32 GMT Aleix Pol rašė:
> On Fri, Jan 29, 2016 at 5:03 PM, Andrius Štikonas <andrius at stikonas.eu> wrote:
> >> On Fri, Jan 29, 2016 at 3:33 PM, Andrius Štikonas <andrius at stikonas.eu> wrote:
> >> > Hi,
> >> >
> >> > I would like to ask how do I find kdesu binary from the code (of partitionmanager).
> >> >
> >> > PartitionManager tries to restart itself with root privileges and tries to rerun itself with kdesu, kdesudo or gksu...
> >> > However, KF5 based kdesu is now in libexec, something like
> >> > /usr/lib64/libexec/kf5/kdesu
> >> > but it varies from distribution to distribution and not in $PATH.
> >> >
> >> > Is there a way to find the location in the cross-platform way? There is kf5-config --path libexec but it is from kdelibs4support
> >> > and it's better not to depend on kdelibs4support.
> >>
> >> If I understand correctly, you should use the KSu framework for that.
> >> kdesu is not public API, that's why it's in libexec.
> >>
> >> Aleix
> >
> > Hmm, but KSu framework does not have any GUI. And it is only used by
> > kdesu binary itself and krunner_shell library.
> >
> > I would basically have to reimplement kdesu password dialog. Isn't this a bit inefficient?
> > Especially, when kdesu dialog is already shown automatically if partitionmanager
> > is launched from menu.
> 
> Ah yes, you are right, kdesu is in kde-cli-tools. My apologies.
> 
> You can access the libexec install dir like done in discover and
> desktopexecparser [1].
> 
> Basically you need to pass the libexec directory from cmake:
> target_compile_definitions(YourTarget PRIVATE
> -DCMAKE_INSTALL_FULL_LIBEXECDIR_KF5=\"${CMAKE_INSTALL_FULL_LIBEXECDIR_KF5}\")
> 
> And then summon it as a full path: CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/kdesu".
> 
> HTH,
> Aleix
> 
> [1] https://lxr.kde.org/ident?_i=kdesu&_remember=1
> _______________________________________________
> Kde-frameworks-devel mailing list
> Kde-frameworks-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
> 

Thanks a lot! Works perfectly.

Andrius

-- 
I encourage the use of end to end email encryption

GPG key:   https://stikonas.eu/andrius.asc
Fingerprint:  1EE5 A320 5904 BAA2 B88C 0A9D 24FD 3194 0095 C0E1



More information about the Kde-frameworks-devel mailing list