Much information custom rules
Hi ,
I didn't manage to find much information about the custom rules in the
autoyast file.
How they have to be written? I saw that they are shell scripts but what
do they have to return ( as a return value of the process ) and
actually does it matter .
I saw in modules/AutoInstallRules.ycp that they use the stdout for
communication with the parent process but what exactly it they have to
write on it. I am not very good in this YCP so I am not sure whether I
understood everything very well. So does someone have experience with
custom rules and have few minutes to explain me.
Thanks in advance.
I forgot to mention that I use SLES 9 if it does matter.
Regards,
Pavlin Maslyankov
"Tumbleweed E-mail Firewall
On Friday 03 June 2005 10:58, Pavlin Maslyankov wrote:
I didn't manage to find much information about the custom rules in the autoyast file. How they have to be written?
here is a quick example that hopefully explains it a little bit. I needed it
(plus some more custom rules) for a very special project where a hardware
could have sda or hda devices but nothing else. This rule will fetch either
"classes/sda.xml" or "classes/hda.xml" and will merge that file with all
rules that follow (none in this example).
I hope this helps you to understand.
<?xml version="1.0"?>
<autoinstall xmlns="http://www.suse.com/1.0/yast2ns"
xmlns:config="http://www.suse.com/1.0/configns">
<rules config:type="list">
<rule>
<custom1>
<script>
<![CDATA[
if grep hda /proc/partitions > /dev/null; then
echo -n "hda"
else
echo -n "sda"
fi;
]]>
</script>
<match>*</match>
Hi Uwe, Thank you very much for the information. I have one additional question. First of all I want to explain you what I am exactly trying to do . I am trying to create a custom rule that returns the instmode value. And depending on it I want to create result files with suffixes _$instmode ( for example partitioning_hd.xml ). And I also want to have default one file ( for example partitioning.xml ) . Do you have any idea how I can put that in the rules.xml file. I thought about something like putting the partitioning.xml file in the unconditioned and after that adding the rule that looks like the one you proposed me with partitioning_@custom1@.xml . But I am not sure what happens if the result file doesn't exist. If nothing happens this will resolve my problem because the default file will be overwritten during the merge with the customized one but only if it exists. So my question is what is going on when the result file doesn't exist. Regards, Pavlin Uwe Gansert wrote:
On Friday 03 June 2005 10:58, Pavlin Maslyankov wrote:
I didn't manage to find much information about the custom rules in the autoyast file. How they have to be written?
here is a quick example that hopefully explains it a little bit. I needed it (plus some more custom rules) for a very special project where a hardware could have sda or hda devices but nothing else. This rule will fetch either "classes/sda.xml" or "classes/hda.xml" and will merge that file with all rules that follow (none in this example). I hope this helps you to understand.
<?xml version="1.0"?> <autoinstall xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> <rules config:type="list"> <rule> <custom1> <script> <![CDATA[ if grep hda /proc/partitions > /dev/null; then echo -n "hda" else echo -n "sda" fi; ]]> </script> <match>*</match>
exact </custom1> <result> <profile>classes/@custom1@.xml</profile> <continue config:type="boolean">true</continue> </result> </rule> </rules> </autoinstall>
"Tumbleweed E-mail Firewall
participants (3)
-
Pavlin Maslyankov
-
Pavlin Maslyankov
-
Uwe Gansert