iredmail / extra / ks.cfg

#
# Kickstart file used to customize iRedOS. Provided by iRedMail project:
# http://code.google.com/p/iredmail/
#

# Used for interactive installation.
#interactive

# Install OS instead of upgrade
install

# Installation method.
cdrom

# For RHEL 5.x
#key --skip

# System authorization information
auth  --useshadow  --enablemd5

# System keyboard
#keyboard us

# System language. It will affect both installation interface and
# system after installation complete.
#lang en_US

# Installation logging level: debug, info, warning, error, critical.
#logging --level=debug
logging --level=critical

# SELinux configuration
selinux --disabled

# Do not configure the X Window System
skipx

# System timezone. Do not use '--utc' option here.
#timezone Asia/Hong_Kong

# Use graphical/text install
graphical

# Enable/Disable services, seperated by comma.
# Options: --enabled/disabled
services --enabled=network

# -------------------
# ---- Test only ----
# -------------------
# System bootloader configuration
#bootloader --location=mbr

# Clear the Master Boot Record
#zerombr

# Partition clearing information
#clearpart --all --initlabel 

#Root password: redhat
#rootpw --iscrypted $1$h7EtIFv4$R9JQ4aCOVN7E9ml3A2SXv.

# Run the Setup Agent on first boot
firstboot --disable

# Network information
network --onboot=yes --bootproto=query --hostname='iredos.iredmail.org'

# Disk partitioning information
#part swap --bytes-per-inode=4096 --fstype="swap" --size=512
#part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1

# -------------------

# For more kickstart options, please refer:
# http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-options.html
# -------------------------------------------
# Packages.
# -------------------------------------------
%packages --excludedocs
basesystem
kernel

-rmt
-dump
-amtu
-anacron
-acpid
-apmd
-at
-ftp
-redhat-lsb
-atk
-gtk2
-GConf2
-bluez-gnome
-bluez-utils
-notification-daemon
-libwnck
-libnotify
-attr
-audit
-audit-libs-python
-setools
-authconfig
-firstboot-tui
-autofs
-bc
-bluez-libs
-cairo
-pango
-paps
-cups
-ccid
-coolkey
-cpuspeed
-Deployment_Guide-en-US
-dhcpv6_client
-finger
-hdparm
-dmraid
-NetworkManager
-smartmontools
-ppp
-rp-pppoe
-ecryptfs-utils
#-rhn-client-tools
#-rhn-check
#-yum-rhn-plugin
#-rhnsd
#-rhn-setup
-hesiod
-sendmail
-ifd-egate
-pcsc-lite
-gpm
-ipsec-tools
-libselinux-python
-ksh
-mailcap
-nano
-nc
-mtools
-syslinux
-mkbootdisk
-net-snmp-libs
-OpenIPMI
-redhat-menus
-htmlview
-pinfo
-mgetty
-specspo
-nscd
-nss_ldap
-nfs-utils-lib
-nfs-utils
-portmap
-ypbind
-yp-tools
-quota
-lsof
-irqbalance
-system-config-securitylevel-tui
-crash
-conman
-cryptsetup-luks
-dbus-python
-yum-updatesd
-dosfstools
-gnu-efi
-iptstate
-microcode_ctl
-mtr
-pam_smb
-parted
-pax
-pm-utils
-psacct
-pygobject2
-rdate
-rdist
-rhel-instnum
-rsh
-sos
-talk
-tcsh
-telnet
-exim
# ------------------------
# Required packages.
# ------------------------
# Required by postfix (/etc/pam.d/smtp.postfix)
policycoreutils
selinux-policy
selinux-policy-targeted

ntp
man
man-pages
lynx
wget
mailx
openssh-server
openssh-clients
unzip
bzip2
dhclient
vim-minimal
system-config-network-tui
iptables
tmpwatch
acl
createrepo
vixie-cron
crontabs
dialog
patch
yum
which
kbd
dos2unix
logwatch

