/[pkgs]/devel/dhcp/56dhclient
ViewVC logotype

Contents of /devel/dhcp/56dhclient

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Oct 13 10:16:58 2009 UTC (6 weeks ago) by jpopelka
Branch: MAIN
CVS Tags: dhcp-4_1_0p1-12_fc13, dhcp-4_1_0p1-13_fc13, dhcp-4_1_0p1-14_fc13, HEAD
Changes since 1.1: +1 -1 lines
* Tue Oct 13 2009 Jiri Popelka <jpopelka@redhat.com> - 12:4.1.0p1-12
- Fix 56dhclient so network comes back after suspend/hibernate (#527641)
1 #!/bin/sh
2 # If we are running dhclient, shutdown running instances cleanly and
3 # bring them back up on resume.
4
5 . "${PM_FUNCTIONS}"
6
7 PM_DHCLIENT_RUNDIR="${PM_UTILS_RUNDIR}/network"
8 PM_DHCLIENT_SUSPEND="${PM_DHCLIENT_RUNDIR}/dhclient.suspend"
9
10 suspend_dhclient() {
11 [ ! -d /etc/sysconfig/network-scripts ] && return
12 [ ! -x /sbin/ifdown ] && return
13
14 [ ! -d ${PM_DHCLIENT_RUNDIR} ] && /bin/mkdir -p ${PM_DHCLIENT_RUNDIR}
15 [ -f ${PM_DHCLIENT_SUSPEND} ] && /bin/rm -f ${PM_DHCLIENT_SUSPEND}
16
17 cd /etc/sysconfig/network-scripts
18 for ifcfg in ifcfg-* ; do
19 # Clear relevant parameters set by previous interface
20 # (lo doesn't set them)
21 NM_CONTROLLED=
22 BOOTPROTO=
23
24 . ./${ifcfg}
25
26 if [ "${NM_CONTROLLED}" = "no" ] || [ "${NM_CONTROLLED}" = "n" ] || [ "${NM_CONTROLLED}" = "false" ]; then
27 if [ "${BOOTPROTO}" = "bootp" ] || [ "${BOOTPROTO}" = "dhcp" ] || [ -z "${BOOTPROTO}" ]; then
28 # device is not NetworkManager controlled and uses dhcp,
29 # now see if it's actually up at the moment
30 /sbin/ip link show ${DEVICE} | /bin/grep -qE "state (UP|UNKNOWN)" >/dev/null 2>&1
31 if [ $? -eq 0 ]; then
32 echo "${DEVICE}" >> ${PM_DHCLIENT_SUSPEND}
33 /sbin/ifdown ${DEVICE}
34 fi
35 fi
36 fi
37 done
38 }
39
40 resume_dhclient() {
41 [ ! -f ${PM_DHCLIENT_SUSPEND} ] && return
42 [ ! -x /sbin/ifup ] && return
43
44 cd /etc/sysconfig/network-scripts
45 while read device ; do
46 /sbin/ifup ${device}
47 done < ${PM_DHCLIENT_SUSPEND}
48
49 /bin/rm -f ${PM_DHCLIENT_SUSPEND}
50 }
51
52 case "$1" in
53 hibernate|suspend)
54 suspend_dhclient
55 ;;
56 thaw|resume)
57 resume_dhclient
58 ;;
59 *) exit $NA
60 ;;
61 esac

admin@fedoraproject.org
ViewVC Help
Powered by ViewVC 1.1.2