#!/bin/sh # This must run before 10-wifi-detect [ "${ACTION}" = "add" ] || return . /lib/functions.sh . /lib/functions/system.sh do_migrate_radio() { local config="$1" config_get from "$config" path to=${from/pci\//pcie\/} # Checks if kernel version is less than 6.12.0, if it is and the path is # using the new format, then path should be migrated to the old format. [ "$(get_linux_version)" -lt "612000" ] && to=${from/pcie\//pci\/} [ "$from" = "$to" ] && return uci set "wireless.${config}.path=${to}" WIRELESS_CHANGED=true logger -t wifi-migrate "Updated path of wireless.${config} from '${from}' to '${to}'" } migrate_radio() { config_load wireless config_foreach do_migrate_radio wifi-device } WIRELESS_CHANGED=false case "$(board_name)" in *) migrate_radio ;; esac $WIRELESS_CHANGED && uci commit wireless exit 0