Files
pxe_boot_alma/work/KickStart/cfg/diskpart.py.20090827
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

79 lines
2.3 KiB
Python

#!/usr/bin/python
import re
import os
dev = re.compile('^Host:\s+scsi0*(\d+)\s+Channel:\s+0*(\d+)\s+Id:\s+0*(\d+)\s+Lun:\s+0*(\d+)')
type = re.compile('^\s+Type:\s+Direct-Access')
block = re.compile('^block:(\S+)')
hdreg = re.compile('^(hd\w+)$')
diskreg = re.compile('^disk$')
hddevices = []
sddevices = []
try:
SCSI=open("/proc/scsi/scsi", "r")
for line in SCSI:
if dev.match(line):
s = dev.match(line).group(1)
c = dev.match(line).group(2)
i = dev.match(line).group(3)
l = dev.match(line).group(4)
if type.match(line):
sddir = "/sys/bus/scsi/drivers/sd/%s:%s:%s:%s" % (s, c, i, l)
for file in os.listdir(sddir):
if block.match(file):
sddevices = sddevices + [ block.match(file).group(1) ]
if len(sddevices) > 1:
sddevices.sort()
SCSI.close()
except:
pass
try:
for file in os.listdir("/proc/ide"):
if hdreg.match(file):
HD = open("/proc/ide/%s/media" % (file) )
media = HD.readline();
if diskreg.match(media):
hddevices = hddevices + [ hdreg.match(file).group(1) ]
if len(hddevices) > 1:
hddevices.sort()
except:
pass
devices = sddevices + hddevices
if len(devices) > 0:
print "# Found disks %s" % (devices)
print ""
print "clearpart --all";
print "";
print "part /boot --fstype ext3 --size=100 --ondisk=%s" % (devices[0])
print "part swap --size=512 --ondisk=%s" % (devices[0])
print "part pv.11 --size=1 --grow --ondisk=%s" % (devices[0])
if len(devices) > 1:
print "part pv.21 --size=1 --grow --ondisk=%s" % (devices[1])
print ""
print "volgroup vga pv.11"
if len(devices) > 1:
print "volgroup vgb pv.21"
print "";
print "logvol swap --fstype swap --name=iGlassOpt --vgname=vga --size=250"
print "";
print "logvol swap --fstype swap --name=swapVol01 --vgname=vga --size=4096"
if len(devices) > 1:
print "logvol swap --fstype swap --name=swapVol02 --vgname=vgb --size=4096"
print "logvol / --fstype ext3 --name=rootVol --vgname=vga --size=1 --grow";
if len(devices) > 1:
print "logvol /export --fstype ext3 --name=localVol --vgname=vgb --size=1 --grow"
# print "logvol /usr/local --fstype ext3 --name=localVol --vgname=vgb --size=1 --grow"
print "";
else:
print "# No disks found"