#!/usr/bin/env bash
# Created by Tobias Powalowski <tpowa@archlinux.org>

build ()
{
    ### check for root
    if ! [ $UID -eq 0 ]; then 
	echo "ERROR: Please run as root user!"
	exit 1
    fi

    ### check for TEMPDIR
    if [ $TEMPDIR = "" ]; then
	 echo "ERROR: No TEMPDIR was set, please set TEMPDIR first!"
	 exit 1
    fi

    ### check for activated testing repository
    if ! [ "$(grep '^\[testing\]' /etc/pacman.conf)" = "" ]; then 
	echo "WARNING: TESTING REPOSITORY ACTIVATED"
	echo "-------------------------------------"
	echo "POSSIBILITY OF BROKEN BINARY PACKAGES ON INSTALL MEDIA!"
	echo "Use a chroot instead to avoid those problems."
	echo "5 seconds time to cancel with CTRL+C"
	sleep 5
    fi

    # generate iso title name
    [ "${RUNPROGRAM}" = "mkisolinux" ] && echo "Arch_Linux_FTP $(uname -m)" >> ${ISONAME}
}

help ()
{
cat <<HELPEOF
  This hook sets up all you need for a arch network install image.
HELPEOF
}
