Re: Question about network

Thomas Fehr <[email protected]> Sat, 29 Nov 2014 11:32:55 +0100
Newsgroups gmane.linux.suse.autoinstall
Message-ID <[email protected]>
On Sat, Nov 29, Achim Klausmann wrote:

> Am 28.11.2014 um 10:34 schrieb Simon Crute:
>> You could probably use a pre script to identify the mac address and plug
>> it into the xml file.
> How would this look like?

Pre-Scripts can be used to modify the autoinst.xml file.
If autoyast detects modified xml file after secution of pre script,
it read the modified file and uses it. So you could have a template 
as mac address in your xml file and let pre-script replace template 
by real mac address of system

They are explained in chapter 4.16.1 of 
http://doc.opensuse.org/projects/autoyast

Here is an example of a pre script that replaces /dev/sdx in
partitioning section of autoinstall.xml by a disk of appropriate
size in the system. Similar stuff could be done to modify
mac address.

-------------------------------------------------------
<pre-scripts config:type="list">
  <script>
    <debug config:type="boolean">true</debug>
    <filename>pre_script</filename>
    <interpreter>shell</interpreter>
    <source><![CDATA[
#!/bin/bash
DISK=""
for i in /sys/block/sd*
do
    SIZE=`cat $i/size`
    if [ -z "$DISK" -a $SIZE -gt 20971520 -a $SIZE -lt 41943040 ]
    then
        DISK=/dev/`echo $i | sed "s:^.*/::"`
    fi
done
[ -z "$DISK" ] && DISK=/dev/sda
sed "/device.*dev.sdx/s:/dev/sdx:$DISK:" </tmp/profile/autoinst.xml
>/tmp/profile/modified.xml
       ]]></source>
  </script>
</pre-scripts>
</scripts>
-------------------------------------------------------


Tschuess, 
	Thomas Fehr
-- 
  Thomas Fehr, SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany
  GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 21284 (AG Nürnberg)
  Tel: +49-911-74053-0,  Fax: +49-911-74053-482,  Email: [email protected]
  GPG public key available.
-- 
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]