difos/target/linux/oxnas/base-files/etc/board.d/02_network
Adrian Schmutzler 85b1f4d8ca treewide: remove execute bit and shebang from board.d files
So far, board.d files were having execute bit set and contained a
shebang. However, they are just sourced in board_detect, with an
apparantly unnecessary check for execute permission beforehand.

Replace this check by one for existance and make the board.d files
"normal" files, as would be expected in /etc anyway.

Note:

This removes an apparantly unused '#!/bin/sh /etc/rc.common' in
target/linux/bcm47xx/base-files/etc/board.d/01_network

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-06 11:30:06 +01:00

60 lines
973 B
Text

. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
bootloader_cmdline_var() {
local param
local pval
for arg in $(cat /proc/device-tree/chosen/bootloader-args); do
param="$(echo $arg | cut -d'=' -f 1)"
pval="$(echo $arg | cut -d'=' -f 2-)"
if [ "$param" = "$1" ]; then
echo "$pval"
fi
done
}
legacy_boot_mac_adr() {
local macstr
local oIFS
macstr="$(bootloader_cmdline_var mac_adr)"
oIFS="$IFS"
IFS=","
set -- $macstr
printf "%02x:%02x:%02x:%02x:%02x:%02x" $1 $2 $3 $4 $5 $6
IFS="$oIFS"
}
oxnas_setup_interfaces()
{
local board="$1"
case $board in
*)
ucidef_set_interface_lan "eth0" "dhcp"
;;
esac
}
oxnas_setup_macs()
{
local board="$1"
local lan_mac=""
case $board in
shuttle,kd20)
lan_mac="$(legacy_boot_mac_adr)"
;;
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
}
board_config_update
board=$(board_name)
oxnas_setup_interfaces $board
oxnas_setup_macs $board
board_config_flush
exit 0