#! /bin/sh

PREREQ=""

prereqs()
{
	echo "$PREREQ"
}

case $1 in
prereqs)
	prereqs
	exit 0
	;;
esac

. /scripts/functions
. /scripts/functions-uniklu

[ "$quiet" != "y" ] && log_begin_msg "Initializing local disks"
if [ "${BOOT}" = "installimage" ]; then
  # prepare local partitions for grub installation:
  mkdir -p /target
  ${MOUNT} -t ext3 LABEL=UNIKLU /target || MOUNTFAILED="yes"
  if [ "$MOUNTFAILED" = "yes" ]; then
    panic "mounting /target failed again!"
  fi
  FOUNDLOCAL=""
  mkdir -p /local
  ${MOUNT} -t ext3 -o nosuid LABEL=LOCAL /local && FOUNDLOCAL="yes"
  if [ "${FOUNDLOCAL}" = "yes" ]; then
    [ "$quiet" != "y" ] && _log_msg "adding local partition to fstab"
    cat >> /target/etc/fstab <<EOT
LABEL=LOCAL /local ext3 defaults,nosuid 0 2
EOT
    mkdir -p /target/local
    /bin/umount /local
  else
    rmdir /local
  fi
fi

[ "$quiet" != "y" ] && log_end_msg

