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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations) (download)
Sat Sep 3 16:10:27 2005 UTC (8 years, 11 months ago) by hollow
File size: 1805 byte(s)
import initial baselayout sources (1.12.0_pre8)
1 #!/bin/bash
2 # Copyright (c) 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 # void macnet_depend(void)
10 #
11 # Sets up the dependancies for the module
12 macnet_depend() {
13 before interface wireless
14 after macchanger
15 }
16
17 # bool macnet_check_installed(void)
18 #
19 # Always returns 0 as we are "installed" by wireless in the depend function
20 macnet_check_installed() {
21 return 0
22 }
23
24 # char* macnet_provides(void)
25 #
26 # Returns a string to change module definition for starting up
27 macnet_provides() {
28 echo "macnet"
29 }
30
31 # bool macnet_check_depends(void)
32 #
33 # Checks to see if we have the needed functions
34 macnet_check_depends() {
35 local f
36
37 for f in interface_get_mac_address; do
38 [[ $( type -t "${f}" ) == "function" ]] && continue
39 eerror "macnet: missing required function ${f}\n"
40 return 1
41 done
42
43 return 0
44 }
45
46 # bool macnet_start(char *iface)
47 #
48 # All interfaces and module scripts expose modulename_get_vars
49 # which returns a space seperated list of user configuration variables
50 # We can override each variable here from a given MAC address of the interface
51 # Always returns 0
52 macnet_pre_start() {
53 local iface="$1"
54
55 interface_exists "${iface}" || return 0
56
57 # We need to bring the interface up for some interfaces, otherwise the MAC
58 # address isn't consistent - mainly wireless cards with firmware uploading.
59 interface_up "${iface}"
60
61 local mac=$( interface_get_mac_address "${iface}" )
62 [[ -z ${mac} ]] && return 0
63
64 vebegin "Configuring ${iface} for MAC address ${mac}" 2>/dev/null
65 mac="${mac//:}"
66 configure_variables "${iface}" "${mac}"
67 veend 0 2>/dev/null
68
69 return 0
70 }
71
72 # vim:ts=4

  ViewVC Help
Powered by ViewVC 1.1.20