Files
pxe_boot_alma/work/KickStart/cfg/ks.cgi.20080211
T
andersenandClaude Fable 5 6d398b826a refactor: move tree under homelab/, add alma10 hardening and kickstart docs
- restructure boot/kickstarts/scripts/docs into homelab/
- docs: alma9->10 breaking changes, CIS hardening, kickstart changes
- add find_cron_entries.sh helper and codex running memory notes

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-06 22:35:07 -04:00

198 lines
5.1 KiB
Bash

#!/bin/bash
echo "Content-type: text/plain"
echo
# Load config
. /export/KickStart/cfg/ks.config
# Find who is Asking
MAC=`perl -ne 'if (/DHCPACK\s+on\s+$ENV{REMOTE_ADDR}\s+to\s+([\w\:]+)/) { print "$1\n";}' /var/log/messages |tail -1`
if [ "$MAC" = "" ] ; then
MAC=`arp -a $REMOTE_ADDR |cut -d ' ' -f 4`
fi
echo "# IP=$REMOTE_ADDR"
echo "# MAC=$MAC"
echo "# QUERY_STRING=${QUERY_STRING}"
echo
echo "install"
echo
if [ $INTERACTIVE = "y" ]; then
echo "INTERACTIVE"
fi
echo "text"
echo "keyboard us"
echo "mouse genericps/2 --device psaux --emulthree"
echo
echo "lang en_US"
echo "langsupport --default en_US en_US"
#echo "lang en_US.UTF-8"
#echo "langsupport --default en_US.UTF-8 en_US.UTF-8"
echo
echo "network --device eth0 --bootproto dhcp"
#echo "network --device eth0 --bootproto static --ip 192.168.177.80 --netmask 255.255.255.0 --gateway 192.168.177.254 --nameserver 192.168.176.2,192.168.177.2 --hostname iprobe017"
echo
if [ -d "/export/KickStart/${QUERY_STRING}" ]; then
# CentOS-3.7, Nanhant-4.4
echo "url --url http://10.1.1.1/KickStart/${QUERY_STRING}"
else
echo "url --url http://10.1.1.1/KickStart/Taroon-ES-U7"
fi
echo
echo "xconfig --card \"ATI Mach64\" --videoram 8192 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 24"
echo
echo "rootpw --iscrypted $MD5PASS"
echo
if [ "${QUERY_STRING:0:7}" = "Nanhant" ]; then
echo "bootloader --location=mbr --append=\"rhgb quiet\" --md5pass=$MD5PASS"
if [ "$SELINUX" = "n" ]; then
echo "selinux --disabled"
elif [ "$SELINUX" != "" ]; then
echo "selinux --$SELINUX"
fi
else
echo "bootloader --location=mbr --md5pass=$MD5PASS"
fi
if [ "$FIREWALL" = "n" ]; then
echo "firewall --disabled"
elif [ "$FIREWALL" != "" ]; then
echo "firewall --$FIREWALL"
fi
echo "authconfig --enableshadow --enablemd5"
if [ "$TZ" = "" ]; then
echo "timezone America/New_York"
else
echo "timezone $TZ"
fi
if [ "$REBOOT" = "y" ]; then
echo "reboot"
fi
echo
# Setup Disk Partitions
# hd (older IDE PEs) or sd (750s, SATA & SCSI)
echo "## Disk Partition Information"
#echo clearpart --all --drives=hda
#echo clearpart --all --drives=sda
#echo clearpart --all --drives=hda,hdb
if [ "$DISKTYPE" = "prompt" ] ; then
echo "# Prompt for partiion setup"
elif [ "$DISKTYPE" = "hd" ] ; then
echo "clearpart --all"
echo 'part /boot --fstype ext3 --size=100 --ondisk=hda'
echo 'part swap --size=2048 --ondisk=hda'
echo 'part swap --size=2048 --ondisk=hda'
#echo 'part swap --size=2048 --ondisk=hda'
#echo 'part swap --size=2048 --ondisk=hda'
echo 'part / --fstype ext3 --size=1100 --grow --ondisk=hda'
elif [ "$DISKTYPE" = "hdc" ] ; then
echo "clearpart --all"
echo 'part /boot --fstype ext3 --size=100 --ondisk=hdc'
echo 'part swap --size=2048 --ondisk=hdc'
echo 'part swap --size=2048 --ondisk=hdc'
echo 'part swap --size=2048 --ondisk=hdc'
echo 'part swap --size=2048 --ondisk=hdc'
echo 'part / --fstype ext3 --size=1100 --grow --ondisk=hdc'
elif [ "$DISKTYPE" = "sd" ] ; then
echo "clearpart --all"
echo 'part /boot --fstype ext3 --size=100 --ondisk=sda'
echo 'part swap --size=2048 --ondisk=sda'
echo 'part swap --size=2048 --ondisk=sda'
echo 'part swap --size=2048 --ondisk=sda'
echo 'part swap --size=2048 --ondisk=sda'
echo 'part / --fstype ext3 --size=1100 --grow --ondisk=sda'
fi
# clearpart --linux --drives=hda,hdb
# part /boot --fstype ext3 --size=100 --ondisk=hda
# part swap --size=1000 --ondisk=hdb
# part swap --size=1000 --grow --maxsize=2000 --ondisk=hda
# part /db --fstype ext3 --size=1 --grow --ondisk=hdb
# part / --fstype ext3 --size=1 --grow --ondisk=hda
echo
# List of packages to install
if [ "${QUERY_STRING}" != "" -a -f "/export/KickStart/cfg/pkglists/KS_Packages_${QUERY_STRING}.cfg" ]; then
echo "# KS_Packages_${QUERY_STRING}.cfg"
echo
cat /export/KickStart/cfg/pkglists/KS_Packages_${QUERY_STRING}.cfg
else
echo "# KS_Packages.cfg"
echo
cat /export/KickStart/cfg/pkglists/KS_Packages.cfg
fi
LOG="/root/post-`date +%F`.log"
echo
echo "%pre"
echo
if [ "$PRE" = "y" ]; then
echo "chvt 3"
echo "export LOG=/mnt/sysimage$LOG"
echo
for i in /export/KickStart/cfg/ks.d/P* ; do
echo "echo '-- Starting $i' | tee -a \$LOG"
echo
cat $i
echo
echo "echo '-- Done with $i' | tee -a \$LOG"
done
fi
echo
echo "%post"
echo
if [ "$POST" = "y" ]; then
echo "chvt 3"
echo "export LOG=$LOG"
echo "export MAC=$MAC"
echo "echo 'Found MAC = $MAC' | tee -a \$LOG"
echo
for i in /export/KickStart/cfg/ks.d/S* ; do
echo "echo '-- Starting $i' | tee -a \$LOG"
echo
# replace '#LOG' with '>&1 | tee -a $LOG'
perl -ne "s/\#DIST/${QUERY_STRING}/g; s/\#LOG/2\>\&1 \| tee \-a \\\$LOG/; print" $i
echo
echo "echo '-- Done with $i' | tee -a \$LOG"
done
fi
echo
echo "%post --nochroot"
echo
if [ "$POSTNR" = "y" ]; then
echo "chvt 3"
echo "export LOG=/mnt/sysimage$LOG"
echo
for i in /export/KickStart/cfg/ks.d/N* ; do
echo "echo '-- Starting $i'"
echo
cat $i
echo
echo "echo '-- Done with $i'"
done
fi