Files
pxe_boot_alma/work/KickStart/cfg/ks.cgi.20170407
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

731 lines
21 KiB
Perl

#!/usr/bin/perl
use Net::Syslog;
my $syslog;
my $SyslogFacility = "local3";
print "Content-type: text/plain\n\n";
sysInfo("Received KickStart config request from $ENV{REMOTE_ADDR} QS=$ENV{QUERY_STRING}");
my $c;
$c->{DIST} = "default";
$c->{DEBUG} = 0;
$c->{PTYPE} = "probe";
$c->{PRE} = 'y';
$c->{POST} = 'y';
$c->{POSTNR} = 'y';
$c->{IG_HOME} = "/opt/iglass";
$c->{IG_ETC} = "/etc/iglass";
#$c->{KSRV} = "10.1.1.1";
$c->{KSRV} = "kserver.iglass.net";
$c->{SSHHOST} = $c->{KSRV};
$c->{SSHPORT} = 22;
# Load QUERY_STRING variables cuz I need to see if DIST is defined
foreach my $pair ( split(/\&/,$ENV{QUERY_STRING}) ) {
if ( $pair =~ /(\S+)\=(\S+)/ ) {
if ( $1 eq "TYPE" ) {
eval "\$c->{PTYPE} = '$2'";
Debug("PTYPE = '$c->{$1}'");
} else {
eval "\$c->{$1} = '$2'";
Debug("$1 = '$c->{$1}'");
}
} else {
$c->{DIST} = $ENV{QUERY_STRING};
last;
}
}
if ( $c->{PTYPE} =~ /^VM$/ ) {
print "#!/bin/bash\n";
}
# Find who is Asking
my $MAC = `ifconfig eth0 |grep HWaddr | awk '{print \$5}'`;
if ( $ENV{REMOTE_ADDR} ) {
if ( !$MAC ) {
`/bin/ping -c 1 $ENV{REMOTE_ADDR} > /dev/null`;
$MAC = `arp -na $ENV{REMOTE_ADDR} |cut -d ' ' -f 4`;
chomp($MAC);
}
if ( $ENV{REMOTE_ADDR} =~ /^192\.168\./ ) {
$c->{KSRV} = "obelisk.iglass.net";
}
}
my $KDIR = "/home/KickStart/cfg";
# Load custom config file variables
if ( open(C, "$KDIR/stag.d/$MAC.cfg") ) {
#print "\n";
Debug("$KDIR/stag.d/$MAC.cfg:");
while ( <C> ) {
chomp;
if ( /^\s*#/ ) {
next;
} elsif ( /([^#\s]+)\='([^#\s]*)'/ || /([^#\s]+)\=([^#\s]*)/ ) {
Debug(" $1 = '$2'");
eval "\$c->{$1} = '$2'";
Debug(" $1 = '$c->{$1}'");
} else {
Warn("What is this '$_' in $MAC.cfg?");
}
}
close C;
} else {
Debug("No $MAC.cfg");
}
my $URL = "http://$c->{KSRV}/KickStart";
if ( -d "$KDIR/$c->{DIST}" ) {
Info("Using config directory $KDIR");
$KDIR .= "/$c->{DIST}";
$URL .= "/$c->{DIST}";
} else {
Warn("KS directory '$KDIR' for $c->{DIST}/ does not exist! Using default CentOS");
$KDIR .= "/default";
$URL .= "/default";
}
# Load config file variables
if ( open(C, "$KDIR/ks.config") ) {
#print "\n";
Debug("$KDIR/ks.config:");
while ( <C> ) {
chomp;
if ( /^\s*#/ ) {
next;
} elsif ( /([^#\s]+)\='([^#\s]*)'/ || /([^#\s]+)\=([^#\s]*)/ ) {
Debug(" $1 = '$2'");
eval "\$c->{$1} = '$2'";
Debug(" $1 = '$c->{$1}'");
} else {
Warn("What is this '$_' in ks.config?");
}
}
close C;
} else {
Warn("No $KDIR/ks.config!");
}
# Load these variables (yes again) to override config file mainly for DIST
foreach my $pair ( split(/\&/,$ENV{QUERY_STRING}) ) {
if ( $pair =~ /(\S+)\=(\S+)/ ) {
eval "\$c->{$1} = '$2'";
Debug("Reset $1 = '$2'");
} else {
$c->{DIST} = $ENV{QUERY_STRING};
last;
}
}
if ( $MAC =~ /^54:52:00:/ ) {
# kvm mac prefix
$c->{DISKTYPE} = 'vda';
$DISK = $c->{DISKTYPE};
Debug(" Reset DISKTYPE = '$c->{DISKTYPE}'");
} else {
$DISK = 'sda';
}
if ( open(C, "$KDIR/../stag.d/$MAC.cfg") ) {
#print "\n";
Debug("$KDIR/../stag.d/$MAC.cfg:");
while ( <C> ) {
chomp;
if ( /^\s*#/ ) {
next;
} elsif ( /([^#\s]+)\='([^#\s]*)'/ || /([^#\s]+)\=([^#\s]*)/ ) {
Debug(" $1 = '$2'");
eval "\$c->{$1} = '$2'";
Debug(" $1 = '$c->{$1}'");
} else {
Warn("What is this '$_' in $MAC.cfg?");
}
}
close C;
} else {
Debug("No $MAC.cfg");
}
Break();
foreach my $key ( keys %{$c} ) {
Info("$key = $c->{$key}") unless ($key =~ /PASS$/);
}
# Find iGlass release version
my $IGRELEASE=`cd /home/KickStart/iglass-releases; ls -v probe*rpm | tail -1`;
chomp $IGRELEASE;
Break();
Info("IP=$ENV{REMOTE_ADDR}");
Info("MAC=$MAC");
Info("IGRELEASE=$IGRELEASE");
Break();
my $FLOG = `date +custom-%F.log`;
chomp $FLOG;
if ( $c->{PTYPE} !~ /^VM$/ ) {
print "\n";
print "install\n";
print "\n";
if ( $c->{INTERACTIVE} eq "y" ) {
print "interactive\n";
}
print "text\n";
if ( $c->{DIST} eq "CentOS-3.7" ) {
print "mouse genericps/2 --device psaux --emulthree\n";
}
print "\n";
print "\n";
#print "network --device eth0 --bootproto dhcp\n";
#print "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\n";
if ( ($c->{DIST} =~ /^CentOS-(\d+)/) && ($1 >= 6) ) {
print "network --bootproto dhcp --nodns --noipv6\n";
print "sshpw --username=root $c->{MD5PASS} --iscrypted\n";
} else {
print "network --device eth0 --bootproto dhcp --nodns --noipv6\n";
}
print "\n";
print "url --url $URL\n";
print "\n";
print "xconfig\n";
print "\n";
if ( $c->{MD5PASS} ) {
print "rootpw --iscrypted $c->{MD5PASS}\n";
print "\n";
}
print "firstboot --disabled\n";
print "\n";
if ( $c->{DIST} =~ /^CentOS\-[56][\.]/ ) {
print "lang en_US\n";
print "keyboard us\n";
print "logging --host $c->{KSRV} --level debug\n";
#print "vnc --host $c->{KSRV} --port 5500 --password=kickMe\n";
#sysInfo("Ask for vnc install from \%pre");
#print "%include /tmp/vnc.cfg\n";
#print "bootloader --location=mbr --driveorder=sda,sdb --append=\"rhgb quiet\"";
print "bootloader --location=mbr --driveorder=$DISK --append=\"rhgb quiet\" --md5pass=$c->{MD5PASS}\n";
} elsif ( $c->{DIST} =~ /^CentOS\-7\-/ ) {
print "lang en_US.UTF-8\n";
print "keyboard --vckeymap=us --xlayouts='us'\n";
print "logging --host $c->{KSRV} --level debug\n";
print "bootloader --append=\"rhgb quiet crashkernel=auto\" --location=mbr --driveorder=$DISK --boot-drive=$DISK --iscrypted --password=\"$c->{GRUB2}\"\n";
} else {
print "lang en_US\n";
print "keyboard us\n";
print "langsupport --default en_US en_US\n";
print "bootloader --location=mbr --md5pass=$c->{MD5PASS}\n";
}
if ( $c->{FIREWALL} eq "n" ) {
print "firewall --disabled\n";
} elsif ( $c->{FIREWALL} eq "enabled" ) {
print "firewall --enabled --port=22:tcp, 1024:tcp, 5432:tcp, 5432:udp\n";
} elsif ( $c->{FIREWALL} ) {
print "firewall --$c->{FIREWALL}\n";
}
if ( $c->{SELINUX} eq "n" ) {
print "selinux --disabled\n";
} elsif ( $c->{SELINUX} ) {
print "selinux --$c->{SELINUX}\n";
}
print "authconfig --enableshadow --enablemd5\n";
if ( $TZ ) {
print "timezone $TZ\n";
} else {
print "timezone US/Eastern\n";
}
if ( $c->{REBOOT} eq "y" ) {
print "reboot\n";
} elsif ( $c->{REBOOT} eq "h" ) {
print "halt\n";
}
print "\n";
# Setup Disk Partitions
print "## Disk Partition Information\n";
if ( $c->{DISKTYPE} eq "prompt" ) {
print "# Prompt for partiion setup\n";
} elsif ( $c->{DISKTYPE} eq "hd" ) {
print "clearpart --all\n";
print "part /boot --fstype ext3 --size=100 --ondisk=hda\n";
print "part swap --size=2048 --ondisk=hda\n";
print "part swap --size=2048 --ondisk=hda\n";
#print "part swap --size=2048 --ondisk=hda\n";
#print "part swap --size=2048 --ondisk=hda\n";
print "part / --fstype ext3 --size=1100 --grow --ondisk=hda\n";
} elsif ( $c->{DISKTYPE} eq "one" ) {
print "clearpart --all\n";
print "part /boot --fstype ext3 --size=100\n";
print "part swap --size=2048\n";
print "part swap --size=2048\n";
print "part / --fstype ext3 --size=1100 --grow\n";
} elsif ( $c->{DISKTYPE} eq "hdc" ) {
print "clearpart --all\n";
print "part /boot --fstype ext3 --size=100 --ondisk=hdc\n";
print "part swap --size=2048 --ondisk=hdc\n";
print "part swap --size=2048 --ondisk=hdc\n";
print "part swap --size=2048 --ondisk=hdc\n";
print "part swap --size=2048 --ondisk=hdc\n";
print "part / --fstype ext3 --size=1100 --grow --ondisk=hdc\n";
} elsif ( $c->{DISKTYPE} eq "sd" ) {
print "clearpart --all\n";
print "part /boot --fstype ext3 --size=100 --ondisk=sda\n";
print "part swap --size=2048 --ondisk=sda\n";
print "part swap --size=2048 --ondisk=sda\n";
print "part swap --size=2048 --ondisk=sda\n";
print "part swap --size=2048 --ondisk=sda\n";
print "part / --fstype ext3 --size=1100 --grow --ondisk=sda\n";
} elsif ( $c->{DISKTYPE} eq "vda" ) {
print "clearpart --all\n\n";
print "part /boot --size=100 --ondisk=vda --fstype ext3\n";
print "part pv.11 --size=1 --ondisk=vda --grow\n\n";
print "volgroup vga pv.11\n\n";
print "logvol swap --fstype swap --name=iGlassOpt --vgname=vga --size=256\n";
print "logvol swap --fstype swap --name=swapVol01 --vgname=vga --size=4096\n";
print "logvol / --fstype ext4 --name=rootVol --vgname=vga --size=1 --grow\n\n";
} elsif ( $c->{DISKTYPE} eq "ssd" ) {
# Created in %pre
sysInfo("Solid State Disk partition config handled with sfdisk in \%pre");
print "%include /tmp/diskpart.cfg\n";
#print "partition /boot --fstype ext3 --onpart=${DISK}1\n";
## /opt/iglass will be sda2
#print "partition swap --onpart=${DISK}3\n";
#print "partition / --fstype ext4 --onpart=${DISK}4 --noformat\n";
##print "partition /export --fstype ext4 --size=100 --ondisk=sdb --grow\n\n";
#print "partition /export --fstype ext4 --onpart=sdb1 --noformat\n\n";
} else {
# Created in %pre
sysInfo("Disk partition info will be included from \%pre");
print "%include /tmp/diskpart.cfg\n";
}
print "\n";
# List of packages to install
print "%packages\n";
sysInfo("Generating package list from $KDIR/KS_Packages[-$c->{PTYPE}].cfg");
print "# Packages from $KDIR/KS_Packages.cfg\n";
if ( open(P,"$KDIR/KS_Packages.cfg") ) {
while ( <P> ) {
print;
}
close P;
} else {
Warn("No packages found");
}
if ( open(P,"$KDIR/KS_Packages-$c->{PTYPE}.cfg") ) {
while ( <P> ) {
print;
}
close P;
}
print "\n%end\n\n" if ( ($c->{DIST} =~ /^CentOS-(\d+)/) && ($1 >= 6) );
#
# Pre
#
print "\n%pre\n\n";
if ( $c->{PRE} eq "y" ) {
sysInfo("Generating \%pre section");
print "DISKTYPE=$c->{DISKTYPE}\n";
# NOTE: NO perl and no syslog yet in %pre so let python do it
print "\n";
print "KSRV=$c->{KSRV}\n";
print "DIST=$c->{DIST}\n";
print "PTYPE=$c->{PTYPE}\n";
print "LOGGER=/tmp/syslog.py\n";
print "wget -q -O \$LOGGER http://\$KSRV/KickStart/cfg/syslog.py\n";
print "chmod 755 \$LOGGER\n";
print "python /tmp/syslog.py Python syslog logger \$LOGGER setup worked\n";
print "\n";
print "chvt 3\n";
print "PRELOG=/tmp/pre-$FLOG";
print "\n";
printConfig('P', $c->{PTYPE}, 'PRELOG');
print "chvt 1\n";
}
print "\n%end\n\n" if ( ($c->{DIST} =~ /^CentOS-(\d+)/) && ($1 >= 6) );
#
# Install happens here
#
#
# Post chroot to /mnt/sysimage
#
sysInfo("Generating \%post with chroot");
print "\n";
print "%post\n";
print "\n";
print "chvt 3\n\n";
$LOGGER = "logger -t KickStart[\$\$] -p $SyslogFacility.info";
} else {
# PTYPE = VM
print "if [ `id -u` != 0 ]; then\n";
print " echo Please run as root\n";
print " exit 1\n";
print "fi\n\n";
print "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/opt/iglass/bin\n\n";
$c->{KSRV} = "$ENV{HTTP_HOST}";
if ( my ($host, $port) = ($c->{KSRV} =~ /^(\w+):(\d+)$/) ) {
$c->{SSHHOST} = $host;
$c->{SSHPORT} = ++$port;
} else {
Warn("No ssh port from http port found");
}
$LOGGER = "cat";
# Convert to CentOS if RedHat
print "echo\n";
print "read -p 'Proceed with CentOS convertion? [Y] ' OK\n";
print qq|if [ "\$OK" = "" -o "\$OK" = "y" -o "\$OK" = "Y" ]; then\n|;
my $mirror='http://mirror.centos.org/centos';
print " if grep -Ei \"Red\\s*Hat\\s*Enterprise\" /etc/redhat-release ; then\n";
print " if grep -Ei \"release 5\.\" /etc/redhat-release ; then\n";
print " rpm --import $mirror/RPM-GPG-KEY-CentOS-5\n";
print " if [ `uname -i` eq \"x86_64\" ]; then\n";
print " MIRROR=$mirror/5/os/x86_64/CentOS\n";
print " rpm -Uvh \$MIRROR/centos-release-5-5.el5.centos.x86_64.rpm \$MIRROR/centos-release-notes-5.5-0.x86_64.rpm\n";
print " rpm -Uvh \$MIRROR/kernel-devel-2.6.18-194.el5.x86_64.rpm \$MIRROR/kernel-headers-2.6.18-194.el5.x86_64.rpm\n";
print " rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm\n";
print " else\n";
print " MIRROR=$mirror/5/os/i386/CentOS\n";
print " rpm -Uvh \$MIRROR/centos-release-5-5.el5.centos.i386.rpm \$MIRROR/5/os/i386/CentOS/centos-release-notes-5.5-0.i386.rpm\n";
print " rpm -Uvh \$MIRROR/kernel-devel-2.6.18-194.el5.i686.rpm \$MIRROR/kernel-headers-2.6.18-194.el5.i386.rpm\n";
print " rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm\n";
print " fi\n";
# wget -q -O - http://linux.dell.com/repo/hardware/latest/bootstrap.cgi | bash # Add Dell srvadm yum repo
print " elif grep -Ei \"release 6\.\" /etc/redhat-release ; then\n";
print " if [ `uname -i` eq \"x86_64\" ]; then\n";
print " rpm -ivh http://mirror.symnds.com/distributions/fedora-epel/6/i386/epel-release-6-8.noarch.rpm\n";
print " fi\n";
print " else\n";
print " echo This is not release 5\n";
print " fi\n";
print " else\n";
print " echo This is not Red Hat Enterprise\n";
print " fi\n";
print "else\n";
print " echo Skipping CentOS convertion\n";
print "fi\n";
my @groupList;
my @plusList;
my @minusList;
my @vmList;
if ( open(P,"$KDIR/KS_Packages.cfg") ) {
while ( <P> ) {
if ( /^\@(.+)$/ ) {
#push @groupList, $1;
} elsif ( /^\-(.+)$/ ) {
#push @minusList, $1;
} elsif ( /^(.+)$/ ) {
push @plusList, $1;
}
}
close P;
} else {
Warn("No packages found");
}
if ( open(P,"$KDIR/KS_Packages-$c->{PTYPE}.cfg") ) {
while ( <P> ) {
if ( /^\@(.+)$/ ) {
push @groupList, $1;
} elsif ( /^\-(.+)$/ ) {
push @minusList, $1;
} elsif ( /^(.+)$/ ) {
push @plusList, $1;
}
}
close P;
}
my $toLong = 75;
print "\n";
print "yum groupinstall ", join(" ",@groupList), "\n\n" if ( $#groupList >= 0 );
print "\n";
if ( $#plusList >= 0 ) {
print "yum -y install ";
my $len=15;
foreach ( @plusList ) {
$len += length " $_";
print " $_";
if ( $len > $toLong ) {
print " \\\n";
$len=0;
}
}
}
print "\n\n";
print "yum erase ", join(" ",@minusList), "\n\n" if ( $#minusList >= 0 );
}
print "FLOG=$FLOG\n";
print "LOG=/root/post-chrt-$FLOG\n";
print "\n";
print "echo -e 'Post chroot Starting\\n\\n' | $LOGGER\n";
if ( $c->{POST} eq "y" ) {
print "MAC=$MAC\n";
print "DIST=$c->{DIST}\n";
print "PTYPE=$c->{PTYPE}\n";
print "IGRELEASE=$IGRELEASE\n";
print "KSRV=$c->{KSRV}\n";
print "SSHPORT=\"$c->{SSHPORT}\"\n";
print "SSHHOST=\"$c->{SSHHOST}\"\n";
print "IG_HOME=$c->{IG_HOME}\n";
print "IG_ETC=$c->{IG_ETC}\n";
print "NOCPASS='$c->{NOCPASS}'\n";
print "\n";
print "echo \"MAC=\$MAC\" | tee -a \$LOG | $LOGGER\n";
print "echo \"DIST=\$DIST\" | tee -a \$LOG | $LOGGER\n";
print "echo \"PTYPE=\$PTYPE\" | tee -a \$LOG | $LOGGER\n";
print "echo \"IGRELEASE=\$IGRELEASE\" | tee -a \$LOG | $LOGGER\n";
print "echo \"KSRV=\$KSRV\" | tee -a \$LOG | $LOGGER\n";
print "echo \"SSHPORT=\$SSHPORT\" | tee -a \$LOG | $LOGGER\n";
print "echo \"SSHHOST=\$SSHHOST\" | tee -a \$LOG | $LOGGER\n";
print "echo \"IG_HOME=\$IG_HOME\" | tee -a \$LOG | $LOGGER\n";
print "echo \"IG_ETC=\$IG_ETC\" | tee -a \$LOG | $LOGGER\n";
print "\n";
printConfig('S', $c->{PTYPE}, 'LOG');
}
print "echo -e 'Post chroot Finished\\n\\n' | $LOGGER\n";
if ( $c->{PTYPE} ne 'VM' ) {
print "chvt 1\n";
print "\n%end\n\n" if ( ($c->{DIST} =~ /^CentOS-(\d+)/) && ($1 >= 6) );
#
# Post No chroot
#
sysInfo("Generating \%post NO chroot");
print "\n";
print "%post --nochroot\n";
print "\n";
print "chvt 3\n\n";
print "FLOG=$FLOG\n";
print "LOG=/mnt/sysimage/root/post-nochrt-$FLOG\n\n";
print "\n";
print "/mnt/sysimage/usr/bin/logger -t KickStart[\$\$] -p $SyslogFacility.info Post NO chroot Starting\n\n";
if ( $c->{POSTNR} eq "y" ) {
print "\n";
printConfig('N', $c->{PTYPE}, 'LOG');
}
print "\n";
print "/mnt/sysimage/usr/bin/logger -t KickStart[\$\$] -p $SyslogFacility.info Post NO chroot Finished\n\n";
print "chvt 1\n";
print "\n%end\n\n" if ( ($c->{DIST} =~ /^CentOS-(\d+)/) && ($1 >= 6) );
}
sysInfo("Finished generating ks config");
exit;
sub printConfig (@) {
my $prefix = shift;
my $type = shift;
my $log = shift || 'LOG';
if ( ($prefix) && ($type) ) {
print "\n";
if ( open(P,"$KDIR/ks.d/functions") ) {
while ( <P> ) {
print;
}
close P;
print "\n";
} else {
Warn("Could not open $KDIR/ks.d/functions");
}
if ( opendir(D, "$KDIR/ks.d") ) {
foreach my $file ( sort grep !/^\./, readdir(D) ) {
my $printConfig = 0;
if ( $type eq 'VM' ) {
if ( $file =~ /^${prefix}\d+V\-/ ) {
$printConfig = 2;
}
} elsif ( $file =~ /^${prefix}\d\d[^\d]/ ) { # Old way compat
$printConfig = 1;
} elsif ( $file =~ /^${prefix}\d+A\-/ ) {
$printConfig = 1;
} elsif ( ($type eq 'probe') && ($file =~ /^${prefix}\d+P\-/) ) {
$printConfig = 1;
} elsif ( ($type eq 'server') && ($file =~ /^${prefix}\d+S\-/) ) {
$printConfig = 1;
} elsif ( ($type eq 'listener') && ($file =~ /^${prefix}\d+L\-/) ) {
$printConfig = 1;
} elsif ( ($type eq 'ds') && ($file =~ /^${prefix}\d+D\-/) ) {
$printConfig = 1;
}
if ( $printConfig ) {
print "####\n";
print "#\n";
print "# $file\n";
print "#\n";
print "####\n";
my $logger;
if ( $type eq 'VM' ) {
print "echo\nread -p 'Proceed with $file? [Y] ' OK\n";
print qq|if [ "\$OK" = "" -o "\$OK" = "y" -o "\$OK" = "Y" ]; then\n\n|;
$logger = 'cat';
} elsif ( $prefix eq 'P' ) {
$logger = "python \/tmp\/syslog.py";
} else {
$logger = "logger -s -t KickStart[\$\$] -p $SyslogFacility.debug";
}
if ( open(F, "$KDIR/ks.d/$file") ) {
print "echo '-- Starting $file' | tee -a \$$log | $logger\n";
while ( <F> ) {
s/\#LOG/2\>\&1 \| tee \-a \$$log \| $logger/;
print;
}
close F;
print "echo '-- Done with $file' | tee -a \$$log | $logger\n";
print "\n";
} else {
Warn("Could not read $file");
}
if ( $type eq 'VM' ) {
print "\nelse\n";
print " echo\n echo Skipping $file\n";
print "fi\n";
}
}
}
closedir D;
} else {
Warn("Could not open $KDIR/ks.d");
}
} else {
Warn("Config script prefix and server type must be supplied for printConfig");
}
}
sub Log (@) {
my $priority = shift;
my $message = shift;
if ( !(defined $syslog) ) {
$syslog = new Net::Syslog( Name=>"KickStart", SyslogHost=>"$c->{KSRV}", Facility=>"$SyslogFacility" );
}
$syslog->send( "$message", Name=>"KickStart", Priority=>"$priority");
}
sub Debug (@) {
my $message = shift;
if ( $c->{DEBUG} >= 1 ) {
print "# $message\n";
Log("debug", "$message");
}
}
sub Break (@) {
print "#\n";
}
sub Info (@) {
my $message = shift;
print "# $message\n";
Log("info", "$message");
}
sub sysInfo (@) {
my $message = shift;
Log("info", "$message");
}
sub Warn (@) {
my $message = shift;
print "# WARNING: $message\n";
warn "$message\n";
Log("warn", "$message");
}
1