[Pkg-alsa-devel] Bug#279325: a better dev.d script
Marco d'Itri
md@Linux.IT (Marco d'Itri), 279325@bugs.debian.org
Tue, 2 Nov 2004 12:11:05 +0100
--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Package: alsa-base
Version: 1.0.6a-8
Severity: normal
Installing /etc/dev.d/sound/alsa-base.dev is not such a great idea,
because the script will be run for every sound device created, which
are a large number.
So, I propose installing the attached script as
/etc/dev.d/snd/controlC0/alsa-base.dev instead.
/etc/dev.d/snd/controlC[0-4]/alsa-base.dev would be symlinks to it.
BTW, there is still the issue of /var/lib/alsa/asound.state not being
on the root file system and so not being available at the time dev.d
scripts are usually run. Probably, at least, alsactl should use
/etc/alsa/asound.state (which may be a symlink to the /var file by
default, I will leave this to your taste).
Please also do not install a file in /etc/udev/permissions.d/, there is
no reason to move permissions data from udev to other packages.
--
ciao, |
Marco | [8881 scQ2/wvjwgH.o]
--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="alsa-base.dev"
#!/bin/sh -e
# This script restores and saves the card settings on creation and removal
# of the associated control device /dev/snd/controlC*.
dev_number="${DEVNAME#*/controlC}"
case "$dev_number" in
[0-9]*)
;;
*)
echo "Cannot determine the card number for device '$DEVNAME'"
exit 1
;;
esac
case "$ACTION" in
add)
exec /usr/sbin/alsactl restore $dev_number
;;
remove)
exec /usr/sbin/alsactl store $dev_number
;;
*)
exit 0
;;
esac
--+HP7ph2BbKc20aGI--