#!/bin/sh -e

if [ -e /in-pmbootstrap ]; then
	echo "Skipping update of wl1251 calibration data (running in pmbootstrap)"
	exit 0
fi

# Alpine now ships compressed versions of the firmware. In order for wl1251-cal
# to find the uncompressed file name, create it manually
touch /lib/firmware/ti-connectivity/wl1251-nvs.bin

echo "Extracting and writing wl1251 calibration data.."
wl1251-cal --nvs-loading=/dev/null --nvs-push-data=/lib/firmware/ti-connectivity/wl1251-nvs.bin
echo "Done"
