Howto define IP ranges in rules?/script question
Hi, I've installed dozens of computers with autoyast1 and SuSE 7.3 in the last years. Now I need to switch to SuSE 9.0 and try to learn the new autoyast2 interface. However, even after reading the complete html docu for 9.0 and browsing the mailing list archives, I still don't unterstand two things: 1) Is there any way to define IP ranges in rules? In autoyast1 I used to have lines like CLASS 141.84.1.210-240 k_smp in the main info file and info.k_smp would then contain a definition for using the k_smp kernel. In the rules.xml, I only see the hostaddress attribute which must match exactly. I tried a range there, but it did not work. How can I apply a rule to a set/range of ips without specifying each ip? 2) Do I really have to write all the scripts inside a profile? Is itnot possible to just call an external script file? Thanks a lot for any help (especially for the first question, the second is not really that important..) cu, Frank -- Dipl.-Inform. Frank Steiner Mail: fst_at_bio.informatik.uni-muenchen.de Lehrstuhl f. Bioinformatik Mail: frank_at_familiesteiner.de LMU, Amalienstr. 17 Phone: +49 89 2180-4049, Fax: -4054 80333 Muenchen, Germany http://www.informatik.uni-kiel.de/~fst/
Frank Steiner wrote:
Hi,
I've installed dozens of computers with autoyast1 and SuSE 7.3 in the last years. Now I need to switch to SuSE 9.0 and try to learn the new autoyast2 interface.
However, even after reading the complete html docu for 9.0 and browsing the mailing list archives, I still don't unterstand two things:
1) Is there any way to define IP ranges in rules? In autoyast1 I used to have lines like
CLASS 141.84.1.210-240 k_smp
in the main info file and info.k_smp would then contain a definition for using the k_smp kernel.
In the rules.xml, I only see the hostaddress attribute which must match exactly. I tried a range there, but it did not work.
How can I apply a rule to a set/range of ips without specifying each ip?
range is not supported for ips, but thats a good idea and i will try to add it for the upcoming release. To make that happen with 9.0 however, you can always use you own script in the rules which you can match. For example I use this rule to match the boardinfo of my old thinkpad (btw, in 9.1 rules matching diferent smbios data will be be builtin, so you wont need the script) <rule> <custom1> <script> <![CDATA[ #!/bin/sh board=$(hwinfo --bios | grep -A 4 "Board Info" | grep Product | cut -d'"' -f 2 | sed -e "s/[<|>]//g" ) echo -n $board ]]> </script> <match>2628JXU</match> <match_type>exact</match_type> </custom1> <result> <profile>thinkpad.xml</profile> <continue config:type="boolean">false</continue> </result> </rule> So you have to write a script that will output the latest segment of an IP and do a range checking, i,e, on 210-240. so it will result in something like that(not tested): <rule> <custom1> <script> <![CDATA[ #!/bin/sh ip=$(/sbin/ifconfig eth0 | sed -n "s/\(inet\ addr:\)\([0-9.]*\).*/\2/p" | cut -d'.' -f 4) echo -n $ip ]]> </script> <match>210-240</match> <match_type>range</match_type> </custom1> <result> <profile>thinkpad.xml</profile> <continue config:type="boolean">false</continue> </result> </rule> Of course you can add other rules such as these to match the subnet and the network, etc.
2) Do I really have to write all the scripts inside a profile? Is itnot possible to just call an external script file?
Well, you can call an external script from the script themselves, however, you have to make the scripts available to the system somehow and the easiest solution is to include the scripts into the control file. Anas
Thanks a lot for any help (especially for the first question, the second is not really that important..)
cu, Frank
Anas Nashif wrote:
range is not supported for ips, but thats a good idea and i will try to add it for the upcoming release.
To make that happen with 9.0 however, you can always use you own script in the rules which you can match. For example I use this rule to match the boardinfo of my old thinkpad (btw, in 9.1 rules matching diferent smbios data will be be builtin, so you wont need the script) ..
Ok, thanks a lot! That also answers the question from my second mail about the custom scripts. I guessed I had to match the stdout, but somehow it didn't work with a little test script I wrote. Likely I made a little mistake somewhere. I will try again using your examples.
Well, you can call an external script from the script themselves, however, you have to make the scripts available to the system somehow and the easiest solution is to include the scripts into the control file.
Yes, good point, especially for pre-scripts. I will use them this way! Thanks! Best regards, Frank Steiner -- Dipl.-Inform. Frank Steiner Mail: fst_at_bio.informatik.uni-muenchen.de Lehrstuhl f. Bioinformatik Mail: frank_at_familiesteiner.de LMU, Amalienstr. 17 Phone: +49 89 2180-4049, Fax: -4054 80333 Muenchen, Germany http://www.informatik.uni-kiel.de/~fst/
participants (2)
-
Anas Nashif
-
Frank Steiner