1#!/bin/sh
2#
3# dhcp6c        dhcp6c is an implementation of DHCPv6 client.
4#               This shell script takes care of starting and stopping
5#               dhcp6c.
6#
7# chkconfig: - 67 37
8# description: dhcp6c supports client side of Dynamic Host Configuration
9#              Protocol for IPv6.
10# processname: dhcp6c
11# config: /etc/dhcp6c.conf
12# config: /etc/sysconfig/dhcp6c
13
14# Source function library.
15. /etc/rc.d/init.d/functions
16
17# Source networking configuration.
18. /etc/sysconfig/network
19. /etc/sysconfig/dhcp6c
20
21# Check that networking is up.
22[ ${NETWORKING} = "no" ] && exit 0
23
24# Check that files exist
25[ -f /usr/local/sbin/dhcp6c ] || exit 0
26[ -f /etc/dhcp6c.conf ] || exit 0
27[ ${DHCP6CIF} = "" ] && exit 0
28
29RETVAL=0
30prog="dhcp6c"
31
32start() {
33	# Start daemons.
34	echo -n $"Starting $prog: "
35	daemon /usr/local/sbin/dhcp6c -c /etc/dhcp6c.conf ${DHCP6CARGS} ${DHCP6CIF}
36	RETVAL=$?
37	echo
38	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcp6c
39	return $RETVAL
40}
41
42stop() {
43	# Stop daemons.
44	echo -n $"Shutting down $prog: "
45	killproc dhcp6c
46	RETVAL=$?
47	echo
48	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcp6c
49	return $RETVAL
50}
51
52release() {
53	# Release addresses.
54	echo -n $"Releasing assigned addresses $prog: "
55	daemon /usr/local/sbin/dhcp6c ${DHCP6CARGS} -r all ${DHCP6CIF}
56	RETVAL=$?
57	echo
58	return $RETVAL
59}
60
61# See how we were called.
62case "$1" in
63  start)
64	start
65	;;
66  stop)
67	stop
68	;;
69  restart|reload)
70	stop
71	start
72	RETVAL=$?
73	;;
74  condrestart)
75	if [ -f /var/lock/subsys/dhcp6c ]; then
76	    stop
77	    start
78	    RETVAL=$?
79	fi
80	;;
81  status)
82	status dhcp6c
83	RETVAL=$?
84	;;
85  release)
86	[ ! -f /var/lock/subsys/dhcp6c ] || exit 0
87	release dhcp6c
88	RETVAL=$?
89	;;
90  *)
91	echo $"Usage: $0 {start|stop|restart|condrestart|status|release}"
92	exit 1
93esac
94
95exit $RETVAL
96