[OpenWrt-Devel] [brcm2708] Use uci-defaults for network config

2014-07-04 Thread Álvaro Fernández Rojas
By using uci-defaults force_link is enabled, which fixes some link issues if 
ethernet cable isn't connected when LAN is initialized.

Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com
---
diff --git a/target/linux/brcm2708/base-files/etc/config/network 
b/target/linux/brcm2708/base-files/etc/config/network
deleted file mode 100644
index 1d5ded3..000
--- a/target/linux/brcm2708/base-files/etc/config/network
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (C) 2006 OpenWrt.org
-
-config interface loopback
-   option ifname   lo
-   option protostatic
-   option ipaddr   127.0.0.1
-   option netmask  255.0.0.0
-
-config interface lan
-   option ifname   eth0
-   option protostatic
-   option ipaddr   192.168.1.1
-   option netmask  255.255.255.0
diff --git a/target/linux/brcm2708/base-files/etc/uci-defaults/02_network 
b/target/linux/brcm2708/base-files/etc/uci-defaults/02_network
new file mode 100644
index 000..588fff3
--- /dev/null
+++ b/target/linux/brcm2708/base-files/etc/uci-defaults/02_network
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Copyright (C) 2014 OpenWrt.org
+
+. /lib/functions/uci-defaults.sh
+
+ucidef_set_interface_loopback
+ucidef_set_interface_lan eth0
+
+uci commit network
+
+exit 0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [brcm2708] Use uci-defaults for network config

2014-07-04 Thread Jonas Gorski
Hi,

On Fri, Jul 4, 2014 at 1:33 PM, Álvaro Fernández Rojas
nolt...@gmail.com wrote:
 By using uci-defaults force_link is enabled, which fixes some link issues if 
 ethernet cable isn't connected when LAN is initialized.

 Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com
 ---
(snip)
 diff --git a/target/linux/brcm2708/base-files/etc/uci-defaults/02_network 
 b/target/linux/brcm2708/base-files/etc/uci-defaults/02_network
 new file mode 100644
 index 000..588fff3
 --- /dev/null
 +++ b/target/linux/brcm2708/base-files/etc/uci-defaults/02_network
 @@ -0,0 +1,11 @@
 +#!/bin/sh
 +# Copyright (C) 2014 OpenWrt.org
 +
 +. /lib/functions/uci-defaults.sh
 +
 +ucidef_set_interface_loopback
 +ucidef_set_interface_lan eth0
 +
 +uci commit network

This will break for sysupgrade with existing configs (if it were
supported) or images with custom network config from files/; your
first action should be

[ -e /etc/config/network ]  exit 0

like it is done on other targets.


Jonas
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel