Welcome
Welcome to refracta

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

gksu kdesu, tdesu, ktsuss

Stuff that has not yet gone into the official build.

gksu kdesu, tdesu, ktsuss

Postby fsmithred » Wed Oct 22, 2014 11:58 am

What are the correct paths to all of these? Or maybe just use $(which blah) and not worry about the path.

Here's a sample wrapper script for refractasnapshot-gui that should eliminate the dependency on gksu or other graphical frontend to su/sudo.
Code: Select all
#!/usr/bin/env bash
#
# Wrapper for refractasnapshot-gui

#command="/usr/bin/refractasnapshot-gui"
command="blkid"

# I hope nobody uses this, but it's here
# in case you're running a root xsession.
if [[ $(id -u) -eq 0 ]] ; then
   "$command"
   exit 0
fi

# This will be used to test for sudo nopasswd.
sudo_allowed=$(sudo -n uptime 2>&1 | grep load | wc -l)

if [[ -e /usr/bin/gksu ]] ; then
   gksu "$command"
elif
   [[ -e /usr/bin/kdesu ]] ; then
   kdesu "$command"
elif
   [[ -e /usr/bin/kdesudo ]] ; then
   kdesudo "$command"
elif
   #another way to do it
   [[ -e $(which tdesu) ]] ; then
   tdesu "$command"
elif
   [[ -e $(which ktsuss) ]] ; then
   ktsuss "$command"
elif
   # for xudo with no password
   [[ $sudo_allowed -ne 0 ]] ; then
      sudo "$command"
elif
   # for sudo with password
   $(groups $USER | grep -qs sudo); then
   xterm -fa mono -fs 12 -hold -e  "sudo $command"
else
   xterm -fa mono -fs 12 -hold -e su -c "$command"
fi

exit 0

User avatar
fsmithred
 
Posts: 2089
Joined: Wed Mar 09, 2011 9:13 pm

Re: gksu kdesu, tdesu, ktsuss

Postby thwak » Wed Oct 22, 2014 5:00 pm

I've typed this to check (not in the context of a script, though) then press enter to exit without changes
Code: Select all
sudo update-alternatives --config gksu
thwak
 
Posts: 174
Joined: Tue Nov 20, 2012 3:58 am

Re: gksu kdesu, tdesu, ktsuss

Postby dzz » Wed Oct 22, 2014 6:14 pm

$(which blah) should generally be fine but opt/trinity/bin/tdesu might not show up (at least for root) in $PATH .. use the full path. Not sure about kdesu http://forums.debian.net/viewtopic.php?f=16&t=40158

Need to review the licence for ktsuss, it's similar to but not actually GPL. I posted a (monster 33 KB) deb: http://exegnulinux.net/refracta/experim ... 1_i386.deb

I would really prefer a more "generic" (non-DE-specific) method which does not alienate users with limited cli skills. X for root (e.g.yad), as mentioned earlier, is likely to be an issue.
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: gksu kdesu, tdesu, ktsuss

Postby fsmithred » Wed Oct 22, 2014 6:55 pm

I may just go with xterm. When I ran snapshot from the menu and didn't get a terminal, I missed it. Most of the time, I run the gui script from command line, because I'm using a different config file, so that the config file that goes into the iso is the default, instead of with all my changes. (filename, compression, save_work, and maybe something else.) And I like being able to see that progress bar for mksquashfs. It lets me know roughly how many other things I can do before it's finished.

And if the wrapper script can't guess correctly whether the user uses su, sudo with password or sudo without password, there can be an error message that says "Run this with root privs, however you get them."
User avatar
fsmithred
 
Posts: 2089
Joined: Wed Mar 09, 2011 9:13 pm


Return to Experimental

Who is online

Users browsing this forum: No registered users and 1 guest

cron
suspicion-preferred