#!/bin/bash

CONFIG_FILE="/boot/firmware/usercfg.txt"
OVERLAY="disable-wifi"

DT_OVERLAY="dtoverlay=${OVERLAY}"

if grep -q "${DT_OVERLAY}" ${CONFIG_FILE}; then
	if ! grep -q "^${DT_OVERLAY}"  ${CONFIG_FILE}; then
		sed -i -e "s|#${DT_OVERLAY}|${DT_OVERLAY}|" ${CONFIG_FILE}
	fi
    else
	echo "${DT_OVERLAY}" >> ${CONFIG_FILE}
fi
