29 lines
578 B
Bash
Executable File
29 lines
578 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
stateDir="${STORMUX_ALSA_STATE_DIR:-/home/stormux/.local/state/alsa}"
|
|
stateFile="${stateDir}/asound.state"
|
|
action="${1:-}"
|
|
|
|
usage() {
|
|
printf 'Usage: %s restore|store\n' "${0##*/}" >&2
|
|
}
|
|
|
|
case "$action" in
|
|
restore)
|
|
if [[ ! -f "$stateFile" ]]; then
|
|
exit 0
|
|
fi
|
|
exec /usr/bin/alsactl -f "$stateFile" restore
|
|
;;
|
|
store)
|
|
install -d -o root -g root -m 755 "$stateDir"
|
|
exec /usr/bin/alsactl -f "$stateFile" store
|
|
;;
|
|
*)
|
|
usage
|
|
exit 2
|
|
;;
|
|
esac
|