kirkwood: base-files: add script to detect board name and populate /tmp/sysinfo
Signed-off-by: Luka Perkov <luka@openwrt.org> SVN-Revision: 41335
This commit is contained in:
parent
3fea61afe8
commit
e6aea925d3
1 changed files with 58 additions and 0 deletions
58
target/linux/kirkwood/base-files/lib/functions/kirkwood.sh
Executable file
58
target/linux/kirkwood/base-files/lib/functions/kirkwood.sh
Executable file
|
@ -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"
|
||||
}
|
Loading…
Reference in a new issue