#!/bin/sh
#
# network
# chkconfig: 2345 10 90

rcnetwork="/etc/rc.d/rc.network"

# See how we were called.
case "$1" in
	start)
		test -x "$rcnetwork" && exec "$rcnetwork"
		# on exec failure
		exit 1
		;;
	stop|restart|reload)
		# no action
		exit 0
		;;
	status)
		test -x "$rcnetwork" && echo "Controlled by $rcnetwork"
		echo "Currently active devices:"
		ip -o address list scope global \
		| sed -nre '/inet6?/{s,^[0-9]+:\s+,,g;s,\s+scope.*,,g;s,/([0-9]+).*,/\1,g;s,\s+,\t,g;p}'
		exit 0
		;;
	*)
		echo "Error in command line: $*"
		echo "Usage:"
		echo "$0 start"
		echo " - bring up the network subsystem"
		echo "$0 stop|restart|reload"
		echo " - accepted for compatibility, but does nothing"
		echo "$0 status"
		echo " - show configured network devices"
		exit 1
esac

exit 0
