Firstly I was unsure of how to get a file(tar/package/script) into
%post. I tried several things that worked, but I'm not happy with any
of them... suggestions and obvious solutions welcome.
Attached is a build-log, the first and last parts of my ks file and the
script that builds the ks file. The resulting file is 32MB so it's not
included... but you can put your own tar file in for testing.
Any advice/solutions welcome!
--
Mike Mestnik
Technical Team
___
Nagios Enterprises, INC.
Email: mmestnik(a)nagios.com
Web:
www.nagios.com
#!/usr/bin/make -Bf
# Usage:
# make all
export MEID=$$Id: Makefile 484 2010-07-19 18:31:49Z mmestnik $$
# This file contains the commands for building the components
# zip files
#
# $Id: Makefile 484 2010-07-19 18:31:49Z mmestnik $
export LANG=C
FINDPRUNE=-name .svn -prune -o -name \*\ \* -prune -o \
-name \*\$$\* -prune -o -name \*\"\* -prune -o \
-name \*\'\* -prune -o
all: centos-livecd-minimal.nagiosxi.iso $(addsuffix .iso, $(basename \
$(shell find -mindepth 1 -maxdepth 1 $(FINDPRUNE) -name \*.ks -print)))
clean:
@rm -f *.iso
.PHONY: clean all
%.iso: %.ks
@livecd-creator --config=$< --fslabel=$(basename $<) | \
while read i; do echo $$i; [ "$$i" = "MakeFileExtrasGO." ] &&
{ \
for ech in /var/tmp/imgcreate-*/install_root/tmp/; \
do cp -v xi-latest.tar.gz $$ech; done; }; done
centos-livecd-minimal.nagiosxi.ks: centos-livecd-minimal.nagiosxi.ks-head \
xi-latest.tar.gz centos-livecd-minimal.nagiosxi.ks-tail
@cat centos-livecd-minimal.nagiosxi.ks-head > $@
@base64 xi-latest.tar.gz >> $@
@cat centos-livecd-minimal.nagiosxi.ks-tail >> $@
#
# Copyright (c) 2010 Nagios Enterprises, LLC. All rights reserved.
#
# $Id: centos-livecd-minimal+nagiosxi.ks,v 1.3 2010/08/02 21:03:53 root Exp root $
lang en_US.UTF-8
keyboard us
timezone US/Central
auth --useshadow --passalgo=sha512
selinux --disabled
firewall --disabled
skipx
repo --name=a-base --baseurl=http://ftp.osuosl.org/pub/centos/5/os/$basearch
repo --name=a-updates --baseurl=http://ftp.osuosl.org/pub/centos/5/updates/$basearch
repo --name=a-extras --baseurl=http://ftp.osuosl.org/pub/centos/5/extras/$basearch
repo --name=a-live
--baseurl=http://www.nanotechnologies.qc.ca/propos/linux/centos-live/$basearch/live
repo --name="Extra Packages for Enterprise Linux 5 - $basearch"
--mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
repo --name="Dag RPM Repository for Red Hat Enterprise Linux"
--baseurl=http://apt.sw.be/redhat/el5/en/$basearch/dag
%packages
bash
kernel
syslinux
passwd
policycoreutils
chkconfig
authconfig
rootfiles
comps-extras
xkeyboard-config
perl
make
sysstat
bzr
rpmdevtools
httpd
php
gcc
glibc
glibc-common
gd
gd-devel
mysql
mysql-server
mysql-devel
net-snmp
net-snmp-libs
net-snmp-utils
libmcrypt
libmcrypt-devel
dstat
rrdtool
php
php-mysql
xinetd
php-gd
unzip
nmap
php-pear
bind-utils
openldap
openldap-devel
fping
mrtg
postgresql
postgresql-libs
postgresql-server
php-pgsql
postgresql-devel
perl-Net-SNMP
php-mcrypt
cacti
php-snmp
expat-devel
graphviz
freetds
freetds-devel
unixODBC
unixODBC-devel
php-odbc
php-mssql
openssl
openssl-devel
unzip
rpmdevtools
phpMyAdmin
perl
perl-libwww-perl
perl-Apache-Test
perl-Time-HiRes
##perl-Getopt-Long
perl-Error
perl-Crypt-SSLeay
perl-XML-Simple
perl-XML-Parser
perl-DBD-MySQL
perl-DBD-mysql
perl-DBD-ODBC
perl-Mail-POP3Client
perl-Net-SMTP-TLS
perl-DBD-Sybase
net-snmp-perl
perl-Config-IniFiles
axel
%post
#!/bin/sh
export MEID='$Id: centos-livecd-minimal+nagiosxi.ks,v 1.3 2010/08/02 21:03:53 root Exp
root $'
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
bzr whoami "$MEID"
if [ ! -d /etc/.bzr ]; then bzr init /etc; fi
if [ ! -d /usr/local/.bzr ]; then bzr init /usr/local; fi
service httpd start
service postgresql start
cd /tmp
dat="$(<<'EOF' tr -d '\n' | base64 -d - | tar -xvzf -
EOF
)"; cd $(echo "$dat" | head -n1) || { echo "It failed."; exit 4;
}
# TODO: Perhaps there is an rpm?
# Needed for NagiosQL
pear install HTML_Template_IT
./2-usersgroups
./3-dbservers
./4-services
./5-sudoers
./7-sendmail
./9-dbbackups
./10-phplimits
./11-sourceguardian
./12-mrtg
./13-cacti
./A-subcomponents
./B-installxi
./C-cronjobs
./D-chkconfigalldaemons
./E-importnagiosql
./Z-webroot
service xinetd stop
service npcd stop
service nagiosxi stop
service nagios stop
service ndo2db stop
service httpd stop
service mysqld stop
service postgresql stop
chkconfig --level 345 xinetd on
chkconfig --level 345 npcd on
chkconfig --level 345 nagiosxi on
chkconfig --level 345 nagios on
chkconfig --level 345 ndo2db on
chkconfig --level 345 httpd on
chkconfig --level 345 mysqld on
chkconfig --level 345 postgresql on
chkconfig --level 016 xinetd off
chkconfig --level 016 npcd off
chkconfig --level 016 nagiosxi off
chkconfig --level 016 nagios off
chkconfig --level 016 ndo2db off
chkconfig --level 016 httpd off
chkconfig --level 016 mysqld off
chkconfig --level 016 postgresql off
rm -f /boot/initrd*
rm -f /usr/var/lib/rpm/__db.00*