Kickstart Network Configuration Issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hello all,
I've been struggling with an issue with my kickstart configuration for a while now. My kickstart files are stored within the initrd image. What I would like to do here, is when the kickstart first starts up, I want it to grab a DHCP address (it does at the moment) so it can grab all of the necessary installation data off the net. Then, at some point _IN_ the install process, I'd like to have it query for manually input network settings. Here is my current kickstart script:

  auth  --useshadow  --enablemd5 
  bootloader --location=mbr
  zerombr
  clearpart --all --initlabel 
  text
  firewall --enabled --port=22:tcp
  firstboot --disable
  keyboard us
  lang en_US
  logging --level=info
  url --url=http://mirror.nexcess.net/CentOS/5.5/os/x86_64/
  reboot --eject
  rootpw --iscrypted xx
  selinux --enforcing
  skipx
  timezone --isUtc America/Detroit
  install

  part /boot --bytes-per-inode=4096 --fstype="ext3" --size=512 --ondisk=sda
  part swap --bytes-per-inode=4096 --fstype="swap" --size=2048 --ondisk=sda
  part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1 --ondisk=sda
  part /backup --bytes-per-inode=4096 --fstype="ext3" --grow --size=1 --ondisk=sdb

  network --bootproto=dhcp --device=eth0

  %packages --nobase
  @core
  system-config-network-tui

  %post
  echo "nameserver 4.2.2.1" > /etc/resolv.conf
  echo "nameserver 8.8.8.8" >> /etc/resolv.conf

  # write netconfig script
  cat << EOF > /bin/netconfig 
  #!/bin/bash
  # check if user is root
  if [[ \$EUID -ne 0 ]]; then
      echo "This script must be run as root" 1>&2
      exit 1
  fi
  # run system-config-network-tui
  /usr/sbin/system-config-network-tui
  # set variables
  eth0f="/etc/sysconfig/network-scripts/ifcfg-eth0"
  eth1f="/etc/sysconfig/network-scripts/ifcfg-eth1"
  netcfg="/etc/sysconfig/network"
  # turn on eth1 if it has an address, remove gateway.. shouldn't be set here
  # anyways
  if [ -f "\$eth1f" ]; then
      if grep -q "IPADDR" \$eth1f; then
          sed -i 's/ONBOOT=no/ONBOOT=yes/' \$eth1f
          sed -i '/^GATEWAY/d' \$eth1f
          sed -i '/^HOTPLUG/d' \$eth1f
      fi
  fi
  # move gateway from ifcfg-eth0 to /etc/sysconfig/network
  if [ -f "\$eth0f" ]; then
      e0gw=\$(grep "GATEWAY" \$eth0f)
      sed -i '/^GATEWAY/d' \$eth0f
      # check to see if the gateway is already set. if it is, delete it first
      if ! grep -q "GATEWAY" /etc/sysconfig/network; then
          echo \$e0gw >> \$netcfg
      else
          sed -i '/^GATEWAY/d' \$netcfg
          echo \$e0gw >> \$netcfg
      fi
  fi
  EOF
  chmod +x /bin/netconfig

At the moment, I have a not-so-elegant script written to the server to be run manually after install. I began using system-config-network-tui vanilla, but realized it had some differences from the network configuration tool in anaconda (net.c?) I tried my best to correct those differences with my netconfig script. I've already tried running system-config-network-tui in the %post section, but it doesn't seem to work. If anyone has had experience in dealing with a scenario such as this, any help would be greatly appreciated.

Thanks,
Daniel Theisen <dtheisen@xxxxxxxxxxx>
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux