On 4/2/07, Thomas Bächler <thomas@archlinux.org> wrote:
error handling: if you do something wrong, there will be no "parse error" message, but just weird things happening. And - of course - if a third party has rights to change config files, they could exploit that easily.
Depends on the error, if you miss a 'then' on an if, yeah, you'll get an error, but other things, it's not an error, just a different result :) But I know what you mean. Third party and config files is not bash specific. By nature, /etc/network.d is root writable only, although making it root only readable may be a good idea too to hide network keys.
That is great. IMO, the disadvantage here is that we need several configuration files for them .... Do you know a cool bash-parsable configuration file layout where we could put them into one file?
Arrays is the only thing I can think of, PROFILE='multi' KEY[0]=something CONNECTION[0]='somehing else' Or... CONNECTION="multi" HOME_CONNECTION="wireless" HOME_KEY="sdasdsa" WORK_CONNECTION="ethernet" WORK_IP="dsaomdsadas" NETWORKS=(HOME WORK) Or.......... my dream setup, ala bsd home="connection wireless key 12346 interface ipw0" main="connection multi childs home,work " but it's very nasty to parse -- not impossible though, I have done it in experiments -- and involves wrapping all of the iwconfig and ifconfig options to acheive an equivalent functionality level. wrapping that many is icky.
If you say that the network scripts are nicely implemented, then I believe you and will indeed look at them more carefully tonight (I was just too tired yesterday, so I added my thoughts and didn't read the latest version of the scripts).
I hope they're nicely implemented, but i'm hardly one to judge my own code :) It does have it's faults.
That would be worth looking into.
Further thoughts, and implementation idea: I thought about an ini style config. That could work *really* well. I don't want to drop the bash side of these either, it'll be too long before we see something new, and these work well, I havn't picked up any new bugs for a few days now... not to say they don't exist. So... a Csomething based parser of ini files. Would be totally awesome. [main] connection=wireless key=something security=super Orr.... another file.... ------ [main] connection=multi profiles=home something else [home] connection=wireless [something] connection=ethernet ------- .... and you get the idea. If I could run: netini main.connection and get the value from the ini file, I'll rewrite these netscripts in a night and they will work far better, and the codebase will be far better. I *could* write such a thing in python pretty quickly but I can see people not liking that. Which is fair enough. If this config file form is agreeable... i could write an interim python one and implement that until either I mess around with C or someone else writes one... ini shouldn't be difficult given it's ubiquity, so there' probably existing parsers. otherwise... any other format suggestions are welcome. Thoughts? James -- iphitus // Arch Developer // kernel26beyond // iphitus.loudas.com