mirror of
https://git.valherun.com/valherun/pxe_boot_alma.git
synced 2026-10-15 21:22:03 -04:00
- 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]>
55 lines
1.3 KiB
Python
55 lines
1.3 KiB
Python
#!/usr/bin/python
|
|
|
|
import re
|
|
import os
|
|
import sys
|
|
|
|
log = 0
|
|
try:
|
|
# See if we are running in KickStart for logging
|
|
sys.path.append("/usr/lib/anaconda")
|
|
import anaconda_log
|
|
import logging
|
|
log = logging.getLogger("anaconda")
|
|
from anaconda_log import logger, logLevelMap
|
|
logger.addSysLogHandler(log, "10.1.1.1")
|
|
except:
|
|
pass
|
|
|
|
streg = re.compile('^\s+Serial Number:\s+(.+)$')
|
|
pnreg = re.compile('^\s+Product Name:\s+(.+)$')
|
|
addrreg = re.compile('^\s+inet addr:\s*(\S+)\s+.+$')
|
|
localreg = re.compile('^127\..+$')
|
|
|
|
st = ""
|
|
pn = ""
|
|
ips = []
|
|
|
|
if os.geteuid() == 0:
|
|
try:
|
|
for line in os.popen("/usr/sbin/dmidecode").readlines():
|
|
if streg.match(line) and st == '':
|
|
st = streg.match(line).group(1).strip()
|
|
if pnreg.match(line) and pn == '':
|
|
pn = pnreg.match(line).group(1).strip()
|
|
except:
|
|
print "# Problem running dmidecode"
|
|
|
|
else:
|
|
print "# Must be root to run deidecode"
|
|
|
|
try:
|
|
for line in os.popen("ifconfig").readlines():
|
|
if addrreg.match(line) and not localreg.match(addrreg.match(line).group(1)):
|
|
ips = ips + [ addrreg.match(line).group(1) ]
|
|
except:
|
|
print "# Problem running ifconfig"
|
|
|
|
if st == '':
|
|
msg = "Starting pre-KickStart for %s" % (ips)
|
|
else:
|
|
msg = "Starting pre-KickStart for %s (%s) %s" % (st, pn, ips)
|
|
|
|
print "# ", msg
|
|
if log: log.info(msg)
|