base-files: add generic board_name function to functions.sh
authorFelix Fietkau <nbd@nbd.name>
Fri, 17 Mar 2017 15:12:27 +0000 (16:12 +0100)
committerJo-Philipp Wich <jo@mein.io>
Wed, 13 Dec 2017 13:54:03 +0000 (14:54 +0100)
This will be used to replace all those nasty board specific scripts
that do basically the same thing

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit ec991424749b9eed37d01bc8adb9fb22fb0c98a7)

package/base-files/files/lib/functions.sh

index 992d88f9649b20423d9c2a8da7d2b768ed9e4cb3..bea5f0f96be1a2bc97899f50f2bca7cc19f9a9f3 100755 (executable)
@@ -353,4 +353,8 @@ user_exists() {
        grep -qs "^${1}:" ${IPKG_INSTROOT}/etc/passwd
 }
 
+board_name() {
+       [ -e /tmp/sysinfo/board_name ] && cat /tmp/sysinfo/board_name || echo "generic"
+}
+
 [ -z "$IPKG_INSTROOT" -a -f /lib/config/uci.sh ] && . /lib/config/uci.sh