A small script to customize FreeBSD
Antonio Olivares
olivares14031 at gmail.com
Tue May 31 23:02:00 UTC 2011
>> You could always have ${1:-theuser} instead to have a default of
>> theuser, but take the value for username as the first argument.
>>
>> Chris
>>
>
> That's a good idea. The user was originally called "me", but I wanted
> something that could be searched and replaced without breaking "gnome"
> and "home". Using a parameter would be even better, thanks!.
> _______________________________________________
For the sound setup:
loadSoundVBX() {
echo loadsoundVBX...
kldload snd_driver
cat /dev/sndstat
echo 'snd_ich_load="YES"' >> /boot/loader.conf
}
kldload snd_driver
will load the sound driver that it thinks would be the best, but then
the driver is changed to ``snd_ich`` in the script. If a user has
``snd_hda``, then the script should output snd_hda and substitute in
the loading statement.
I see the following code could do the job, but it might need some testing :(
#!/bin/sh
#
# Detect sound driver
for driver in /boot/kernel/snd_*; do
driver=$(echo ${driver} | sed 's|/boot/kernel/snd_||')
if [ ${driver} = "driver.ko" ]; then
continue;
fi
kldload snd_${driver}
if [ -c /dev/mixer0 ]; then
echo "I'm smelling 'snd_${driver}'"
echo "snd_${driver}_load=\"YES\"" >> /boot/loader.conf
exit 0
fi
kldunload snd_${driver}
done
This found in here:
http://forums.freebsd.org/showthread.php?t=22726
The script looks very nice and it could be a valuable asset for the
future. Still, there are some things that we(users) need to do by
hand and get our hands dirty :)
In my case, I could not determine my sound card, I did not get very
nice information from cat /dev/sndstat
[olivares at tricorehome ~]$ cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <HDA VIA VT1708B_1 PCM #0 Analog> (play/rec) default
pcm1: <HDA VIA VT1708B_1 PCM #1 Analog> (play)
pcm2: <HDA VIA VT1708B_1 PCM #2 Digital> (play)
But thanks to list members and their experience, someone suggested to
use snd_hda and it worked to perfection :)
Regards,
Antonio
More information about the freebsd-questions
mailing list