#version=RHEL8
# Use text mode install
text

repo --name="AppStream" --baseurl=file:///run/install/sources/mount-0000-nfs-device/AppStream

%pre
# pre section
#----- partitioning logic below--------------
# pick the first drive that is not removable and is over MINSIZE
DIR="/sys/block"

# minimum size of hard drive needed specified in GIGABYTES
#MINSIZE=60
MINSIZE=15

ROOTDRIVE=""

# /sys/block/*/size is in 512 byte chunks

for DEV in sda sdb hda hdb vda vdb ; do
  if [ -d $DIR/$DEV ]; then
    REMOVABLE=`cat $DIR/$DEV/removable`
    if (( $REMOVABLE == 0 )); then
      echo $DEV
      SIZE=`cat $DIR/$DEV/size`
      GB=$(($SIZE/2**21))
      if [ $GB -gt $MINSIZE ]; then
        echo "$(($SIZE/2**21))"
        if [ -z $ROOTDRIVE ]; then
          ROOTDRIVE=$DEV
        fi
      fi
    fi
  fi
done

cat << EOF > /tmp/part-include

zerombr

bootloader --location=mbr --driveorder=$ROOTDRIVE --append="crashkernel=auto"

clearpart --all --drives=$ROOTDRIVE

EOF

#mkdir -p /mnt/source
#mount -t nfs -o nolock nas-server:/data/SYS/linux/rockylinux/Rocky-8-10-x86_64-dvd1 /mnt/source
#echo "url --url=file:///mnt/source" > /tmp/repo.ks



%end

%post

##/sbin/chkconfig --level 345 dhcpd  on
##/sbin/chkconfig --level 345 ntpd   on
##/sbin/chkconfig --level 345 named  on
##/sbin/chkconfig --level 345 telnet on
##/sbin/chkconfig --level 345 vsftpd on
##/sbin/chkconfig --level 345 tftp   on

/usr/sbin/useradd jin -p '$KKK'
echo "jin123" | /usr/bin/passwd --stdin "jin"


sed -i "s/^\(HOSTNAME=\).\+$/\1ROCKY810x86_64-X/g"  /etc/sysconfig/network
sed -i "s/^root/#root/g"  /etc/vsftpd/ftpusers
sed -i "s/^root/#root/g"  /etc/vsftpd/user_list

yum -y install epel-release
yum -y install ntfs-3g
yum -y install ntfs-3g-devel

#yum -y install glibc-devel.i686
#yum -y install libgcc-4.4.7-17.el6.i686
#yum -y install glibc-static.i686
#yum -y install libstdc++-4.4.7-17.el6.i686
#yum -y install zlib-devel-1.2.3-29.el6.i686
#yum -y install python-devel.i686
#yum -y install openssl-devel.i686

%end

%packages
@additional-devel
@base
@core
@debugging
@development
@fonts
@ftp-server
@gnome-apps
@gnome-desktop
@hardware-monitoring
@java-platform
@large-systems
@network-file-system-client
@network-server
@network-tools
@performance
@remote-desktop-clients
@virtualization-client
@virtualization-hypervisor
@virtualization-tools
bind
bind-chroot
bind-libs
bind-utils
certmonger
dnsmasq
expect
ftp
genisoimage
gnutls-devel
jpackage-utils
kexec-tools
krb5-workstation
libXau-devel
libXinerama-devel
libXrandr-devel
libgcrypt-devel
libxslt-devel
mtools
ncompress
nscd
nss-pam-ldapd
oddjob
pam_ldap
popt-devel
sgpio
startup-notification-devel
syslinux
telnet-server
tftp-server
wodim
xinetd
xorg-x11-proto-devel

%end

# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Firewall configuration
firewall --disabled
# Network information
network  --bootproto=dhcp --device=eth0 --hostname=Rocky810x86_64 --activate

# Use NFS installation media
nfs --server=nas-server --dir=/data/SYS/linux/rockylinux/Rocky-8-10-x86_64-dvd1

# System authorization information
auth --enableshadow --passalgo=sha512 --enablefingerprint
# SELinux configuration
selinux --disabled

# X Window System configuration information
xconfig  --startxonboot

ignoredisk --only-use=vda
# System bootloader configuration
bootloader --append="crashkernel=auto" --location=mbr --driveorder="vda" --boot-drive=vda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --drives=vda
# Disk partitioning information
part /boot --fstype="ext4" --size=1024
part / --fstype="ext4" --size=80895

# System timezone
timezone Asia/Tokyo --isUtc

# Root password
rootpw --iscrypted $6$D474g8lYJc6agKe7$aYJNATB9ZsxACUAcCu1zvUNgLBzwVDrGKmev4a0lYZwR0IyAKaq32cwgbNz4lnONXya74U6WSJCETZ0hYQdDJ0

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end
