for users of fglrx driver
Abdullah Ramazanoglu
ar018 at yahoo.com
Thu Aug 10 14:30:15 UTC 2006
Donatas G. dedi ki:
> Abdullah Ramazanoglu wrote:
--8<--
Sorry for late reply. I was offline.
> Hey, that was a nice faq, it's great that it will continue. You can
> surely use fglrxKonf in any way that would be useful for the Kubuntu
> community.
Thanks & thanks :)
>> @# Check if we're root (run in administrative mode)
>> @# or not (abort or run in browser mode).
>> @if(@exec(id -u))
>> @switch(@Message.warning("You need to run this as root. If you are an
>> administrative user, please click the [I'm a Super User]
>> button.", Need root privileges, "I'm a Super User", Continue
>> anyway, Abort))
>
> Thanks for the script, where can I learn about these scripts? I could
> not find any manual for it. Is it the new parser? Does not look like
> it... My Kommander scripts mainly consist of bash, but some of the
> things are very hard to do with bash plus plain widget values and the
> old parser...
It's old parser and I'm afraid there's not much documentation for it. The ones I've used are:
http://hektor.umcs.lublin.pl/~mikosmul/computing/articles/kommander-introduction.html
http://www.kde.me.uk/index.php?page=kommander-tutorial
help:/kommander/
Finally, lots of trial-errors.
> Therefore i am not quite sure how to transform your example into
> something like this:
>
> if `id -u` = 0
> then set certain globals
> else set other globals
> endif
IIRC there'no "else" in old parser - just plain if/endif.
There's switch/case/case/.../end structure, but it may need a bit tweaking to work in the example above.
Also presetting certain variables before "if", like below, might work?
set certain globals
reset other globals
@if(@exec(id -u))
reset certain globals
set other globals
@endif
>From what I've learned from trial-errors, a crucial point with old parser is that there are two separate logic flows: Logic flow of Kommander, which is controlled by "@" statements and which is in sync with GUI. And logic flow of the shell script spooled to batch, which is comprised of direct shell commands (without @), and which are run literally in spool-to-batch fashion. The logic flow within this batch script is consistent within itself, but it's completely separate and parallel to Kommander logic flow.
So, to prevent confusion I try follow this rule of thumb:
Within each kommander script either stick to batch-spooled direct shell commands, or stick to "@" prefixed commands, but don't mix the two within the same script.
So, AFAIK the if/endif example above will not work as intended if "set" and "reset" commands are direct shell commands.
Hope it's useful. (And hope it's correct...) :)
Regards,
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
More information about the kubuntu-users
mailing list