#! /bin/sh
### BEGIN INIT INFO
# Provides:          loadipv6
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Load IPv6 module
# Description:       This file should be used to load IPv6 module
### END INIT INFO

# Author: Tommi Saviranta <wnd@iki.fi>

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="IPv6"
NAME=ipv6.ko
ENVFILE=@ENVFILE@
SCRIPTNAME=/etc/init.d/$NAME

LIVEFILE=/usr/lib/loadipv6

# Exit if the package is not installed
[ -f "$LIVEFILE" ] || exit 0

# Find module and exit if it's not found
MOD=$(find /mnt/initfs/lib/modules/$(uname -r)/ipv6.ko | head -1)
[ "$MOD" ] || exit 0

case "$1" in
  start)
	[ "$VERBOSE" != no ] && echo -n "Starting $DESC: $NAME"
	/sbin/lsmod | grep -q ipv6 || /sbin/insmod "$MOD"
	RETVAL="$?"
	case "$RETVAL" in
		0) [ "$VERBOSE" != no ] && echo "." ;;
		*) [ "$VERBOSE" != no ] && echo ". Failed!" ;;
	esac
	[ $RETVAL -ne 0 ] && exit 1
	;;
  stop)
	;;
  restart|force-reload)
	;;
  *)
	echo "Usage: $SCRIPTNAME start" >&2
	exit 3
	;;
esac

:
