From f5ab57b33522609d1465f937b69f158be90b177f Mon Sep 17 00:00:00 2001 From: pavlov Date: Fri, 2 Mar 2007 18:17:40 +0000 Subject: commit profile support for base-files... patches still need to be done git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6465 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../base-files/default/etc/config/network | 11 +++ .../base-files/default/etc/init.d/netconfig | 84 ++++++++++++++++++++++ .../linux/ixp4xx-2.6/base-files/etc/config/network | 11 --- .../ixp4xx-2.6/base-files/etc/init.d/netconfig | 84 ---------------------- 4 files changed, 95 insertions(+), 95 deletions(-) create mode 100644 target/linux/ixp4xx-2.6/base-files/default/etc/config/network create mode 100755 target/linux/ixp4xx-2.6/base-files/default/etc/init.d/netconfig delete mode 100644 target/linux/ixp4xx-2.6/base-files/etc/config/network delete mode 100755 target/linux/ixp4xx-2.6/base-files/etc/init.d/netconfig (limited to 'target/linux/ixp4xx-2.6') diff --git a/target/linux/ixp4xx-2.6/base-files/default/etc/config/network b/target/linux/ixp4xx-2.6/base-files/default/etc/config/network new file mode 100644 index 000000000..1d9b55b2d --- /dev/null +++ b/target/linux/ixp4xx-2.6/base-files/default/etc/config/network @@ -0,0 +1,11 @@ +# Network configuration file + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option proto dhcp diff --git a/target/linux/ixp4xx-2.6/base-files/default/etc/init.d/netconfig b/target/linux/ixp4xx-2.6/base-files/default/etc/init.d/netconfig new file mode 100755 index 000000000..ded5f4b8d --- /dev/null +++ b/target/linux/ixp4xx-2.6/base-files/default/etc/init.d/netconfig @@ -0,0 +1,84 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +START=15 + +# hardware +# the 'Hardware' string from cpuinfo +hardware(){ + sed -n 's!^Hardware *: !!p' /proc/cpuinfo +} +# +# machine +# outputs an identifier of the current machine - i.e. the board +# slugos is running on. +machine(){ + case "$(hardware)" in + *Avila*) echo avila;; + *Loft*) echo loft;; + *NAS?100d*) echo nas100d;; + *DSM?G600*) echo dsmg600;; + *NSLU2*) echo nslu2;; + *FSG?3*) echo fsg3;; + *Gateway?7001*) echo gateway7001;; + *) echo unknown;; + esac +} + +start() { + [ -e /etc/config/network ] && exit 0 + + mkdir -p /etc/config + + ( + case "$(machine)" in + nslu2) + sysconf=$(find_mtd_part "SysConf") + echo model=nslu2 + strings $sysconf ;; + nas100d) + sysconf=$(find_mtd_part "sysconfig") + echo model=nas100d + strings $sysconf ;; + *) + echo model=$(machine) ;; + esac + ) | awk ' + function p(cfgname, name) { + if (c[name] != "") print " option " cfgname " \"" c[name] "\"" + } + + BEGIN { + FS="=" + } + + { c[$1] = $2 } + + END { + print "#### Loopback configuration" + print "config interface loopback" + print " option ifname \"lo\"" + print " option proto static" + print " option ipaddr 127.0.0.1" + print " option netmask 255.0.0.0" + print "" + print "" + print "#### LAN configuration" + print "config interface lan" + print " option ifname \"eth0\"" + if ((c["model"] == "nslu2") || (c["model"] == "nas100d")) { + p("proto", "bootproto") + p("ipaddr", "ip_addr") + p("netmask", "netmask") + p("gateway", "gateway") + p("dns", "dns_server1") + p("hostname", "disk_server_name") + } + else { + print " option proto dhcp" + } + }' > /etc/config/network + + ifup loopback + ifup lan +} diff --git a/target/linux/ixp4xx-2.6/base-files/etc/config/network b/target/linux/ixp4xx-2.6/base-files/etc/config/network deleted file mode 100644 index 1d9b55b2d..000000000 --- a/target/linux/ixp4xx-2.6/base-files/etc/config/network +++ /dev/null @@ -1,11 +0,0 @@ -# Network configuration file - -config interface loopback - option ifname lo - option proto static - option ipaddr 127.0.0.1 - option netmask 255.0.0.0 - -config interface lan - option ifname eth0 - option proto dhcp diff --git a/target/linux/ixp4xx-2.6/base-files/etc/init.d/netconfig b/target/linux/ixp4xx-2.6/base-files/etc/init.d/netconfig deleted file mode 100755 index ded5f4b8d..000000000 --- a/target/linux/ixp4xx-2.6/base-files/etc/init.d/netconfig +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2006 OpenWrt.org - -START=15 - -# hardware -# the 'Hardware' string from cpuinfo -hardware(){ - sed -n 's!^Hardware *: !!p' /proc/cpuinfo -} -# -# machine -# outputs an identifier of the current machine - i.e. the board -# slugos is running on. -machine(){ - case "$(hardware)" in - *Avila*) echo avila;; - *Loft*) echo loft;; - *NAS?100d*) echo nas100d;; - *DSM?G600*) echo dsmg600;; - *NSLU2*) echo nslu2;; - *FSG?3*) echo fsg3;; - *Gateway?7001*) echo gateway7001;; - *) echo unknown;; - esac -} - -start() { - [ -e /etc/config/network ] && exit 0 - - mkdir -p /etc/config - - ( - case "$(machine)" in - nslu2) - sysconf=$(find_mtd_part "SysConf") - echo model=nslu2 - strings $sysconf ;; - nas100d) - sysconf=$(find_mtd_part "sysconfig") - echo model=nas100d - strings $sysconf ;; - *) - echo model=$(machine) ;; - esac - ) | awk ' - function p(cfgname, name) { - if (c[name] != "") print " option " cfgname " \"" c[name] "\"" - } - - BEGIN { - FS="=" - } - - { c[$1] = $2 } - - END { - print "#### Loopback configuration" - print "config interface loopback" - print " option ifname \"lo\"" - print " option proto static" - print " option ipaddr 127.0.0.1" - print " option netmask 255.0.0.0" - print "" - print "" - print "#### LAN configuration" - print "config interface lan" - print " option ifname \"eth0\"" - if ((c["model"] == "nslu2") || (c["model"] == "nas100d")) { - p("proto", "bootproto") - p("ipaddr", "ip_addr") - p("netmask", "netmask") - p("gateway", "gateway") - p("dns", "dns_server1") - p("hostname", "disk_server_name") - } - else { - print " option proto dhcp" - } - }' > /etc/config/network - - ifup loopback - ifup lan -} -- cgit v1.2.3