#!/bin/sh
#
# Insert/remove IPv6 modules if enabled
#

IAP_BASE=/system/osso/connectivity/IAP
IPV6_KEY=$IAP_BASE/ipv6_enabled


# Is ipv6 enabled or not
ENABLED=`gconftool-2 -g "$IPV6_KEY"`
if [ $? -ne 0 ]; then
    echo "Cannot enable IPv6 from gconf ($IPV6_KEY)"
    exit 0
fi

if [ -z "$ENABLED" -o "$ENABLED" = "0" ]; then
    echo "IPv6 not enabled"
    exit 0
fi


case "$1" in
    start)
          osso-ipv6-enable.sh --modules --only
	  ;;
    stop)  
          osso-ipv6-disable.sh --modules --only
	  ;;
    force-reload)
          $0 restart
	  ;;
    restart)
          $0 stop
	  $0 start
	  ;;

  *)
          echo "Use: $0 {start|stop}" >&2
	  exit 1
	  ;;
esac

exit 0
