Page 1 of 1
ktsuss - revision to gksu script
Posted: 5. Jul 2010, 17:01
by pwatk
This is my gksu script that I used to use with slackware:
Code: Select all
#!/bin/sh
# /usr/bin/gksu
PATH="${PATH}:/sbin:/usr/sbin:/usr/local/sbin"
CMD="$@"
BIN="$1"
if [ -x "`type -path ktsuss`" ]; then
KTSUSS="`type -path ktsuss` -u root"
else
echo "$(basename $0): \`ktsuss' command not found"
exit 1
fi
if [ "$UID" = "0" ]; then
KTSUSS=""
fi
if [ -x "`type -path $BIN`" ]; then
eval $KTSUSS $CMD
else
echo "$(basename $0): \`$BIN' command not found"
exit 1
fi
I would like to see it included in the next ktsuss package as it is (without trying to cause offense) a little bit more robust than the current script and it will work with pcmanfm (if the option to 'open as root' isn't patched out that is).
Thanks
Re: ktsuss - revision to gksu script
Posted: 5. Jul 2010, 17:11
by Shador
If variables are quoted properly I don't mind. Currently it would fail for such stuff: "gksu ls '/space/in here/'"
From my ccache wrapper script:
That's where I learned it the hard way, when audacity failed because of properly quoted spaces in their command lines.
Re: ktsuss - revision to gksu script
Posted: 5. Jul 2010, 17:31
by pwatk
I think that was actually part of the reason behind me making this script. Eval solves most of the problems (including pcmanfm) but I agree this might be better:
That said, my script isn't really geared towards launching commands outside of the system path so the script would exit with an error if you ran
gksu ~/silly dir name/script.sh for example.
On the other hand, the current script bombs if you run it as root... spot the deliberate mistake:
Code: Select all
#!/bin/sh
export PATH="${PATH}:/sbin:/usr/sbin"
if [ "$(id -u)" = "0" ]; then
KTSUSS=""
else
KTSUSS=/usr/bin/ktsuss
fi
$KTSUSS -u root "$@"
Re: ktsuss - revision to gksu script
Posted: 5. Jul 2010, 17:59
by gapan
Ouch. Is that our ktsuss script? It sucks.
Thanks, I'll take a look.
Re: ktsuss - revision to gksu script
Posted: 5. Jul 2010, 19:33
by gapan
Updated packages are in the repositories. Thanks pwatk.
Re: ktsuss - revision to gksu script
Posted: 5. Jul 2010, 21:32
by pwatk
gapan wrote:Ouch. Is that our ktsuss script? It sucks.
Thanks, I'll take a look.
Well I didn't want to put it quite like that
gapan wrote:Updated packages are in the repositories. Thanks pwatk.
It's nice to be able to contribute.
Shador got me thinking though, maybe it would be useful to be able to launch commands outside the system path. If I get sometime I might try to add that in.
Re: ktsuss - revision to gksu script
Posted: 5. Jul 2010, 21:44
by Shador
pwatk wrote:Shador got me thinking though, maybe it would be useful to be able to launch commands outside the system path. If I get sometime I might try to add that in.
Can't you already? At least this one worked (with the freshly installed ktsuss package):
If it's about supporting ~ and possibly other expansion, I don't think that's feasible. You have to expect that it's expanded as root (in fact I sometimes use that behaviour intentionally), so we we shouldn't change that.
Re: ktsuss - revision to gksu script
Posted: 5. Jul 2010, 22:50
by pwatk
So it does, I thought it would bomb out.. cool, thanks
Edit: I'm a fool, of course it would work, I'm already providing the path
