Sophie

Sophie

distrib > Mageia > 2 > i586 > media > core-release-src > by-pkgid > 608f16115e436dc19451e8617daf402c > files > 8

resolvconf-1.46-1.mga1.src.rpm

#!/bin/sh
#
# resolvconf  --  Nameserver information manager
#
# This script is part of the resolvconf package
# See /usr/share/doc/resolvconf/copyright
#
# chkconfig: 2345 09 90
# description: resolvconf is a nameserver information manager
#
### BEGIN INIT INFO
# Provides: resolvconf
# Default-Start: 2 3 4 5
# Short-Description: Nameserver information manager
# Description: resolvconf is a nameserver information manager
### END INIT INFO

# Don't use set -e; check return status instead

NAME=resolvconf
RUN_DIR=/etc/resolvconf/run
IFACE_DIR="${RUN_DIR}/interface"
ENABLE_UPDATES_FLAGFILE="${RUN_DIR}/enable-updates"

. /etc/init.d/functions

update()
{
	[ -e "$ENABLE_UPDATES_FLAGFILE" ] || return 0
	cd "$IFACE_DIR"
	# "update" scripts must assume that interface files are in the PWD
	run-parts ${1:+--arg="$1"} ${2:+--arg="$2"} /etc/resolvconf/update.d
}

enable_updates()
{
	: >| "$ENABLE_UPDATES_FLAGFILE"
}

disable_updates()
{
	rm -f "$ENABLE_UPDATES_FLAGFILE"
}

case "$1" in
start)
	# The "start" method should _only_ be used at boot time.
	# If you want to update the resolv.conf file then use "reload".
	# On package upgrade, don't run this.
	gprintf "Starting %s: " $NAME

	if enable_updates; then
		update -i
		RETVAL=$?
	else
		RETVAL=1
	fi
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
	[ $RETVAL -eq 0 ] && success || failure
	echo
	exit $RETVAL
	;;
stop)
	gprintf "Stopping %s: " $NAME
	disable_updates
	rm -f /var/lock/subsys/$NAME
	success
	echo
	exit 0
	;;
status)
	[ -f "$ENABLE_UPDATES_FLAGFILE" ]
	RETVAL=$?
	[ $RETVAL -eq 0 ] && gprintf "%s is running\n" $NAME || gprintf "%s is stopped\n" $NAME
	exit $RETVAL
	;;
restart)
	gprintf "Restarting %s: " $NAME
        if enable_updates; then 
                update
                RETVAL=$?
        else
                RETVAL=1
        fi
        [ $RETVAL -eq 0 ] && success || failure
        echo
	exit $RETVAL
	;;
reload|force-reload)
	update
	exit $?
	;;
enable-updates)
	enable_updates
	exit $?
	;;
disable-updates)
	disable_updates
	exit $?
	;;
*)
	echo "Usage: %s {start|stop|status|reload|restart|force-reload|enable-updates|disable-updates}" >&2
	exit 3
	;;
esac