/[vps]/baselayout-vserver/trunk/lib/rcscripts/net.modules.d/essidnet
Gentoo

Contents of /baselayout-vserver/trunk/lib/rcscripts/net.modules.d/essidnet

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations) (download)
Sat Sep 3 16:10:27 2005 UTC (9 years, 3 months ago) by hollow
File size: 2100 byte(s)
import initial baselayout sources (1.12.0_pre8)
1 #!/bin/bash
2 # Copyright (c) 2004-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 # Contributed by Roy Marples (uberlord@gentoo.org)
6 # Many thanks to all the people in the Gentoo forums for their ideas and
7 # motivation for me to make this and keep on improving it
8
9 # Load our config if it exists
10 [[ -f $(add_suffix "/etc/conf.d/wireless" ) ]] \
11 && source $(add_suffix "/etc/conf.d/wireless" )
12
13 # void essidnet_depend(void)
14 #
15 # Sets up the dependancies for the module
16 essidnet_depend() {
17 before interface
18 after wireless
19 installed wireless
20 }
21
22 # bool essidnet_check_installed(void)
23 #
24 # Always returns 0 as we are "installed" by wireless in the depend function
25 essidnet_check_installed() {
26 return 0
27 }
28
29 # char* essidnet_provides(void)
30 #
31 # Returns a string to change module definition for starting up
32 essidnet_provides() {
33 echo "essidnet"
34 }
35
36 # bool essidnet_check_depends(void)
37 #
38 # Checks to see if we have the needed functions
39 essidnet_check_depends() {
40 local f
41
42 for f in wireless_check_extensions wireless_get_essid wireless_get_ap_mac_address; do
43 [[ $( type -t "${f}" ) == "function" ]] && continue
44 eerror "essidnet: missing required function ${f}\n"
45 return 1
46 done
47
48 return 0
49 }
50
51 # bool essidnet_start(char *iface)
52 #
53 # All interfaces and module scripts expose modulename_get_vars
54 # which returns a space seperated list of user configuration variables
55 # We can override each variable here from a given ESSID or the MAC
56 # of the AP connected to. MAC configuration takes precedence
57 # Always returns 0
58 essidnet_pre_start() {
59 local iface="$1"
60
61 wireless_check_extensions "${iface}" || return 0
62
63 local mac=$( wireless_get_ap_mac_address "${iface}" )
64 local ESSID=$( wireless_get_essid "${iface}" )
65 local essid=$( bash_variable ${ESSID} )
66 mac="${mac//:/}"
67
68 vebegin "Configuring ${iface} for ESSID \"${ESSID//\\\\/\\\\}\"" 2>/dev/null
69 configure_variables "${iface}" "${essid}" "${mac}"
70
71 # Backwards compat for old gateway var
72 eval x=\"\$\{gateway_${essid}\}\"
73 [[ -n ${x} ]] && gateway="${iface}/${x}"
74
75 veend 0 2>/dev/null
76 return 0
77 }
78
79 # vim:ts=4

  ViewVC Help
Powered by ViewVC 1.1.20