#!/bin/sh
# (C) 2009 Stephane GALLAND <galland@arakhne.org>

### BEGIN INIT INFO
# Provides:          ricoh-webcam-r5u870
# Required-Start:    $syslog $local_fs
# Required-Stop:     $syslog $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      1
# Short-Description: Ricoh Webcam Driver
# Description:       r5u8709 is a kernel module for the Ricoh webcams.
### END INIT INFO

PATH=$PATH:/bin:/sbin:/usr/sbin

. /lib/lsb/init-functions

. /etc/default/ricoh-webcam-r5u870

if [ "$LOAD_RICOHWEBCAM_MODULE" = 1 ]; then
	case "$1" in
	  start)
	  	log_action_begin_msg 'Starting Ricoh Webcam Modules';
		modprobe --quiet usbcam && modprobe --quiet r5u870
		log_end_msg $?
		;;
	  stop)
	  	log_action_begin_msg 'Stopping Ricoh Webcam Modules';
		modprobe --quiet -r r5u870 usbcam
		log_end_msg $?
		;;
	  restart|reload|force-reload)
		$0 stop
		$0 start
		;;
	  *)
	  	echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
		exit 1
		;;
	esac

fi

exit 0
