diff options
author | John Crispin <blogic@openwrt.org> | 2014-07-02 16:33:11 +0000 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2014-07-02 16:33:11 +0000 |
commit | 6ec3299aa86134ecc5f62b16d0a1b3cb3ca661f2 (patch) | |
tree | 425ff6d8992a517692faec437bd4e0ee795c4a15 /target/linux/lantiq/base-files/lib/functions | |
parent | e72b4b22910810762e27f3d966880b96ca7847e0 (diff) | |
download | upstream-6ec3299aa86134ecc5f62b16d0a1b3cb3ca661f2.tar.gz upstream-6ec3299aa86134ecc5f62b16d0a1b3cb3ca661f2.tar.bz2 upstream-6ec3299aa86134ecc5f62b16d0a1b3cb3ca661f2.zip |
lantiq: add support for /tmp/sysinfo
Signed-off-by: John Crispin <blogic@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41472 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/lantiq/base-files/lib/functions')
-rw-r--r-- | target/linux/lantiq/base-files/lib/functions/lantiq.sh | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/target/linux/lantiq/base-files/lib/functions/lantiq.sh b/target/linux/lantiq/base-files/lib/functions/lantiq.sh index ed76cd8014..88da794ca9 100644 --- a/target/linux/lantiq/base-files/lib/functions/lantiq.sh +++ b/target/linux/lantiq/base-files/lib/functions/lantiq.sh @@ -1,9 +1,29 @@ #!/bin/sh -lantiq_board_id() { - grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/\(.*\) - .*/\1/g" +lantiq_board_detect() { + name=`grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/\(.*\) - .*/\1/g"` + model=`grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/.* - \(.*\)/\1/g"` + [ -z "$name" ] && name="unknown" + [ -z "$model" ] && model="unknown" + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + echo $name > /tmp/sysinfo/board_name + echo $model > /tmp/sysinfo/model +} + +lantiq_board_model() { + local model + + [ -f /tmp/sysinfo/model ] && model=$(cat /tmp/sysinfo/model) + [ -z "$model" ] && model="unknown" + + echo "$model" } lantiq_board_name() { - grep "^machine" /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/.* - \(.*\)/\1/g" + local name + + [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name) + [ -z "$name" ] && name="unknown" + + echo "$name" } |