#!/bin/sh
#
# Set X13s wifi MAC address
#

# Only for X13s
if [ "$(cat /sys/devices/virtual/dmi/id/product_family)" != \
     "ThinkPad X13s Gen 1" ]; then
	exit 0
fi

intf=${1}

# Bytes 2-4 from /etc/machine-id
nic=$(sed 's/\(..\)/\1:/g' /etc/machine-id | cut -c 4-11)

# Qualcomm OUI
oui="8c:fd:f0"

mac="${oui}:${nic}"
echo "Set MAC addr of ${intf} to ${mac}"
/bin/ip link set "${intf}" address "${mac}"
