I even can't create any files during pre. <div>Thanks for help<span></span><br><br>On Monday, April 11, 2016, William H. ten Bensel <<a href="mailto:WHTENBEN@up.com">WHTENBEN@up.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font size="2" face="sans-serif">Hopefully this example will help.  
You should be able to configure your hostname logic like the following:</font><br><br><font size="2" face="sans-serif">We had to do the following with CentOS
7.2 and Oracle Linux 7.2, because there is a bug with how the static --network
line is being generated.  (Bug opened with support and they have confirmed).
 </font><br><br><font size="2" face="sans-serif">Systems -> Kickstarts -> Profiles
-> {profile} -> Kickstart Details -> Advanced Options -> Custom
Options:</font><br><font size="2" face="sans-serif">        %include
/tmp/network.out</font><br><br><font size="2" face="sans-serif">Systems -> Kickstarts -> Profiles
-> {profile} -> Scripts:</font><br><font size="2" face="sans-serif"><br>Name: Static_BUG </font><br><font size="2" face="sans-serif">$SNIPPET('spacewalk/1/72network_bug')</font><br><font size="2" face="sans-serif">Pre-Script</font><br><font size="2" face="sans-serif"><b>Check template --> Do not forget
this, or it will not work.  </b></font><br><br><br><tt><font size="3">%pre --log /tmp/ks-pre.log.1<br># BEGIN: network Snippet<br># Issue with CentOS 7.2, not able to handle just network --bootproto static<br></font></tt><br><tt><font size="3"># Get the static information that was passed during
anaconda.<br>cat /proc/cmdline > /tmp/cmdline.out<br><br>server_ip=`awk -F"ip=" '{print $2}' /tmp/cmdline.out |awk '{print
$1}'|awk -F":" '{print $1}'`<br>server_gw=`awk -F"ip=" '{print $2}' /tmp/cmdline.out |awk '{print
$1}'|awk -F":" '{print $3}'`<br>server_nm=`awk -F"ip=" '{print $2}' /tmp/cmdline.out |awk '{print
$1}'|awk -F":" '{print $4}'`<br>server_host=`awk -F"ip=" '{print $2}' /tmp/cmdline.out |awk '{print
$1}'|awk -F":" '{print $5}'`<br>server_dns=`awk -F"nameserver=" '{print $2}' /tmp/cmdline.out
|awk '{print $1}'`<br><br>if [[ -n "$server_host" ]]; then<br>cat <<_EOF >/tmp/network.out<br><br>network --noipv6 --onboot=yes --bootproto static --ip=$server_ip --netmask=$server_nm
--gateway=$server_gw --nameserver=$server_dns --hostname=$server_host --device=link
--activate<br>_EOF<br><br># Another snippet will handle hostname, /etc/hostname, /etc/hosts, /etc/sysconfig/network,
and/or</font></tt><br><tt><font size="3"># /etc/sysconfig/network-scripts/ifcfg-* if it is
not passed here. </font></tt><br><tt><font size="3"># That script most come prior to Registration and
Activation!!<br>else<br>cat <<_EOF >/tmp/network.out<br></font></tt><br><tt><font size="3"><br>network --noipv6 --onboot=yes --bootproto static --ip=$server_ip --netmask=$server_nm
--gateway=$server_gw --nameserver=$server_dns --device=link --activate<br>_EOF<br><br>fi<br><br># END: network Snippet</font></tt><br><br><br><br><p><font size="2" face="sans-serif">- Thanks and good luck</font><br><br><br><br><font size="1" color="#5f5f5f" face="sans-serif">From:      
 </font><font size="1" face="sans-serif">Konstantin Raskoshnyi
<<a href="javascript:_e(%7B%7D,'cvml','konrasko@gmail.com');" target="_blank">konrasko@gmail.com</a>></font><br><font size="1" color="#5f5f5f" face="sans-serif">To:      
 </font><font size="1" face="sans-serif"><a href="javascript:_e(%7B%7D,'cvml','spacewalk-list@redhat.com');" target="_blank">spacewalk-list@redhat.com</a></font><br><font size="1" color="#5f5f5f" face="sans-serif">Date:      
 </font><font size="1" face="sans-serif">04/11/2016 07:42 PM</font><br><font size="1" color="#5f5f5f" face="sans-serif">Subject:    
   </font><font size="1" face="sans-serif">Re: [Spacewalk-list]
PRE Section doesn't work at all KVM Guest</font><br><font size="1" color="#5f5f5f" face="sans-serif">Sent by:    
   </font><font size="1" face="sans-serif"><a href="javascript:_e(%7B%7D,'cvml','spacewalk-list-bounces@redhat.com');" target="_blank">spacewalk-list-bounces@redhat.com</a></font><br></p><hr noshade><br><br><br><font size="3">This email originated from outside of the company. Please
use discretion if opening attachments or clicking on links.</font><hr><font size="3"> </font><p><font size="3">After installation there's no file </font><font size="2">pre_install_network_config
in tmp directory..</font><br><br><font size="2">May be nochroot can help?</font><br><br><font size="3">On Mon, Apr 11, 2016 at 5:13 PM, Colin Coe <</font><a href="javascript:_e(%7B%7D,'cvml','colin.coe@gmail.com');" target="_blank"><font size="3" color="blue"><u>colin.coe@gmail.com</u></font></a><font size="3">>
wrote:</font><br><font size="3">Are you including that file?</font><br><br><font size="2">The following will need to be in your kickstart...</font><br><font size="2">%include /tmp/pre_install_network_config</font><br><br><font size="3">On Tue, Apr 12, 2016 at 8:03 AM, Konstantin Raskoshnyi
<</font><a href="javascript:_e(%7B%7D,'cvml','konrasko@gmail.com');" target="_blank"><font size="3" color="blue"><u>konrasko@gmail.com</u></font></a><font size="3">>
wrote:</font><br><font size="3">Stuck on this problem - I wanted to set up hostname for
KVM machine on pre,</font><br><br><font size="3">ok - I spent 3 days, but in fact ks ignore all pre sections...</font><br><br><font size="3">also I found that Spacewalk trying to set hostname by
itself, here the text from anakonda.cfg</font><br><br><font size="3"># Start of code to match cobbler system interfaces to
physical interfaces by their mac addresses</font><br><font size="3">#  Start eth0</font><br><font size="3"># Configuring eth0 (00:16:3e:53:0e:0d)</font><br><font size="3">if mac_exists 00:16:3e:53:0e:0d</font><br><font size="3">then</font><br><font size="3">  get_ifname 00:16:3e:53:0e:0d</font><br><font size="3">  echo "network --device=$IFNAME --bootproto=dhcp
--hostname=virttest001" >> /tmp/pre_install_network_config</font><br><font size="3">fi</font><br><br><font size="3">But no logs, no errors, no other stuff. Also no my pre
scripts in /tmp directory </font><br><br><br><font size="3">Any thoughts?</font><br><br><font size="3">_______________________________________________<br>Spacewalk-list mailing list</font><font size="3" color="blue"><u><br></u></font><a href="javascript:_e(%7B%7D,'cvml','Spacewalk-list@redhat.com');" target="_blank"><font size="3" color="blue"><u>Spacewalk-list@redhat.com</u></font></a><font size="3" color="blue"><u><br></u></font><a href="https://www.redhat.com/mailman/listinfo/spacewalk-list" target="_blank"><font size="3" color="blue"><u>https://www.redhat.com/mailman/listinfo/spacewalk-list</u></font></a><br><br><font size="3"><br>_______________________________________________<br>Spacewalk-list mailing list</font><font size="3" color="blue"><u><br></u></font><a href="javascript:_e(%7B%7D,'cvml','Spacewalk-list@redhat.com');" target="_blank"><font size="3" color="blue"><u>Spacewalk-list@redhat.com</u></font></a><font size="3" color="blue"><u><br></u></font><a href="https://www.redhat.com/mailman/listinfo/spacewalk-list" target="_blank"><font size="3" color="blue"><u>https://www.redhat.com/mailman/listinfo/spacewalk-list</u></font></a><br><tt><font size="2">This email originated from outside of the company.
 Please use discretion if opening attachments or clicking on links.<br><br>_______________________________________________<br>Spacewalk-list mailing list<br><a href="javascript:_e(%7B%7D,'cvml','Spacewalk-list@redhat.com');" target="_blank">Spacewalk-list@redhat.com</a><br></font></tt><a href="https://www.redhat.com/mailman/listinfo/spacewalk-list" target="_blank"><tt><font size="2">https://www.redhat.com/mailman/listinfo/spacewalk-list</font></tt></a><br><br>
<br>
<br>
**<br>
<br>
<br>
<br>
This email and any attachments may contain information that is confidential and/or privileged for the sole use of the intended recipient.  Any use, review, disclosure, copying, distribution or reliance by others, and any forwarding of this email or its contents, without the express permission of the sender is strictly prohibited by law.  If you are not the intended recipient, please contact the sender immediately, delete the e-mail and destroy all copies.<br>
<br>
**<br></p><p></p></blockquote></div>