#!/sbin/runscript
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /etc/init.d/saier$

#depend() {
#}
checkconfig() {
		if [ ! -f "/etc/xmuruijie.conf" ] ; then
			eerror "You must set configs in /etc/xmuruijie.conf first"
			return 1
		fi
}

DEV=$(sed -n '/interface/p' /etc/xmuruijie.conf | awk '{print $2}')

start() {
	checkconfig || return 1

	ebegin "Bring up Net-Interface"
		#echo "nameserver 210.34.0.18" > /etc/resolv.conf
		/etc/init.d/net.${DEV} start
	eend $?
	ebegin "Modify firewall rules"
		/etc/init.d/localip start
	eend $?
	ebegin "Start XMU-Ruijie in Static Mode"
		/usr/sbin/xmuruijie -dS
	eend $?
}

stop() {
	ebegin "Modify firewall rules"
		/etc/init.d/localip stop
	eend $?
	ebegin "Stopping XMU-Ruijie"
		/usr/sbin/xmuruijie -p
	eend $?
	ebegin "Bring Down Net-Interface"
		/etc/init.d/net.${DEV} stop
		#echo "" > /etc/resolv.conf
	eend $?
}

