Project

General

Profile

ADAPTATION rcd script » History » Version 1

Oleksandr Rybalko, 05/28/2012 10:13 AM

1 1 Oleksandr Rybalko
h1. ADAPTATION rc.d script
2 1 Oleksandr Rybalko
3 1 Oleksandr Rybalko
* Main task to make all board depended names to much ZRouter.org standard names:
4 1 Oleksandr Rybalko
## wan0 - name for default WAN interface (Example: ifconfig vlan0 name wan0)
5 1 Oleksandr Rybalko
## lan0 - default LAN interface
6 1 Oleksandr Rybalko
## wifi0 - wireless main device from which VAPs will be cloned (ath0, bwn0, ral0, etc)
7 1 Oleksandr Rybalko
* Preset GPIO pins (f.e. Invert Input on some GPIO pin and request interrupt reporting via devd)
8 1 Oleksandr Rybalko
* Import, apply MAC addresses if required (many device has no EEPROMs for their NICs)
9 1 Oleksandr Rybalko
* Set device hostname
10 1 Oleksandr Rybalko
11 1 Oleksandr Rybalko
<pre>
12 1 Oleksandr Rybalko
#!/bin/sh
13 1 Oleksandr Rybalko
14 1 Oleksandr Rybalko
# PROVIDE: ADAPTATION
15 1 Oleksandr Rybalko
16 1 Oleksandr Rybalko
. /etc/rc.subr
17 1 Oleksandr Rybalko
. /etc/network.subr
18 1 Oleksandr Rybalko
19 1 Oleksandr Rybalko
name="ADAPTATION"
20 1 Oleksandr Rybalko
start_cmd="adapt_start"
21 1 Oleksandr Rybalko
22 1 Oleksandr Rybalko
adapt_start()
23 1 Oleksandr Rybalko
{
24 1 Oleksandr Rybalko
25 1 Oleksandr Rybalko
	# Ethernet switch setup here 
26 1 Oleksandr Rybalko
	gpioctl -f /dev/gpioc0 -c 10 IN II PU INT
27 1 Oleksandr Rybalko
28 1 Oleksandr Rybalko
	# Import MAC addresses with known names
29 1 Oleksandr Rybalko
#	kenv LAN_MAC_ADDR=`kenv ethaddr`
30 1 Oleksandr Rybalko
#	kenv WAN_MAC_ADDR=`kenv wanmac`
31 1 Oleksandr Rybalko
32 1 Oleksandr Rybalko
	ifconfig arge0 name lan0
33 1 Oleksandr Rybalko
	ifconfig arge1 name wan0
34 1 Oleksandr Rybalko
	ifconfig ath0 name wifi0
35 1 Oleksandr Rybalko
36 1 Oleksandr Rybalko
	ifconfig lan0 ether `kenv LAN_MAC_ADDR`
37 1 Oleksandr Rybalko
	ifconfig wan0 ether `kenv WAN_MAC_ADDR`
38 1 Oleksandr Rybalko
#	ifconfig wifi0 ether `kenv WLAN_MAC_ADDR`
39 1 Oleksandr Rybalko
40 1 Oleksandr Rybalko
	hostname `kenv HostName`
41 1 Oleksandr Rybalko
42 1 Oleksandr Rybalko
}
43 1 Oleksandr Rybalko
44 1 Oleksandr Rybalko
load_rc_config $name
45 1 Oleksandr Rybalko
46 1 Oleksandr Rybalko
run_rc_command $*
47 1 Oleksandr Rybalko
</pre>