run (966B)
1 #!/bin/sh 2 #Fix for sound in alsa without udev 3 #Code mostly copied from OpenRC 4 alsastatedir=/var/lib/alsa 5 alsascrdir=/etc/alsa.d 6 alsahomedir=/run/alsasound 7 cards="$(sed -n -e 's/^ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)" 8 for cardnum in $cards; do 9 [ -e /dev/snd/controlC$cardnum ] || sleep 2 10 [ -e /dev/snd/controlC$cardnum ] || sleep 2 11 [ -e /dev/snd/controlC$cardnum ] || sleep 2 12 [ -e /dev/snd/controlC$cardnum ] || sleep 2 13 alsactl -E HOME="$alsahomedir" -I -f "$alsastatedir/asound.state" restore $cardnum 14 done 15 16 for ossfile in "$alsastatedir"/oss/card*_pcm* ; do 17 [ -e "$ossfile" ] || continue 18 # We use cat because I'm not sure if cp works properly on /proc 19 procfile=$ossfile$alsastatedir/oss 20 procfile="$(echo "$procfile" | sed -e 's,_,/,g')" 21 if [ -e /proc/asound/"$procfile"/oss ] ; then 22 cat "$ossfile" > /proc/asound/"$procfile"/oss 23 fi 24 done 25 sleep 3 26 chown root:audio /dev/snd/* 27 chown root:audio /dev/snd 28 chmod -R a+rw /dev/snd 29 lk_forever 3600