View Single Post
  #3   (View Single Post)  
Old 1st May 2008
starbuck's Avatar
starbuck starbuck is offline
Port Guard
 
Join Date: Apr 2008
Location: Eugene, OR
Posts: 31
Default

Quote:
Originally Posted by Carpetsmoker View Post
Here is a script that will load the sound drivers one by one, detect which one you're using, and add it to /boot/loader.conf.

This will work on any version of FreeBSD.

Code:
#!/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
Nice shell script. Any chance on seeing a "BSD Scripting 101" guide or a post with some useful tutorials?
Reply With Quote