nfs --server lab.test-kickstart.invalid --dir /distros/RHEL-6.2/Server/x86_64/os/
#url --url=nfs://lab.test-kickstart.invalid:/distros/RHEL-6.2/Server/x86_64/os/

cmdline
# System bootloader configuration
bootloader --location=mbr
network --bootproto=dhcp --hostname=test01.test-kickstart.invalid

repo --name=beaker-HighAvailability --cost=100 --baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/os/HighAvailability
repo --name=beaker-LoadBalancer --cost=100 --baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/os/LoadBalancer
repo --name=beaker-optional-x86_64-os --cost=100 --baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/optional/x86_64/os
repo --name=beaker-ResilientStorage --cost=100 --baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/os/ResilientStorage
repo --name=beaker-ScalableFileSystem --cost=100 --baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/os/ScalableFileSystem
repo --name=beaker-debug --cost=100 --baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/debug
repo --name=beaker-optional-x86_64-debug --cost=100 --baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/optional/x86_64/debug
repo --name=beaker-Server --cost=100 --baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/os/Server

firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US.UTF-8

reboot
#Root password
rootpw --iscrypted $1$beaker$yMeLK4p1IVkFa80RyTkpE.
# SELinux configuration
selinux --enforcing


# System timezone
timezone America/New_York

zerombr
clearpart --all --initlabel

autopart
# no snippet data for RedHatEnterpriseLinux6
# no snippet data for RedHatEnterpriseLinux
# no snippet data for system

%packages --ignoremissing --default
# no snippet data for packages
%end



%pre --log=/dev/console
set -x
# Some distros have curl in their minimal install set, others have wget.
# We define a wrapper function around the best available implementation
# so that the rest of the script can use that for making HTTP requests.
if command -v curl >/dev/null ; then
    # Older curl versions lack --retry
    if curl --help 2>&1 | grep -q .*--retry ; then
        function fetch() {
            curl -L --retry 20 --remote-time -o "$1" "$2"
        }
    else
        function fetch() {
            curl -L --remote-time -o "$1" "$2"
        }
    fi
elif command -v wget >/dev/null ; then
    # In Anaconda images wget is actually busybox
    if wget --help 2>&1 | grep -q BusyBox ; then
        function fetch() {
            wget -O "$1" "$2"
        }
    else
        function fetch() {
            wget --tries 20 -O "$1" "$2"
        }
    fi
else
    echo "No HTTP client command available!"
    function fetch() {
        false
    }
fi


# no snippet data for RedHatEnterpriseLinux6_pre
# no snippet data for RedHatEnterpriseLinux_pre
# no snippet data for system_pre
%end

%post --log=/dev/console
set -x
# Some distros have curl in their minimal install set, others have wget.
# We define a wrapper function around the best available implementation
# so that the rest of the script can use that for making HTTP requests.
if command -v curl >/dev/null ; then
    # Older curl versions lack --retry
    if curl --help 2>&1 | grep -q .*--retry ; then
        function fetch() {
            curl -L --retry 20 --remote-time -o "$1" "$2"
        }
    else
        function fetch() {
            curl -L --remote-time -o "$1" "$2"
        }
    fi
elif command -v wget >/dev/null ; then
    # In Anaconda images wget is actually busybox
    if wget --help 2>&1 | grep -q BusyBox ; then
        function fetch() {
            wget -O "$1" "$2"
        }
    else
        function fetch() {
            wget --tries 20 -O "$1" "$2"
        }
    fi
else
    echo "No HTTP client command available!"
    function fetch() {
        false
    }
fi

fetch - http://lab.test-kickstart.invalid:8000/nopxe/test01.test-kickstart.invalid

# If netboot_method= is found in /proc/cmdline record it to /root
netboot_method=$(grep -oP "(?<=netboot_method=)[^\s]+(?=)" /proc/cmdline)
if [ -n "$netboot_method" ]; then
echo $netboot_method >/root/NETBOOT_METHOD.TXT
fi

# Enable post-install boot notification
if [ -f /etc/sysconfig/readahead ] ; then
    :
    cat >>/etc/sysconfig/readahead <<EOF

# readahead conflicts with auditd, see bug 561486 for detailed explanation.
#
# Should a task need to change these settings, it must revert to this state
# when test is done.

READAHEAD_COLLECT="no"
READAHEAD_COLLECT_ON_RPM="no"
EOF
fi

if [ -e /etc/sysconfig/ntpdate ] ; then
    chkconfig ntpdate on
fi
if [ -e "/etc/sysconfig/ntpd" ]; then
    chkconfig ntpd on
    GOT_G=$(/bin/cat /etc/sysconfig/ntpd | grep -E '^OPTIONS' | grep '\-g')

    if [ -z "$GOT_G" ]; then
        /bin/sed -i -r 's/(^OPTIONS\s*=\s*)(['\''|"])(.+)$/\1\2\-x \3 /' /etc/sysconfig/ntpd
    fi
fi
if [ -e /etc/chrony.conf ] ; then
    cp /etc/chrony.conf{,.orig}
    # use only DHCP-provided time servers, no default pool servers
    sed -i '/^server /d' /etc/chrony.conf
    cp /etc/sysconfig/network{,.orig}
    # setting iburst should speed up initial sync
    # https://bugzilla.redhat.com/show_bug.cgi?id=787042#c12
    echo NTPSERVERARGS=iburst >>/etc/sysconfig/network
    chkconfig ntpd off
    chkconfig ntpdate off
    chkconfig chronyd on
