distribution/packages/sysutils/busybox/scripts/dtname

22 lines
771 B
Text
Raw Normal View History

2022-02-05 14:23:32 +00:00
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2018 Team LibreELEC (https://libreelec.tv)
# Copyright (C) 2018-present Team CoreELEC (https://coreelec.org)
source /etc/os-release
if [ "${COREELEC_PROJECT}" = "Amlogic" -o "${COREELEC_PROJECT}" = "Amlogic-ng" ]; then
[ -f "/proc/device-tree/coreelec-dt-id" ] && DTNAME=$(cat /proc/device-tree/coreelec-dt-id)
[ -f "/proc/device-tree/le-dt-id" ] && DTNAME=$(cat /proc/device-tree/le-dt-id)
else
COMPATIBLE=$(cat /proc/device-tree/compatible 2>/dev/null | tr -d '\000' | sed -n -e 's/.*\(allwinner\|amlogic\|rockchip\).*/\1/p')
[ -n "$COMPATIBLE" ] && DTNAME=$(cat /proc/device-tree/compatible | cut -f1,2 -d',' | head -n 1)
fi
if [ -n "$DTNAME" ]; then
echo "$DTNAME"
else
echo "unknown"
fi