#!/bin/sh
[ -e /etc/rc.defaults ] && . /etc/rc.defaults
[ -e /etc/rc.conf ] && . /etc/rc.conf

if [ -z $RM_calledfrom ]
then
	RM_calledfrom=0
fi

#if [ -e /etc/rc.conf -a "$RM_calledfrom" != "1" ]
#then
#	if [ "$1" != "-f" ]
#	then
#		echo "/etc/rc.conf already exists!"
#		echo "use 'cfg_rc -f' to force overwrite"
#		exit 1
#	fi
#fi

if [ "$RM_calledfrom" != "1" ]
then
	replimenu -f /usr/share/replimenu/netwfc.menu
else
#Bodge to generate new lines as \n doesn't seem to work....
echo "Generating network"
#export | grep RM_*
echo "# Generated by cfg_netwfc
wfc_config=$RM_wfc
network_method=netwfc
">/etc/network
echo "Finished"
export RM_calledfrom=
exit 0 
fi