fi

if efibootmgr &>/dev/null ; then
    # The installer should have added a new boot entry for the OS
    # at the top of the boot order. We move it to the end of the order
    # and set it as BootNext instead.
    boot_order=$(efibootmgr | awk '/BootOrder/ { print $2 }')
    os_boot_entry=$(cut -d, -f1 <<<"$boot_order")
    new_boot_order=$(cut -d, -f2- <<<"$boot_order"),"$os_boot_entry"
    efibootmgr -o "$new_boot_order"
    efibootmgr -n "$os_boot_entry"
    # save the boot entry for later, so that rhts-reboot can set BootNext as well
    echo "$os_boot_entry" >/root/EFI_BOOT_ENTRY.TXT
fi





# Add distro and custom Repos
cat <<"EOF" >/etc/yum.repos.d/beaker-HighAvailability.repo
[beaker-HighAvailability]
name=beaker-HighAvailability
baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/os/HighAvailability
enabled=1
gpgcheck=0
skip_if_unavailable=1
EOF
cat <<"EOF" >/etc/yum.repos.d/beaker-LoadBalancer.repo
[beaker-LoadBalancer]
name=beaker-LoadBalancer
baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/os/LoadBalancer
enabled=1
gpgcheck=0
skip_if_unavailable=1
EOF
cat <<"EOF" >/etc/yum.repos.d/beaker-optional-x86_64-os.repo
[beaker-optional-x86_64-os]
name=beaker-optional-x86_64-os
baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/optional/x86_64/os
enabled=1
gpgcheck=0
skip_if_unavailable=1
EOF
cat <<"EOF" >/etc/yum.repos.d/beaker-ResilientStorage.repo
[beaker-ResilientStorage]
name=beaker-ResilientStorage
baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/os/ResilientStorage
enabled=1
gpgcheck=0
skip_if_unavailable=1
EOF
cat <<"EOF" >/etc/yum.repos.d/beaker-ScalableFileSystem.repo
[beaker-ScalableFileSystem]
name=beaker-ScalableFileSystem
baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/os/ScalableFileSystem
enabled=1
gpgcheck=0
skip_if_unavailable=1
EOF
cat <<"EOF" >/etc/yum.repos.d/beaker-debug.repo
[beaker-debug]
name=beaker-debug
baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/debug
enabled=1
gpgcheck=0
skip_if_unavailable=1
EOF
cat <<"EOF" >/etc/yum.repos.d/beaker-optional-x86_64-debug.repo
[beaker-optional-x86_64-debug]
name=beaker-optional-x86_64-debug
baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/optional/x86_64/debug
enabled=1
gpgcheck=0
skip_if_unavailable=1
EOF
cat <<"EOF" >/etc/yum.repos.d/beaker-Server.repo
[beaker-Server]
name=beaker-Server
baseurl=http://lab.test-kickstart.invalid/distros/RHEL-6.2/Server/x86_64/os/Server
enabled=1
gpgcheck=0
skip_if_unavailable=1
EOF



#Add test user account
useradd --password '$6$oIW3o2Mr$XbWZKaM7nA.cQqudfDJScupXOia5h1u517t6Htx/Q/MgXm82Pc/OcytatTeI4ULNWOMJzvpCigWiL4xKP9PX4.' test
cat <<"EOF" >/etc/profile.d/beaker.sh
export BEAKER="@BEAKER@"
export BEAKER_JOB_WHITEBOARD=''
export BEAKER_RECIPE_WHITEBOARD=''
EOF
cat <<"EOF" >/etc/profile.d/beaker.csh
setenv BEAKER "@BEAKER@"
setenv BEAKER_JOB_WHITEBOARD ''
setenv BEAKER_RECIPE_WHITEBOARD ''
EOF

cat << EOF > /etc/profile.d/rh-env.sh
export LAB_CONTROLLER=lab.test-kickstart.invalid
export DUMPSERVER=netdump.test-kickstart.invalid
export NFSSERVERS="RHEL3,rhel3-nfs.test-kickstart.invalid:/export/home RHEL4,rhel4-nfs.test-kickstart.invalid:/export/home RHEL5,rhel5-nfs.test-kickstart.invalid:/export/home RHEL6,rhel6-nfs.test-kickstart.invalid:/export/home NETAPP, SOLARIS,"
export LOOKASIDE=http://download.test-kickstart.invalid/lookaside/
export BUILDURL=http://download.test-kickstart.invalid
EOF
cat << EOF > /etc/profile.d/rh-env.csh
setenv LAB_CONTROLLER lab.test-kickstart.invalid
setenv DUMPSERVER netdump.test-kickstart.invalid
setenv NFSSERVERS "RHEL3,rhel3-nfs.test-kickstart.invalid:/export/home RHEL4,rhel4-nfs.test-kickstart.invalid:/export/home RHEL5,rhel5-nfs.test-kickstart.invalid:/export/home RHEL6,rhel6-nfs.test-kickstart.invalid:/export/home NETAPP, SOLARIS,"
setenv LOOKASIDE http://download.test-kickstart.invalid/lookaside/
setenv BUILDURL http://download.test-kickstart.invalid
EOF
# no snippet data for RedHatEnterpriseLinux6_post
# no snippet data for RedHatEnterpriseLinux_post
# no snippet data for system_post
%end



