
common_do_fstab() {
	#
	# Set up fstab
	#
	cat > root/etc/fstab << EOF
# /etc/fstab: static file system information.
#
# <file system>                                 <mount point>   <type>  <options>       <dump>  <pass>
proc                                            /proc           proc    defaults        0       0
EOF
	for ((i=0;i<${#MOUNTPOINTS[@]};i++)); do
                if [ "${MOUNTPOINTS[$i]}" = "root" ]; then
                        echo "UUID=$(cat ${MOUNTPOINTS[$i]}.uuid) /       ext3    defaults        0       1">>root/etc/fstab
                elif [ "${MOUNTPOINTS[$i]}" = "swap" ]; then
                        echo "UUID=$(cat ${MOUNTPOINTS[$i]}.uuid) swap      swap    defaults        0       1">>root/etc/fstab
                else
                        echo "UUID=$(cat ${MOUNTPOINTS[$i]}.uuid) ${MOUNTPOINTS[$i]}       ext3    defaults        0       1">>root/etc/fstab
                fi
        done
}

common_write_device_map_with_uuids() {
	echo "(hd0) UUID=$(cat ${MOUNTPOINTS[0]}.uuid)" >> target/boot/grub/device.map
}

common_write_device_map_no_uuids() {
	echo "(hd0) /dev/sd${letters[0]}" >> target/boot/grub/device.map
}

common_mangle_grub_menu_list_with_uuid() {
	rep="UUID=$(cat ${MOUNTPOINTS[0]}.uuid)"
	sed -ie "s/\/dev\/hda1/$rep/g" target/boot/grub/menu.lst
}
