source: trunk/target/linux/ramips/base-files/etc/uci-defaults/nw718 @ 28007

Last change on this file since 28007 was 28007, checked in by juhosg, 5 years ago

ramips: use maccalc instead of hexdump + sed

  • Property svn:executable set to *
File size: 840 bytes
Line 
1#!/bin/sh
2#
3# Copyright (C) 2011 OpenWrt.org
4#
5
6nw718_set_macs() {
7        local part
8        local lan_mac
9        local wan_mac
10
11        [ -z $(which maccalc) ] && return
12
13        . /etc/functions.sh
14
15        part=$(find_mtd_part "factory")
16        [ -z $part ] && return
17
18        lan_mac=$(dd bs=1 skip=4 count=6 if=$part 2>/dev/null | maccalc bin2mac)
19        [ -z $lan_mac ] && return
20
21        wan_mac=$(maccalc add $lan_mac 1)
22
23        uci batch <<EOF
24set network.lan.macaddr='$lan_mac'
25set network.wan.macaddr='$wan_mac'
26commit network
27EOF
28}
29
30nw718_set_leds() {
31        uci batch <<EOF
32set system.usb_led=led
33set system.usb_led.name='USB'
34set system.usb_led.sysfs='nw718:amber:usb'
35set system.usb_led.trigger='usbdev'
36set system.usb_led.dev='1-1'
37set system.usb_led.interval='50'
38commit system
39EOF
40}
41
42. /lib/ramips.sh
43
44board=$(ramips_board_name)
45
46if [ "${board}" == "nw718" ]; then
47        nw718_set_leds
48        nw718_set_macs
49fi
Note: See TracBrowser for help on using the repository browser.