"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "usr/sbin/soundoff" of archive oss-linux-v4.0-1016-x86_64.tar.gz:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 #!/bin/sh
    2 if test -f /etc/oss.conf
    3 then
    4   . /etc/oss.conf
    5 else
    6   OSSLIBDIR=/usr/lib/oss
    7 fi
    8 
    9 if ! test -f /proc/opensound/devfiles
   10 then
   11   echo OSS not loaded.
   12   exit 0
   13 fi
   14 
   15 if ! test -f $OSSLIBDIR/etc/installed_drivers
   16 then
   17 	echo $OSSLIBDIR/etc/installed_drivers is missing.
   18 	exit 1
   19 fi
   20 
   21 
   22 PROGRAMS="`fuser /dev/mixer* /dev/dsp* /dev/midi* /dev/oss/*/* 2>/dev/null`"
   23   
   24 if test "$PROGRAMS " != " "
   25 then
   26   echo
   27   echo Some applications are still using OSS - cannot unload
   28   echo
   29 
   30   for n in $PROGRAMS
   31   do
   32     if test -f /proc/$n/cmdline
   33     then
   34       echo $n `cat /proc/$n/cmdline`
   35     else
   36       echo $n Unknown
   37     fi
   38   done
   39 
   40   echo
   41   echo Please stop these applications and run soundoff again
   42   exit 2
   43 fi
   44 
   45 # Some video drivers depend on osscore (soundcore) and need to be removed
   46 # before OSS can be unloaded.
   47 #VIDEODRIVERS="tvmixer saa7134-empress saa7134-dvb saa7134"
   48 
   49 # Save mixer settings automatically if requested
   50 if test -f $OSSLIBDIR/etc/userdefs && grep -q "autosave_mixer yes" $OSSLIBDIR/etc/userdefs
   51 then
   52 	/usr/sbin/savemixer
   53 fi
   54 
   55 for i in 1 2 3
   56 do
   57   for n in $VIDEODRIVERS `cat $OSSLIBDIR/etc/installed_drivers | sed 's/ .*//'`
   58   do
   59     /sbin/modprobe -r $n > /dev/null 2>&1
   60   done
   61 done
   62 
   63 rmmod cuckoo > /dev/null 2>&1
   64 rmmod cuckoo_pcm > /dev/null 2>&1
   65 rmmod cuckoo_mixer > /dev/null 2>&1
   66 
   67 #modprobe -r snd-pcm > /dev/null 2>&1
   68 
   69 for n in `cat $OSSLIBDIR/etc/installed_drivers | sed 's/ .*//'` osscore
   70 do
   71     /sbin/modprobe -r $n
   72 done
   73 
   74 if ! test -f /proc/opensound/devfiles # OSS gone?
   75 then
   76   exit 0
   77 fi
   78 
   79 echo Cannot unload the OSS driver modules
   80 
   81 exit 3