Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | # |
| 3 | # Copyright Matthias Hentges <devel@hentges.net> (c) 2007 |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame^] | 4 | # SPDX-License-Identifier: GPL-2.0-or-later |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 5 | # |
| 6 | # Filename: alsa-state |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | |
| 8 | # source function library |
| 9 | . /etc/init.d/functions |
| 10 | |
| 11 | asound_restore(){ |
| 12 | echo "ALSA: Restoring mixer settings..." |
| 13 | if test -x /usr/sbin/alsactl -a -e #STATEDIR#/asound.state |
| 14 | then |
| 15 | /usr/sbin/alsactl -f #STATEDIR#/asound.state restore & |
| 16 | fi |
| 17 | } |
| 18 | |
| 19 | asound_store(){ |
| 20 | echo "ALSA: Storing mixer settings..." |
| 21 | if test -x /usr/sbin/alsactl |
| 22 | then |
| 23 | /usr/sbin/alsactl -f #STATEDIR#/asound.state store |
| 24 | fi |
| 25 | } |
| 26 | |
| 27 | case "$1" in |
| 28 | start) asound_restore ;; |
| 29 | stop) asound_store ;; |
| 30 | status) |
| 31 | status /usr/sbin/alsactl; |
| 32 | exit $? |
| 33 | ;; |
| 34 | *) |
| 35 | echo "Usage: /etc/init.d/alsa-state {start|stop|status}" |
| 36 | exit 1 |
| 37 | ;; |
| 38 | esac |