Last change
on this file since 71c9190 was 2167cfe, checked in by William Harrington <kb0iic@…>, 11 years ago |
bootscripts are the scripts used for the sysvinit book.
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/bin/bash
|
---|
2 | # Begin $network-devices/services/dhcpcd
|
---|
3 |
|
---|
4 | # Based upon lfs-bootscripts-1.12 $network_devices/if{down,up}
|
---|
5 | # Rewritten by Nathan Coulson <nathan@linuxfromscratch.org>
|
---|
6 | # Adapted for dhcpcd by DJ Lucas <dj@lucasit.com>
|
---|
7 |
|
---|
8 | . /etc/sysconfig/rc
|
---|
9 | . $rc_functions
|
---|
10 | . $IFCONFIG
|
---|
11 |
|
---|
12 | pidfile="/var/run/dhcpcd-$1.pid"
|
---|
13 |
|
---|
14 | case "$2" in
|
---|
15 | up)
|
---|
16 | boot_mesg -n "Starting DHCPCD on the $1 interface..."
|
---|
17 | # Test to see if there is a stale pid file
|
---|
18 | if [ -f "$pidfile" ]; then
|
---|
19 | ps `cat "$pidfile"` | grep dhcpcd > /dev/null
|
---|
20 | if [ $? != 0 ]; then
|
---|
21 | rm -f $pidfile > /dev/null
|
---|
22 | else
|
---|
23 | boot_mesg "dhcpcd already running!" ${WARNING}
|
---|
24 | echo_warning
|
---|
25 | exit 2
|
---|
26 | fi
|
---|
27 | fi
|
---|
28 | /sbin/dhcpcd $1 $DHCP_START
|
---|
29 | # Save the return value
|
---|
30 | RET="$?"
|
---|
31 | echo ""
|
---|
32 | $(exit "$RET")
|
---|
33 | evaluate_retval
|
---|
34 | ;;
|
---|
35 |
|
---|
36 | down)
|
---|
37 | boot_mesg -n "Stopping DHCPCD on the $1 interface..."
|
---|
38 | if [ -z "$DHCP_STOP" ]; then
|
---|
39 | echo ""
|
---|
40 | killproc -p "$pidfile" /sbin/dhcpcd
|
---|
41 | else
|
---|
42 | /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null
|
---|
43 | RET="$?"
|
---|
44 | if [ "$RET" -eq 0 ]; then
|
---|
45 | echo ""
|
---|
46 | echo_ok
|
---|
47 | elif [ "$RET" -eq 1 ]; then
|
---|
48 | boot_mesg "dhcpcd not running!" ${WARNING}
|
---|
49 | echo_warning
|
---|
50 | else
|
---|
51 | echo ""
|
---|
52 | echo_failure
|
---|
53 | fi
|
---|
54 | fi
|
---|
55 | ;;
|
---|
56 |
|
---|
57 | *)
|
---|
58 | echo "Usage: $0 [interface] {up|down}"
|
---|
59 | exit 1
|
---|
60 | ;;
|
---|
61 | esac
|
---|
62 |
|
---|
63 | # End $network_devices/services/dhcpcd
|
---|
Note:
See
TracBrowser
for help on using the repository browser.