#!/bin/sh

### BEGIN INIT INFO
# Provides:          uptrack-late
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs $network
# Default-Start:     S
# Default-Stop:      0 6
# Short-Description: Prefetches new Uptrack updates at boot time.
# Description: Prefetches new Uptrack updates at boot time.
### END INIT INFO

UPTRACK="/usr/sbin/uptrack-upgrade"

[ -x "$UPTRACK" ] || exit 0

# Define LSB log_* functions.
. /lib/lsb/init-functions

case "$1" in
  start)
        UPTRACK_ARGS="--late-init"
	log_begin_msg "Downloading any new Ksplice Uptrack updates..."
	"$UPTRACK" $UPTRACK_ARGS
	log_end_msg $?
	;;
  stop)
        UPTRACK_ARGS="--shutdown"
	log_begin_msg "Saving Ksplice Uptrack state..."
	"$UPTRACK" $UPTRACK_ARGS
	log_end_msg $?
	;;
  restart|force-reload)
	echo "Error: There is no Uptrack daemon to $1:"
	echo "  You never need to invoke the Uptrack init script manually."
	exit 1
	;;
  *)
    echo "Usage: /etc/init.d/uptrack {start|stop}"
    exit 1
	;;
esac
exit 0
