#!/bin/bash # Script: snd2tecra8000 # Function: This Script configures the sound card of a Toshiba # Tecra 8000 # # Source: http://www.imhorst.net/?p=24 # # This script comes with ABSOLUTELY NO WARRANTY and it is public domain. # Globale Variablen SCRIPTNAME=$(basename $0 .sh) VERSION="0.1" VERDATE="December 21, 2006" EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_ERROR=2 EXIT_BUG=10 # Funktionen function usage { echo "Usage: $SCRIPTNAME --help" >&2 echo [[ $# -eq 1 ]] && exit $1 || exit $EXIT_FAILURE } # Count numbers of options here if (( $# < 1 )) ; then echo echo "At least one argument is needed here." echo usage $EXIT_ERROR fi ARG=$1 if [ "$ARG" = "--alsa" -o "$ARG" = "--oss" -o "$ARG" = "--help" -o "$ARG" = "--version" ] ; then if [ "$ARG" = "--help" ] ; then echo " Arguments: --alsa Install sound for the ALSA architecture --oss Install sound for the OSS architecture --help Help, this menu. --version Prints Version Example for installing ALSA when you are root: ./snd2tecra --alsa And with sudo: sudo ./snd2tecra --alsa" echo exit $EXIT_SUCCESS fi if [ "$ARG" = "--version" ] ; then echo "** This is $SCRIPTNAME $VERSION built on $VERDATE" exit $EXIT_SUCCESS fi if [ "$ARG" = "--alsa" -o "$ARG" = "--oss" ] ; then ## Are you root? WHOAMI=`whoami` if [ "$WHOAMI" != "root" ] ; then echo echo "You are not root." usage $EXIT_ERROR else # print welcome greeting echo echo "** This $SCRIPTNAME v$VERSION last updated $VERDATE" echo -n "** Created by Christian Imhorst <" echo -n christian1imhorst2net | tr 12 @. echo ">" echo if [ "$ARG" = "--alsa" ] ; then grep snd-card-0 /etc/modules >& /dev/null RES=$? if [ $RES = 0 ] ; then echo echo "The ALSA driver is already installed on this system..." echo exit $EXIT_SUCCESS else echo echo "Installing ALSA ..." echo echo "alias snd-card-0 snd-opl3sa2 options snd-opl3sa2 dma1=1 dma2=0 fm_port=0x388 irq=5 midi_port=0x330 sb_port=0x220 wss_port=0x530 isapnp=0 # some stuff for the OSS drivers alias char-major-14 snd-pcm-oss alias sound-slot-0 snd-card-0 # aliases for sound card #1 alias sound-service-0-0 snd-mixer-oss alias sound-service-0-1 snd-seq-oss alias sound-service-0-3 snd-pcm-oss alias sound-service-0-8 snd-seq-oss alias sound-service-0-12 snd-pcm-oss" >/etc/modprobe.d/sound echo "snd-card-0" >>/etc/modules fi fi if [ "$ARG" = "--oss" ] ; then grep opl3sa2 /etc/modules >& /dev/null RES=$? if [ $RES = 0 ] ; then echo echo "The OSS driver is already installed on this system..." echo exit $EXIT_SUCCESS else echo echo "Installing OSS ..." echo echo "opl3sa2 io=0x220 mss_io=0x530 mpu_io=0x330 irq=5 dma=1 dma2=0 mpu401 sound ad1848" >>/etc/modules fi fi fi fi else usage $EXIT_ERROR fi exit $EXIT_SUCCESS