Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > 46d62901697d633ce58cd311ed6f1ef2 > files > 12

networkmanager-0.8.4.0-5.mga1.i586.rpm

#!/bin/sh
#
# NetworkManager:   NetworkManager daemon
#
# chkconfig: - 98 02
# description:  This is a daemon for automatically switching network \
#               connections to the best available connection.
#
# processname: NetworkManager
# pidfile: /var/run/NetworkManager/NetworkManager.pid
#
### BEGIN INIT INFO
# Provides: networkmanager
# Required-Start: $network messagebus
# Should-Start: $named $syslog resolvconf
# Required-Stop: $network messagebus
# Should-Stop: $syslog
# Default-Start: 3 4 5
# Short-Description: Daemon for automatically switching to best network connection.
# Description: This is a daemon for automatically switching network
#              connections to the best available connection.
### END INIT INFO

prefix=/usr
exec_prefix=/usr
sbindir=/usr/sbin

NETWORKMANAGER_BIN=${sbindir}/NetworkManager

# Sanity checks.
[ -x $NETWORKMANAGER_BIN ] || exit 1

# Source function library.
. /etc/rc.d/init.d/functions

# Source network configuration
. /etc/sysconfig/network

# so we can rearrange this easily
processname=NetworkManager
servicename=NetworkManager
pidfile=/var/run/NetworkManager/NetworkManager.pid

RETVAL=0

start()
{
	gprintf "Setting network parameters... \n"
	sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1

	gprintf "Starting NetworkManager daemon: "
	daemon --check $servicename $processname --pid-file=$pidfile
	RETVAL=$?
	echo
	if [ -n "${NETWORKWAIT}" ]; then 
		[ -z "${LINKDELAY}" ] && LINKDELAY=10
		gprintf "Waiting for network..."
		nm-online -q --timeout=$LINKDELAY || nm-online -q -x --timeout=30
		[ "$?" = "0" ] && success "network startup" || failure "network startup"
		echo
		[ -n "${NETWORKDELAY}" ] && /bin/sleep ${NETWORKDELAY}
	fi
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
}

stop()
{
	gprintf "Stopping NetworkManager daemon: "
	killproc -p $pidfile $servicename
	RETVAL=$?
	echo
	if [ $RETVAL -eq 0 ]; then
		rm -f /var/lock/subsys/$servicename
		rm -f $pidfile
	fi
}

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	status)
		status -p $pidfile $processname
		RETVAL=$?
		;;
	restart)
		stop
		start
		;;
	condrestart)
		if [ -f /var/lock/subsys/$servicename ]; then
			stop
			start
		fi
		;;
	*)
		gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" "$0"
		;;
esac
exit $RETVAL