#!/bin/sh
# Copyright (c) 2009 Alon Swartz <alon@turnkeylinux.org> - all rights reserved
# Executes firstboot and everyboot scripts

DESC="Initialization hooks"
NAME=inithooks

# Exit if openvt is not available
which openvt >/dev/null || exit 0

. /lib/lsb/init-functions
. /etc/default/inithooks

case "$1" in
  start)
    log_begin_msg "Starting $DESC"
    setterm -blank 0
    chvt 1
    openvt -c 8 -s -w -- $INITHOOKS_PATH/run
    log_action_end_msg $?
    ;;

  stop)
    exit 0
    ;;

  restart|reload|force-reload)
    echo "Error: argument '$1' not supported" >&2
    exit 3
    ;;

  *)
    N=/etc/init.d/$NAME
    echo "Usage: $N {start}" >&2
    exit 1
    ;;
esac

exit 0
