#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth  --useshadow  --enablemd5  --enablenis --nisdomain=mathstat_nis --nisserver=mathstat.unl.edu --smbworkgroup=UNL-AD --krb5realm=UNL.EDU --krb5kdc=wsecdc --enablewinbindauth --smbsecurity=ads --smbrealm=UNL.EDU --enablewinbindusedefaultdomain
# would be nice to have at the end of auth --winbindjoin=math-adminguy%guy1admin2
# Use graphical install
graphical
# Firewall configuration
firewall --disabled
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Root password
rootpw --iscrypted $1$s.FBxeJX$lS729GIgv81qtxGgX1FBI/
# SELinux configuration
selinux --permissive
# Use interactive kickstart installation method
# interactive
# Install OS instead of upgrade
install
# Use NFS installation media
nfs --server=math.unl.edu --dir=/linux/mirrors/fedora/linux/releases/7/Fedora/x86_64/os
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on --noipv6
# Reboot after installation
reboot
# System timezone
timezone  America/Chicago
# X Window System configuration information
xconfig  --defaultdesktop=KDE --depth=16 --resolution=1280x1024 --startxonboot
# System bootloader configuration
bootloader --append="vga=791" --location=partition --md5pass=$1$5SRg8//6$eSUMZFmMWaDxscZmQLr9d.
# Partition clearing information
clearpart --linux  
# 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/7/x86_64/unl/
repo --name=updates --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f7&arch=x86_64

services --disabled yum-updatesd --enabled ypbind

%packages
@ base-x
# -gdm
samba-common

%post 
set -x
### join the machine to AD
net join -Umath-adminguy@UNL.EDU%guy1admin2

### try to make the box 64-bit clean
cat >> /etc/yum.conf <<EOF
# try to make the box 64-bit clean
exclude=*.i?86
EOF

yum -y remove glibc.i686 libgcc.i386

### 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

### /etc/yp.conf
grep '^domain mathstat_nis' /etc/yp.conf || \
cat >> /etc/yp.conf <<EOF
domain mathstat_nis server mathstat.unl.edu
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 -