# Post macro.
%post --nochroot
# Mount CD-ROM, will be used after chroot.
mkdir -p /mnt/sysimage/mnt/
mount -t iso9660 /tmp/cdrom /mnt/sysimage/mnt

%post

# Change tty, we need interactive mode.
chvt 3

exec < /dev/tty3 > /dev/tty3

echo -e "\n\n* ---- Starting iRedMail Installation ----"

# Set LC_ALL.
echo "* Export LC_ALL"
export LC_ALL=C

# Set PATH.
echo "* Set PATH"
export PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

# Repo file.
echo "* Set yum repository related variables: REPOFILE, REPOFILE, REPOURL"
export REPOFILE='/etc/yum.repos.d/iRedMail.repo'
export REPONAME='iRedMail'
export REPOURL='http://iredmail.org/yum/rpms/5/'

# Get hostname from file.
echo "* Get HOSTNAME via cmd 'hostname --fqdn'."
export HOSTNAME="$(hostname --fqdn)"

# Copy /etc/skel/.*
echo "* Copy /etc/skel/*"
cp -rf /etc/skel/.bash* /root/ >/dev/null 2>&1

# We need network, but loopback device is enough.
echo "* Active loop back network interface: lo."
/sbin/ifconfig lo up

# Create yum repo file for iRedMail.
echo "* Generate temp yum repo file: ${REPOFILE}"
cat > ${REPOFILE} <<EOF
[${REPONAME}]
name=${REPONAME}
baseurl=file:///mnt/
enabled=1
gpgcheck=0
priority=1
EOF

# We need write-access.
echo "* Copy iRedMail from CDROM to disk: /root/iRedMail"
cp -rf /mnt/iRedMail/ /root/

# Change directory.
echo "* Change directory to /root/iRedMail/"
cd /root/iRedMail/

#
# Run iRedMail.sh:
#

echo "* Set necessary variables for iRedMail."
# Skip some steps.
export status_get_all="DONE"
# Don't create a new yum repo.
export status_create_yum_repo="DONE"
# Don't disable iredmail repo.
export status_disable_iredmail_repo="DONE"
# Don't run freshclam.
export status_run_freshclam_now="DONE"
# Don't start postfix.
export status_start_postfix_now="DONE"
# Don't upgrade php-pear now.
export status_cleanup_upgrade_php_pear="DONE"

# Setting command used to install pkgs.
export YUM="yum -d 2 --disablerepo=os,base,updates,addons,extras,centosplus,c5-media --enablerepo=${REPONAME}"

echo "* Sleeping 10 seconds before starting iRedMail installation wizard."
for i in 10 9 8 7 6 5 4 3 2 1; do
    echo -n " ${i}s" && sleep 1
done
echo '.'

echo "* Start iRedMail installation."
# Answer some questions automatic:
#   - Y: Continue install packages after configure complete.
#   - Y: Use iptables rule file shipped within iRedMail?
#   - N: Restart iptables now?
#   - Y: Use MySQL config file (/etc/my.cnf) shipped within iRedMail?
#   - N: Start postfix now?
sh iRedMail.sh <<EOF
Y
Y
N
Y
N
EOF

# Read iRedMail config.
. config

if [ X"${BACKEND}" == X"OpenLDAP" ]; then
    echo "* Install php pear package: Net_LDAP2."
    pear install /root/iRedMail/pkgs/misc/Net_LDAP2-2.0.9.tgz
fi

# Clear yum repo metadata.
yum clean all 2>/dev/null

# Re-generate yum repo file, used for softwares update.
cat > ${REPOFILE} <<EOF
[${REPONAME}]
name=${REPONAME}
baseurl=${REPOURL}
enabled=1
gpgcheck=0
priority=1
EOF

# Return to default installation tty.
grep '\<text\>' /proc/cmdline >/dev/null 2>&1
if [ X"$?" == X"0" ]; then
    # For text installation mode.
    chvt 1
    exec < /dev/tty1 > /dev/tty1
else
    # For graphical installation mode.
    chvt 6
    exec < /dev/tty6 > /dev/tty6
fi
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.