Re: [OpenWrt-Devel] [PATCH] ramips: add set-macs uci-default script

2011-09-16 Thread Alexander Gordeev
Hi,

Your patch is mangled (by your e-mail client most likely).

Also I'm currently working on moving set-macs to network script entirely
(inspired by your patch :)). This is more natural because both scripts
work with the same config and also network script needs rework too.
It's for devices that have a full-blown switch. I have on that has only
one ethernet port. I think setting leds should be done in the same way,
not spreading through per-board files.

В Fri, 26 Aug 2011 04:33:30 +0300
Roman Yeryomin  пишет:

> Signed-off-by: Roman Yeryomin 
> 
> Index: target/linux/ramips/base-files/etc/uci-defaults/nw718
> ===
> --- a/target/linux/ramips/base-files/etc/uci-defaults/nw718 (revision 
> 28007)
> +++ b/target/linux/ramips/base-files/etc/uci-defaults/nw718 (working copy)
> @@ -3,30 +3,6 @@
>  # Copyright (C) 2011 OpenWrt.org
>  #
> 
> -nw718_set_macs() {
> -   local part
> -   local lan_mac
> -   local wan_mac
> -
> -   [ -z $(which maccalc) ] && return
> -
> -   . /etc/functions.sh
> -
> -   part=$(find_mtd_part "factory")
> -   [ -z $part ] && return
> -
> -   lan_mac=$(dd bs=1 skip=4 count=6 if=$part 2>/dev/null | maccalc 
> bin2mac)
> -   [ -z $lan_mac ] && return
> -
> -   wan_mac=$(maccalc add $lan_mac 1)
> -
> -   uci batch < -set network.lan.macaddr='$lan_mac'
> -set network.wan.macaddr='$wan_mac'
> -commit network
> -EOF
> -}
> -
>  nw718_set_leds() {
> uci batch <  set system.usb_led=led
> @@ -45,5 +21,4 @@
> 
>  if [ "${board}" == "nw718" ]; then
> nw718_set_leds
> -   nw718_set_macs
>  fi
> Index: target/linux/ramips/base-files/etc/uci-defaults/set-macs
> ===
> --- a/target/linux/ramips/base-files/etc/uci-defaults/set-macs  (revision 0)
> +++ b/target/linux/ramips/base-files/etc/uci-defaults/set-macs  (revision 0)
> @@ -0,0 +1,52 @@
> +#!/bin/sh
> +#
> +# Copyright (C) 2011 OpenWrt.org
> +#
> +
> +set_macs() {
> +   local mtdname=$1
> +   local seek=$2
> +   local part
> +   local lan_mac
> +   local wan_mac
> +
> +   [ -z $(which maccalc) ] && echo "set-macs: maccalc not found!" && 
> return
> +
> +   . /etc/functions.sh
> +
> +   part=$(find_mtd_part "$mtdname")
> +   [ -z $part ] && echo "set-macs: partition $mtdname not found!" && 
> return
> +
> +   dd bs=1 skip=$seek count=6 if=$part of=/tmp/mac.bin 2>/dev/null
> +   lan_mac=$(maccalc bin2mac /tmp/mac.bin)
> +   [ -z $lan_mac ] && echo "set-macs: can't extract mac address
> from $part" && return
> +
> +   wan_mac=$(maccalc add $lan_mac 1)
> +
> +   echo "Setting LAN mac address to: $lan_mac"
> +   echo "Setting WAN mac address to: $wan_mac"
> +
> +   uci batch < +set network.lan.macaddr='$lan_mac'
> +set network.wan.macaddr='$wan_mac'
> +commit network
> +EOF
> +}
> +
> +. /lib/ramips.sh
> +
> +board=$(ramips_board_name)
> +
> +case $board in
> +   f5d8235-v2)
> +   set_macs "u-boot" 262148
> +   ;;
> +   argus-atp52b | \
> +   nw718)
> +   set_macs "factory" 4
> +   ;;
> +   *)
> +   echo "set-macs: don't know where to get mac address on
> this board"
> +esac
> +
> +uci commit network
> 
> Property changes on: target/linux/ramips/base-files/etc/uci-defaults/set-macs
> ___
> Added: svn:executable
>+ *

-- 
  Alexander


signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ramips: add set-macs uci-default script

2011-09-12 Thread Roman Yeryomin
On 26 August 2011 04:33, Roman Yeryomin  wrote:
> Signed-off-by: Roman Yeryomin 
>

if there is nothing wrong, how about commiting this?

Regards,
Roman
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: add set-macs uci-default script

2011-08-25 Thread Roman Yeryomin
Signed-off-by: Roman Yeryomin 

Index: target/linux/ramips/base-files/etc/uci-defaults/nw718
===
--- a/target/linux/ramips/base-files/etc/uci-defaults/nw718 (revision 28007)
+++ b/target/linux/ramips/base-files/etc/uci-defaults/nw718 (working copy)
@@ -3,30 +3,6 @@
 # Copyright (C) 2011 OpenWrt.org
 #

-nw718_set_macs() {
-   local part
-   local lan_mac
-   local wan_mac
-
-   [ -z $(which maccalc) ] && return
-
-   . /etc/functions.sh
-
-   part=$(find_mtd_part "factory")
-   [ -z $part ] && return
-
-   lan_mac=$(dd bs=1 skip=4 count=6 if=$part 2>/dev/null | maccalc bin2mac)
-   [ -z $lan_mac ] && return
-
-   wan_mac=$(maccalc add $lan_mac 1)
-
-   uci batch