[Spacewalk-list] Help with kick-start.

Josh Preston JoshPreston at dswinc.com
Fri Dec 21 09:54:20 UTC 2012


Pup,

After this thread, you might want to consider my other snippetŠ it sets
hostname and ip based on kernel parameters, kickstart options (variables
in the kickstart) or, if like us, you need to use cobbler buildiso.

# Begin spacewalk/1/post-configure-hostname snippet

# 1. if the system's hostname is not set or equals localhost.localdomain
or it's set to ip address
#   a. configure the hostname using the kernel command line options
#   b. configure the hostname using cobbler system data
# 2. create our valid /etc/hosts entries

#set $HOSTNAME = $getVar("$hostname", "$hostname")
#set $GATEWAY = $getVar("$gateway", "$gateway")
#set $IP = $getVar("$ip", "$ip")

HOSTNAME="$HOSTNAME"
GATEWAY="$GATEWAY"
IP="$IP"

#if $getVar("$system_name", "") == ""
    #raw
for I in $(cat /proc/cmdline); do
    case "$I" in *=*)
        eval $I; export $I;
    esac;
done
    #end raw
#end if

if [ -z "$HOSTNAME" || "$HOSTNAME" = "localhost" || "$HOSTNAME" =
"localhost.localdomain" || "$HOSTNAME" == "$IP" ]; then

    # bring in hostname specified on the command line
    if [ -f /tmp/network ]; then
        cp /tmp/network /mnt/sysimage/etc/sysconfig/network
    else # create the valid entry
        echo "NETWORKING=yes
HOSTNAME=$HOSTNAME
GATEWAY=$GATEWAY" > /mnt/sysimage/etc/sysconfig/network
    fi

fi

# bring in the new network settings
. /mnt/sysimage/etc/sysconfig/network

# force hostname change
/mnt/sysimage/bin/hostname $HOSTNAME

# setup variables for use in /etc/hosts
LONG=`/mnt/sysimage/bin/hostname`
SHORT=`/mnt/sysimage/bin/hostname -s`
echo "$IP        \${LONG} \${SHORT}" >> /mnt/sysimage/etc/hosts

# End spacewalk/1/post-configure-hostname snippet





On 12/20/12 6:41 PM, "themaster001" <themaster001 at gmail.com> wrote:

>Sabuj,
>
>I am useing dhcp, or I coun't kick start, my script is to set the host
>and ip so when it comes up it done. I works on my kick sever that
>RHEL4, but we are moving from it. I am going to try what Josh gave, I
>think it will work for what I am trying.
>
>Pup
>
>On Thu, Dec 20, 2012 at 6:20 PM, Sabuj Pattanayek <sabujp at gmail.com>
>wrote:
>> Doesn't directly answer your question but you can't use dhcp ?
>>
>> On Thu, Dec 20, 2012 at 5:11 PM, themaster001 <themaster001 at gmail.com>
>>wrote:
>>> Sorry, those tty6 should be tty2, I tried even on tty 6 and it didn't
>>>work.
>>>
>>> On Thu, Dec 20, 2012 at 5:49 PM, Sabuj Pattanayek <sabujp at gmail.com>
>>>wrote:
>>>>> chvt 2
>>>>>
>>>>> read -p
>>>>> "What is the host fully-qualified name (ex.
>>>>>somehost.performancematters.com )?"
>>>>> NAME < /dev/tty6 >/dev/tty6 2>&1
>>>>
>>>> Isn't tty2 tied to vt 2?
>>
>> _______________________________________________
>> Spacewalk-list mailing list
>> Spacewalk-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>
>_______________________________________________
>Spacewalk-list mailing list
>Spacewalk-list at redhat.com
>https://www.redhat.com/mailman/listinfo/spacewalk-list





More information about the Spacewalk-list mailing list