1
0
mirror of synced 2026-05-03 14:58:48 +00:00
Files
xen-tools.xen-tools/etc/hook.d/90-make-fstab
steve 7c26f68fd8 2006-05-23 12:26:13 by steve
Updated hooks to work with rpmstrap.
2006-05-23 12:26:13 +00:00

81 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
#
# This script is responsible for setting up /etc/fstab upon the
# new instance.
#
# This should be a simple job, but it is complicated by some of the
# differences between filesystems - some root filesystems will require
# the installation of new packages, and we have to handle that here.
#
# Steve
# --
# http://www.steve.org.uk/
prefix=$1
#
# This function installs a package upon the guest image.
#
function install_package
{
package=$1
#
# Only install the package if we're not running under rpmstrap
#
if [ -z "${rpmstrap}" ]; then
DEBIAN_FRONTEND=noninteractive chroot ${prefix} /usr/bin/apt-get --yes --force-yes install $package
fi
}
#
# Options to mount the root filesystem with, we need to have
# different options for xfs.
#
# The default option works for ext2, ext3, and reiserfs.
#
options="errors=remount-ro"
case "${fs}" in
xfs)
options="defaults"
;;
esac
#
# Make sure we use ide style device names if required
#
device=sda
if [ "${ide}" ]; then
device=hda
fi
#
# Now we have the options we can create the fstab.
#
cat <<E_O_FSTAB > ${prefix}/etc/fstab
/dev/${device}1 / ${fs} ${options} 0 1
/dev/${device}2 none swap sw 0 0
proc /proc proc defaults 0 0
E_O_FSTAB
#
# Finally we can install any required packages for the given root
# filesystem
#
case "${fs}" in
xfs)
install_package xfsprogs
;;
reiserfs)
install_package reiserfsprogs
;;
esac