diff options
author | Luka Perkov <luka@openwrt.org> | 2014-06-26 10:13:47 +0000 |
---|---|---|
committer | Luka Perkov <luka@openwrt.org> | 2014-06-26 10:13:47 +0000 |
commit | a54f4320f9f0beabaedeb8053940cd71c6dd589e (patch) | |
tree | 4fab842bffbc075a0213b017a17d31a5c22d7693 /target/linux/kirkwood/base-files/lib/kirkwood.sh | |
parent | 35f05693f15bf1797f330595e542ca85e026b70f (diff) | |
download | mtk-20170518-a54f4320f9f0beabaedeb8053940cd71c6dd589e.zip mtk-20170518-a54f4320f9f0beabaedeb8053940cd71c6dd589e.tar.gz mtk-20170518-a54f4320f9f0beabaedeb8053940cd71c6dd589e.tar.bz2 |
kirkwood: move kirkwood.sh to /lib/ for consistency
Signed-off-by: Luka Perkov <luka@openwrt.org>
SVN-Revision: 41338
Diffstat (limited to 'target/linux/kirkwood/base-files/lib/kirkwood.sh')
-rwxr-xr-x | target/linux/kirkwood/base-files/lib/kirkwood.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/target/linux/kirkwood/base-files/lib/kirkwood.sh b/target/linux/kirkwood/base-files/lib/kirkwood.sh new file mode 100755 index 0000000..ba080f4 --- /dev/null +++ b/target/linux/kirkwood/base-files/lib/kirkwood.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# +# Copyright (C) 2014 OpenWrt.org +# + +KIRKWOOD_BOARD_NAME= +KIRKWOOD_MODEL= + +kirkwood_board_detect() { + local machine + local name + + machine=$(cat /proc/device-tree/model) + + case "$machine" in + "Seagate FreeAgent Dockstar") + name="dockstar" + ;; + + "Iomega Iconnect") + name="iconnect" + ;; + + "RaidSonic ICY BOX IB-NAS62x0 (Rev B)") + name="ib62x0" + ;; + + "Cloud Engines Pogoplug E02") + name="pogo_e02" + ;; + + "Linksys EA4500") + name="ea4500" + ;; + + *) + name="generic" + ;; + esac + + [ -z "$KIRKWOOD_BOARD_NAME" ] && KIRKWOOD_BOARD_NAME="$name" + [ -z "$KIRKWOOD_MODEL" ] && KIRKWOOD_MODEL="$machine" + + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + + echo "$KIRKWOOD_BOARD_NAME" > /tmp/sysinfo/board_name + echo "$KIRKWOOD_MODEL" > /tmp/sysinfo/model +} + +kirkwood_board_name() { + local name + + [ -f /tmp/sysinfo/board_name ] || kirkwood_board_detect + [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name) + [ -z "$name" ] && name="unknown" + + echo "$name" +} |