summaryrefslogtreecommitdiff
path: root/target/linux/kirkwood/base-files/lib/kirkwood.sh
blob: dbf345617229addcbb59dae7dcd5461b3bbfef65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/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"
		;;

	"Cisco Systems ON100")
		name="on100"
		;;

	"Cloud Engines Pogoplug E02")
		name="pogo_e02"
		;;

	"Linksys EA3500")
		name="linksys-audi"
		;;

	"Linksys E4200v2 / EA4500")
		name="linksys-viper"
		;;

	"Globalscale Technologies Guruplug Server Plus")
		name="guruplug-server-plus"
		;;

	"Globalscale Technologies SheevaPlug")
		name="sheevaplug"
		;;

	"Globalscale Technologies eSATA SheevaPlug")
		name="sheevaplug-esata"
		;;

	"ZyXEL NSA310b")
		name="nsa310b"
		;;

	"ZyXEL NSA310S")
		name="nsa310s"
		;;

	"ZyXEL NSA325")
		name="nsa325"
		;;

	*)
		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"
}