#!/bin/sh -e
#
# Report the current network status

if [ -x /sbin/ifconfig ] ; then
	/sbin/ifconfig -a | sed "s%^%info: $0: ifconfig: %" || true
else
	echo "error: $0: Unable to find /sbin/ifconfig"
fi

if [ -x /sbin/route ] ; then
	/sbin/route -n | sed "s%^%info: $0: route: %" || true
else
	echo "error: $0: Unable to find /sbin/route"
fi

if [ -x /usr/bin/nmap ] ; then
	/usr/bin/nmap localhost 2>&1 | sed "s%^%info: $0: nmap: %" || true
else
	echo "error: $0: Unable to find /sbin/nmap"
fi
	
if [ -x /sbin/showmount ] ; then
	/sbin/showmount -e localhost 2>&1 | sed "s%^%info: $0: showmount: %" || true
else
	echo "error: $0: Unable to find /sbin/showmount"
fi
	
if [ -f /etc/resolv.conf ] ; then
	cat /etc/resolv.conf | sed "s%^%info: $0: resolv.conf: %" || true
else
	echo "error: $0: Unable to find /etc/resolv.conf"
fi

if [ -f /etc/hosts ] ; then
	cat /etc/hosts | sed "s%^%info: $0: hosts: %" || true
else
	echo "error: $0: Unable to find /etc/hosts"
fi
if [ -x /usr/bin/rpcinfo ] ; then
	/usr/bin/rpcinfo -p localhost 2>&1 | sed "s%^%info: $0: rpcinfo: %" || true
else
	echo "error: $0: Unable to find /usr/bin/rpcinfo"
fi
