"target" is also the name used in the debian installer for the installation target while "prefix" is too ambiguous.
77 lines
2.0 KiB
Bash
Executable File
77 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# This script sets up the kernel and fstab for CentOS 5.
|
|
#
|
|
|
|
TARGET=$1
|
|
|
|
#
|
|
# Source our common functions
|
|
#
|
|
if [ -e /usr/share/xen-tools/common.sh ]; then
|
|
. /usr/share/xen-tools/common.sh
|
|
else
|
|
. ./hooks/common.sh
|
|
fi
|
|
|
|
#
|
|
# Log our start
|
|
#
|
|
|
|
logMessage Script $0 starting
|
|
|
|
# Make the console work
|
|
sed -i "/Cancelled/ {G;s/$/co:2345:respawn:\/sbin\/mingetty console/;}" ${TARGET}/etc/inittab
|
|
sed -i "s/^1:2345/#1:2345/" ${TARGET}/etc/inittab
|
|
|
|
# MAKEDEV is needed at this point
|
|
chroot ${TARGET} ln -s /sbin/MAKEDEV /dev/MAKEDEV
|
|
chroot ${TARGET} /sbin/MAKEDEV sda sdb sdc sdd
|
|
|
|
# Create fstab
|
|
logMessage Create /etc/fstab
|
|
cat > ${TARGET}/etc/fstab << EOF
|
|
# /etc/fstab: static file system information.
|
|
#
|
|
# <file system> <mount point> <type> <options> <dump> <pass>
|
|
proc /proc proc defaults 0 0
|
|
none /dev/pts devpts mode=0620 0 0
|
|
EOF
|
|
|
|
for i in `seq 1 $NUMPARTITIONS`; do
|
|
echo -n "/dev/xvde$i " >> ${TARGET}/etc/fstab
|
|
eval part=\$PARTITION$i
|
|
if [ ! -z "`echo $part | grep swap`" ]; then
|
|
echo "none swap ws 0 0" >> ${TARGET}/etc/fstab
|
|
else
|
|
echo $part | awk -F: '{print $4,$3,$5,0,1}' >> ${TARGET}/etc/fstab
|
|
fi
|
|
done
|
|
|
|
# Install the kernel, grub and perl
|
|
chroot ${TARGET} yum clean expire-cache
|
|
chroot ${TARGET} yum -y install kernel-xen grub.x86_64 perl.x86_64
|
|
|
|
KERNELVERSION=`ls ${TARGET}/boot/vmlinuz-* | sed "s#${TARGET}/boot/vmlinuz-##"`
|
|
logMessage "Kernel $KERNELVERSION found"
|
|
|
|
# Create grub's menu.list
|
|
logMessage "Creating /boot/grub/menu.lst"
|
|
mkdir -p ${TARGET}/boot/grub
|
|
cat > ${TARGET}/boot/grub/menu.lst << EOF
|
|
# WARNING : Don't forget to update this when you upgrade kernel !
|
|
# You can also exclude kernel-xen from updates by putting
|
|
# exclude=kernel-xen in in [main] in yum.conf
|
|
|
|
default=0
|
|
timeout=5
|
|
title CentOS ($KERNELVERSION)
|
|
kernel /boot/vmlinuz-$KERNELVERSION xen_pv_hvm=enable elevator=noop
|
|
initrd /boot/initrd-$KERNELVERSION.img
|
|
EOF
|
|
|
|
#
|
|
# Log our finish
|
|
#
|
|
logMessage Script $0 finished
|