#!/bin/bash

var_DEFAULTFS="/boot:32:ext2:+ swap:256:swap /:7500:ext3 /home:*:ext3"
var_DESTDIR="/mnt"
var_RUNTIME_PACKAGES=
var_PKG_SOURCE_TYPE='cd'
var_FILE_URL="file:///src/core/pkg"
var_MIRRORLIST="/etc/pacman.d/mirrorlist"

###### Phases ( can be overridden by more specific profiles) ######

phase_preparation ()
{
	execute worker runtime_packages
}


phase_basics ()
{
	execute worker prepare_disks
}	


phase_system ()
{
	execute worker package_list    
	execute worker install_packages
	execute worker install_bootloader
}


phase_finish ()
{
	execute worker configure_home
}



###### Workers ( can be overridden by more specific profiles) ######
worker_runtime_packages ()
{
	for pkg in $var_RUNTIME_PACKAGES
	do
		$PACMAN -Sy --noconfirm --needed $pkg
	done
}


worker_prepare_disks ()
{
	partition # use lib-archboot function by default
}


# Put the list of packages to be installed in /home/arch/fifa/package-list
worker_package_list ()
{
	#TODO: sensible list of packages
	echo "No actions specified"
}


worker_install_packages ()
{
	target_special_fs on
	$PACMAN_TARGET -Sy $PKGLIST || die_error "Package installation FAILED."
	target_special_fs off
}


worker_install_bootlader ()
{
	#TODO: autodetection or whatever
	echo "No actions specified"
}


worker_configure_home ()
{
	echo "No actions specified"
}