aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/kirkwood/base-files/lib/kirkwood.sh
diff options
context:
space:
mode:
authorJames <>2015-11-04 11:49:21 +0000
committerJames <>2015-11-04 11:49:21 +0000
commit716ca530e1c4515d8683c9d5be3d56b301758b66 (patch)
tree700eb5bcc1a462a5f21dcec15ce7c97ecfefa772 /target/linux/kirkwood/base-files/lib/kirkwood.sh
downloadtrunk-47381-master.tar.gz
trunk-47381-master.tar.bz2
trunk-47381-master.zip
trunk-47381HEADmaster
Diffstat (limited to 'target/linux/kirkwood/base-files/lib/kirkwood.sh')
-rwxr-xr-xtarget/linux/kirkwood/base-files/lib/kirkwood.sh86
1 files changed, 86 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..6e0f444
--- /dev/null
+++ b/target/linux/kirkwood/base-files/lib/kirkwood.sh
@@ -0,0 +1,86 @@
+#!/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"
+ ;;
+
+ "Seagate GoFlex Home")
+ name="goflexhome"
+ ;;
+
+ "Seagate GoFlex Net")
+ name="goflexnet"
+ ;;
+
+ "Iomega Iconnect")
+ name="iconnect"
+ ;;
+
+ "RaidSonic ICY BOX IB-NAS62x0 (Rev B)")
+ name="ib62x0"
+ ;;
+
+ "Cloud Engines Pogoplug E02")
+ name="pogo_e02"
+ ;;
+
+ "Linksys EA3500")
+ name="ea3500"
+ ;;
+
+ "Linksys EA4500")
+ name="ea4500"
+ ;;
+
+ "Globalscale Technologies Guruplug Server Plus")
+ name="guruplug-server-plus"
+ ;;
+
+ "Globalscale Technologies SheevaPlug")
+ name="sheevaplug"
+ ;;
+
+ "Globalscale Technologies eSATA SheevaPlug")
+ name="sheevaplug-esata"
+ ;;
+
+ "ZyXEL NSA310S")
+ name="nsa310s"
+ ;;
+
+ *)
+ 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"
+}