# Calculate twice the size of the installed memory, in MB
MEM=$(cat /proc/meminfo|sed -n 's/MemTotal: *([0-9]+) kB/1/p')
SIZE=$(( $MEM * 2 / 1024 ))
# Create the file /tmp/swap.cfg
echo 'logvol swap --vgname=main --size=$SIZE --name=swap' >/tmp/swap.cfg
The %pre option identifies this part of the file as a preinstallation script. Place this script at the end of the Kickstart file; it will produce the file
You can then replace the swap partition line in the Kickstart file with an option that refers to the
# LVs for root (10GB), /home (35GB), /var (35GB), and swap (RAM * 2),
# leaving about 20 GB available for snapshots and future expansion
# of the LVs.
%include /tmp/swap.cfg
logvol / --vgname=main --size=10000 --name=root --fstype=ext3
logvol /home --vgname=main --size=35000 --name=home --fstype=ext3
logvol /var --vgname=main --size=35000 --name=var --fstype=ext3
Preinstallation scripts cannot change the installation source.
10.4.3.3. ...performing customization after installation?
The Kickstart file can also include a script that is run after installation, using the %post option. Here is an example:
% post
# Add aliases to /etc/bashrc:
echo 'alias l='ls -l'' >>/etc/bashrc
echo 'alias cls='clear'' >>/etc/bashrc
# Change the login welcome message for text consoles
echo 'Welcome to Fedora Core!' >/etc/issue
# Place a copy of acceptable-use-policy.txt
# in /etc/skel so that it will be copied to each
# new user's home diretory.
cd /etc/skel
wget http://192.168.1.2/text/acceptable-use-policy.txt
# Configure httpd to start automatically on boot
/sbin/chkconfig httpd on
Post-installation scripts cannot reliably use hostnames; any IP addresses must be specified numerically.
10.4.3.4. ...installing a system with the same configuration as another, previously installed system?
Whenever you install a system, the configuration used for that system is written into the file
10.4.4. Where Can I Learn More?
? The
? 'Hands-Off Fedora Installs with Kickstart,' by Ethan McCallum: http://www.linuxdevcenter.com/pub/a/linux/2004/08/19/kickstart.html
? The Fedora Wiki page with information on Kickstart: http://fedoraproject.org/wiki/AnacondaKickstartIntegration
10.5. Configuring the GRUB Bootloader
GRUB is a powerful bootloader that can be used to boot Linux, Windows, DOS, and other operating systems as well as the Xen virtualization system. By mastering its configuration file and command-line options, you can configure GRUB to boot exactly the way you want.
10.5.1. How Do I Do That?
GRUB is configured through the file
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/main/root
# initrd /initrd-version.img