#!/bin/bash -eu

case "$NAME" in
	uap*)
		# Use uaputl to configure Marvell uap8xxx hardware
		if [ -f "${MYIFACEDIR%/}/uaputl.stop" ]; then
			cat "${MYIFACEDIR%/}/uaputl.stop" | while read cmd; do
				echo "$cmd" | xargs -- uaputl >&2
			done
		else
			uaputl bss_stop >&2
		fi
		# Try to set leds
		[ -f /sys/class/leds/guruplug\:green\:wmode/brightness ] && echo 0 > /sys/class/leds/guruplug\:green\:wmode/brightness || :
		;;
	*)
		print_error "Unable to determine the AP type from its name"
		exit 1
		;;
esac
