/[baselayout]/branches/rc-scripts-1_6/net-scripts/net.modules.d/ipppd
Gentoo

Contents of /branches/rc-scripts-1_6/net-scripts/net.modules.d/ipppd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 842 - (show annotations) (download)
Thu Jan 13 14:51:03 2005 UTC (9 years, 9 months ago) by uberlord
File size: 2403 byte(s)
wpa_supplicant forces ctrl_interface to /var/run/wpa_supplicant
and removes stale directories
clean_pidfile function no longer errors on empty pidfiles
ipppd fixes for shutdown

1 # ISDN (net-dialup/isdn4k-utils) module for net-scripts
2 # Version 1.0.2
3 # Copyright (c) 2004 Gentoo Foundation
4 # Distributed under the terms of the GNU General Public License V2
5 # Contributed by Roy Marples (uberlord@gentoo.org)
6
7 # char* ipppd_provides(void)
8 #
9 # Returns a string to change module definition for starting up
10 ipppd_provides() {
11 echo "isdn"
12 }
13
14 # void ipppd_depend(void)
15 #
16 # Sets up the dependancies for the module
17 ipppd_depend() {
18 after macchanger
19 before interface
20 }
21
22 # bool ipppd_check_installed(void)
23 #
24 # Returns 1 if isnd4k-utils is installed, otherwise 0
25 ipppd_check_installed() {
26 [[ -x /usr/sbin/ipppd ]] && return 0
27 ${1:-false} && eerror "For ISDN (ipppd) support, emerge net-dialup/isdn4k-utils"
28 return 1
29 }
30
31 # bool ipppd_check_depends(void)
32 #
33 # Checks to see if we have the needed functions
34 ipppd_check_depends() {
35 local f
36
37 for f in interface_exists interface_variable interface_type clean_pidfile; do
38 [[ $( type -t ${f} ) == function ]] && continue
39 eerror "ipppd: missing required function ${f}\n"
40 return 1
41 done
42
43 return 0
44 }
45
46 # bool ipppd_start(char *iface)
47 #
48 # Start isdn on an interface
49 #
50 # Returns 0 (true) when successful, non-zero otherwise
51 ipppd_pre_start() {
52 local iface=${1} opts itype=$( interface_type ${1} )
53 local ifvar=$( interface_variable ${1} ) pidfile="/var/run/ipppd-${iface}.pid"
54
55 # Check that we are a valid isdn interface
56 [[ ${itype} != "ippp" && ${itype} != "isdn" ]] && return 0
57
58 # Check that the interface exists
59 ! interface_exists ${iface} true && return 1
60
61 if ! clean_pidfile ${pidfile} ; then
62 ewarn "ipppd is already running on ${iface}"
63 eend 0
64 return 0
65 fi
66
67 # Might or might not be set in conf.d/net
68 eval opts=\"\$\{ipppd_${ifvar}\}\"
69
70 einfo "Starting ipppd for ${iface}"
71 /usr/sbin/ipppd ${opts} pidfile ${pidfile} file /etc/ppp/options.${iface} >${devnull}
72 eend $? || return $?
73
74 return 0
75 }
76
77 # bool ipppd_stop(char *iface)
78 #
79 # Stop isdn on an interface
80 # Returns 0 (true) when successful, non-zero otherwise
81 ipppd_stop() {
82 local iface=${1} pidfile="/var/run/ipppd-${1}.pid"
83
84 ipppd_check_installed || return 0
85 [[ ! -f ${pidfile} ]] && return 0
86
87 clean_pidfile ${pidfile} && return 0
88 local pid=$( cat ${pidfile} ) r=0
89
90 einfo "Stopping ipppd for ${iface}"
91 kill -s TERM ${pid}
92 if ! process_finished ${pid} ipppd 10 ; then
93 kill -s KILL ${pid}
94 process_finished ${pid} ipppd 10 || r=1
95 fi
96
97 eend ${r}
98 return ${r}
99 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20