diff options
Diffstat (limited to 'target/linux/pistachio/base-files/lib/pistachio.sh')
-rwxr-xr-x | target/linux/pistachio/base-files/lib/pistachio.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/target/linux/pistachio/base-files/lib/pistachio.sh b/target/linux/pistachio/base-files/lib/pistachio.sh new file mode 100755 index 0000000000..f9a16db3ed --- /dev/null +++ b/target/linux/pistachio/base-files/lib/pistachio.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Copyright (C) 2017 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +PISTACHIO_BOARD_NAME= +PISTACHIO_MODEL= + +pistachio_board_detect() { + local machine + local name + + machine=$(cat /proc/device-tree/model) + + case "$machine" in + "IMG Marduk (Creator Ci40)") + name="marduk" + ;; + *) + name="generic" + ;; + esac + + [ -z "$PISTACHIO_BOARD_NAME" ] && PISTACHIO_BOARD_NAME="$name" + [ -z "$PISTACHIO_MODEL" ] && PISTACHIO_MODEL="$machine" + + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + + echo "$PISTACHIO_BOARD_NAME" > /tmp/sysinfo/board_name + echo "$PISTACHIO_MODEL" > /tmp/sysinfo/model +} + +pistachio_board_name() { + local name + [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name) + [ -z "$name" ] && name="unknown" + + echo "$name" +} |