I've created a kickstart FTP config that I'm using to perform remote,
unattended upgrades of some of my >= 6.1 systems to 9. Has worked
flawlessly except on those systems for which their was insufficient swap
space allocated. Anaconda pops up with the nice little UI prompting for
swap file creation. If one responds affirmatively, the upgrade
continues and completes successfully. How can I automate the check of
this swap file creation? Is there a "standard" way of doing so?
I was just toying with the following idea. To be added to the %pre stanza:
%pre
# get size of ram and swap
mem=$(grep ^MemTotal: /proc/meminfo | awk '{print $2}')
swap=$(grep ^SwapTotal: /proc/meminfo | awk '{print $2}')
check=$((mem*2))
# create additional swap file, if required
[ $swap -lt $check ] && {
size=$((check-$swap)
disk=$(df -t ext2 -t ext3 | sort -k 4n,5 | tail -1)
part=$(echo $disk | awk '{print $6}')
avail=$(echo $disk | awk '{print $4}')
echo "Creating swap file ${part}/swapfile of size $size"
# insufficient disk space on partition with most space to create
swap file of required size
[ $avail -lt $size ] && {
echo "Insufficient free space ($avail) on $part to create swap
file of size $size"
exit 1
}
dd if=/dev/zero of=${part}/swapfile bs=1024 count=$size
chmod 600 ${part}/swapfile
mkswap ${part}/swapfile
# find /etc/fstab and add swap file to same - where mounted for install?
}
--
Regards,
Scott Dudley