#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth  --useshadow  --enablemd5  --enablenis --nisdomain=mathstat_nis --nisserver=mathstat.unl.edu --enablesmbauth --smbservers wsecdc,eastdc --smbworkgroup UNL-AD
# System bootloader configuration
bootloader --append="vga=791" --location=partition --md5pass=$1$wPAz0HIF$ujdAK8poa76WkJGNl5kuC0
# Partition clearing information
clearpart --linux  
# Use text/graphical mode install
graphical
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging info
# Use NFS installation media
nfs --server=math.unl.edu --dir=/linux/fedora/core/6/i386/os/
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on --noipv6
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$RsHn9bVO$RbTkpcGWkx6HBZHH4Z0aT/

# SELinux configuration
selinux --disabled
# System timezone
timezone  America/Chicago
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig  --defaultdesktop=KDE --depth=16 --resolution=1280x1024 --startxonboot
# Disk partitioning information
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --recommended
part / --bytes-per-inode=4096 --fstype="ext3" --grow --maxsize=32000 --size=1

# Enable Extra repos
repo --name=fedora-unl --baseurl=http://kdeforge.unl.edu/yum/fedora/fedora/6/i386/unl/
# repo --name=extras --url=http://kdeforge.unl.edu/yum/fedora/core/extras/6/i386/

%packages
@ base-x
-gdm

%post 
set -x
### autofs
mkdir /Net

### updater
mkdir -p /var/log/update/all /var/log/update/lab /var/log/update/mathlab
cat >> /etc/rc.d/rc.local <<EOF

# Custom updater
/Net/math/linux/update/updater
EOF

### /etc/hosts
cat > /etc/hosts <<EOF
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
EOF

### /etc/sysconfig/network
cat > /etc/sysconfig/network <<EOF
NETWORKING=yes
HOSTNAME=localhost.localdomain
NISDOMAIN=mathstat_nis
EOF


### Fix the nisplus oddness in /etc/nsswitch.conf

sed -i -e 's/^\(passwd:\s*\)\(.*\)/\1 files nis/g' /etc/nsswitch.conf
sed -i -e 's/^\(shadow:\s*\)\(.*\)/\1 files nis/g' /etc/nsswitch.conf
sed -i -e 's/^\(group:\s*\)\(.*\)/\1 files nis/g' /etc/nsswitch.conf
sed -i -e 's/^\(automount:\s*\)\(.*\)/\1 files nis/g' /etc/nsswitch.conf


### Set active partition for dual-boot setup
# We first check to see if we are on SATA or not
if [ -e /dev/sda ]
then
        hd_type=sda
else
        hd_type=hda
fi

# Then in either case we check the type of the first
# partion, if grep found something it returns 0
if [ $(parted --script /dev/$hd_type print 1 | grep -q fat16; echo $?) = 0 ]
then
        if [ $(parted --script  /dev/$hd_type print 2 | grep -q ntfs; echo $?) = 0 ]
        then
                echo "$hd_type with fat16 first and ntfs second."
                parted /dev/$hd_type set 3 boot on
        else
                echo "$hd_type with fat16 first and no ntfs."
                parted /dev/$hd_type set 2 boot on
        fi
else
        if [ $(parted --script /dev/$hd_type print 1 | grep -q ntfs; echo $?) = 0 ]
        then
                echo "$hd_type with no fat16 and ntfs first."
                parted /dev/$hd_type set 2 boot on
        else
                echo "$hd_type with no fat16 and no ntfs."
                parted /dev/$hd_type set 1 boot on
        fi
fi

set -
