<div dir="ltr">Set the hostname by making a tmp file with the 'network' kickstart command in the %pre script like this:<br> echo "network --device=ens192 --hostname=${HOSTNAME}" > /tmp/ks-network-hostname<br><div><div>then include that file in the kickstart commands section of the file like this:<br> %include /tmp/ks-network-hostname<br><br></div><div>Overwriting the files like you're doing is a blunt instrument and is sure to fail at some point (like you're seeing). Use the kickstart commands as much as possible so anaconda can do the right thing. I also treat every major release as a *major* release, which requires a complete review and rewrite to adapt to whatever changes were made.<br><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>❧ Brian Mathis<br></div>@orev<br></div></div></div>
<br><br><div class="gmail_quote">On Thu, Apr 30, 2015 at 2:53 PM, James Sumners <span dir="ltr"><<a href="mailto:james.sumners@gmail.com" target="_blank">james.sumners@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have a post script to set network configurations that gets used in all of my kickstarts:<div><br></div><div>```</div><div><div>exec 6<&1</div><div>exec > /etc/sysconfig/network</div><div>cat <<HERE_DOC</div><div>NETWORKING=yes</div><div>HOSTNAME=$HOSTNAME</div><div>GATEWAY=$GATEWAY</div><div>HERE_DOC</div><div>exec 1<&6</div></div><div>```</div><div><br></div><div>Works great with RHEL 5/6, but since RHEL 7 switched to systemd not so much (due to hostnamectl [a totally unnecessary change]). According to the documentation[1], I should only have to put my hostname in `/etc/hostname`. So I added this to my post script:</div><div><br></div><div>```</div><div><div>cat /etc/redhat-release 1>/dev/null | grep "release 7"</div><div>if [ \$? -eq 0 ]; then</div><div># RHEL 7</div><div>echo "Enabling RHEL 7 hostname"</div><div>exec 6<&1</div><div>exec > /etc/hostname</div><div>cat <<HERE_DOC</div><div>$HOSTNAME</div><div>HERE_DOC</div><div>exec 1<&6</div><div>fi</div></div><div>```</div><div><br></div><div>The "Enabling RHEL 7 hostname" doesn't get written to the kickstart post log, and the hostname doesn't get written to `/etc/hostname`.</div><div><br></div><div>Does anyone have a method for doing this?</div><div><br></div><div>[1] -- <a href="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Migration_Planning_Guide/sect-Red_Hat_Enterprise_Linux-Migration_Planning_Guide-System_Management.html#sect-Red_Hat_Enterprise_Linux-Migration_Planning_Guide-System_Management-Hostname_Definition" target="_blank">https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Migration_Planning_Guide/sect-Red_Hat_Enterprise_Linux-Migration_Planning_Guide-System_Management.html#sect-Red_Hat_Enterprise_Linux-Migration_Planning_Guide-System_Management-Hostname_Definition</a><span class="HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div>James Sumners<br><a href="http://james.sumners.info/" target="_blank">http://james.sumners.info/</a> (technical profile)</div><div><a href="http://jrfom.com/" target="_blank">http://jrfom.com/</a> (personal site)</div><div><a href="http://haplo.bandcamp.com/" target="_blank">http://haplo.bandcamp.com/</a> (band page)</div></div></div></div></div>
</font></span></div></div>
<br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br></div></div>