#!/bin/sh if [ -n "`grep cfg80211 /proc/modules`" ] then sleep 1 newphy=`iw list | sed -n 's/^Wiphy //p' | sort` newwlan=`ip link show | sed -n 's/^[0-9]\{1,\}: \([a-z]\{2,\}[0-9]\{1,\}\).*/\1/p' | sort` for i in $oldwlan do newwlan=`echo $newwlan | sed "s/$i//"` done for i in $oldphy do newphy=`echo $newphy | sed "s/$i//"` done if [ -n "$newphy" ] then for i in $newphy do set -- $newwlan j=$1 newwlan=`echo $newwlan | sed "s/$j//"` mac=`ip link show $j | sed -n 'y/ABCDEF/abcdef/;s/.*\(\([0-9a-f]\{2\}:\)\{5\}[0-9a-f]\{2\}\).\+/\1/p'` echo "${i}=${mac}" >>/var/run/wlanphy.conf done fi fi