#!/usr/bin/execlineb -P
# Store ALSA levels.
# Do not use bare backtick: it needs a command after the block.
ifelse { test -x /usr/sbin/alsactl } {
	foreground { install -d -m 755 /run/alsa/runtime }
	ifelse -n { test -d /proc/asound } { exit 0 }
	export HOME /run/alsa
	export XDG_RUNTIME_DIR /run/alsa/runtime
	foreground {
		redirfd -w 1 /dev/null
		redirfd -w 2 /dev/null
		/usr/sbin/alsactl store
	}
	exit 0
}
ifelse -n { test -x /sbin/alsactl } { exit 0 }
foreground { install -d -m 755 /run/alsa/runtime }
ifelse -n { test -d /proc/asound } { exit 0 }
export HOME /run/alsa
export XDG_RUNTIME_DIR /run/alsa/runtime
foreground {
	redirfd -w 1 /dev/null
	redirfd -w 2 /dev/null
	/sbin/alsactl store
}
exit 0
