"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "usr/sbin/soundon" 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 is already loaded.
   12 	exit 0
   13 fi
   14 
   15 if test -f $OSSLIBDIR/starting
   16 then
   17 	echo Previous start of OSS crashed the system
   18 	echo Please resolve the situation and remove file
   19 	echo \"$OSSLIBDIR/starting\". Then start OSS by
   20 	echo running soundon again.
   21 	exit 1
   22 fi
   23 
   24 NOTIFY=0
   25 
   26 mkdir $OSSLIBDIR/logs > /dev/null 2>&1
   27 
   28 LOG=$OSSLIBDIR/logs/soundon.log
   29 echo "Open Sound System starting" `date` > $LOG
   30 echo "OSS version: " `cat $OSSLIBDIR/version.dat` >> $LOG 2>&1
   31 KERNEL_VERSION=`uname -r`
   32 echo "Kernel version: " $KERNEL_VERSION >> $LOG
   33 KERNEL_VERMAGIC=`/usr/sbin/ossvermagic -z -s`
   34 echo "Kernel vermagic: " $KERNEL_VERMAGIC >> $LOG 2>&1
   35 
   36 if ! test -f $OSSLIBDIR/etc/installed_drivers
   37 then
   38 	echo No $OSSLIBDIR/etc/installed_drivers - running ossdetect >> $LOG
   39 	/usr/sbin/ossdetect -v >> $LOG
   40 fi
   41 
   42 if ! test -f $OSSLIBDIR/etc/installed_drivers
   43 then
   44 	echo Still no $OSSLIBDIR/etc/installed_drivers - cannot continue >> $LOG
   45 	echo No $OSSLIBDIR/etc/installed_drivers - cannot continue
   46 	exit 10
   47 fi
   48 
   49 if  test -f /lib/modules/`uname -r`/kernel/oss/osscore.ko
   50 then
   51 # Verify that vermagic of OSS matches the kernel vermagic
   52 
   53 	OSS_VERMAGIC=`/usr/sbin/ossvermagic -z -q /lib/modules/$KERNEL_VERSION/kernel/oss/osscore.ko`
   54 
   55 	if ! test "$OSS_VERMAGIC " = "$KERNEL_VERMAGIC "
   56 	then
   57 		echo "Old    vermagic: " $OSS_VERMAGIC >> $LOG
   58 		rm -rf /lib/modules/$KERNEL_VERSION/kernel/oss
   59 		echo Previous OSS modules were for a different kernel version - removed
   60 		echo Previous OSS modules were for a different kernel version - removed >> $LOG
   61 	fi
   62 fi
   63 
   64 if ! test -f /lib/modules/`uname -r`/kernel/oss/osscore.ko
   65 then
   66 	NOTIFY=1
   67 	echo Relinking OSS kernel modules for \"$KERNEL_VERMAGIC\"
   68 	echo This may take few moments - please stand by...
   69 	echo Relinking OSS kernel modules for $KERNEL_VERMAGIC >> $LOG
   70 
   71 	rm -f $OSSLIBDIR/logs/relink.log
   72 	if ! (cd $OSSLIBDIR/build && sh install.sh > $OSSLIBDIR/logs/relink.log 2>&1)
   73 	then
   74 		cat $OSSLIBDIR/logs/relink.log >> $LOG 2>&1
   75 		cat $OSSLIBDIR/logs/relink.log
   76 		echo
   77 		echo Relinking the OSS kernel modules failed
   78 		rm -f $OSSLIBDIR/logs/relink.log
   79 		exit 20
   80 	fi
   81 	
   82 	cat $OSSLIBDIR/logs/relink.log >> $LOG 2>&1
   83 	echo Relinking OSS kernel modules finished
   84 	rm -f $OSSLIBDIR/logs/relink.log
   85 fi
   86 
   87 if ! test -f /lib/modules/`uname -r`/kernel/oss/osscore.ko
   88 then
   89 	echo
   90 	echo No /lib/modules/`uname -r`/kernel/oss/osscore.ko module >> $LOG
   91 	echo No /lib/modules/`uname -r`/kernel/oss/osscore.ko module in the system
   92 	exit 30
   93 fi
   94 
   95 OSS_VERMAGIC=`/usr/sbin/ossvermagic -z -q /lib/modules/$KERNEL_VERSION/kernel/oss/osscore.ko`
   96 echo "OSS    vermagic: " $OSS_VERMAGIC >> $LOG
   97 
   98 if ! test "$OSS_VERMAGIC " = "$KERNEL_VERMAGIC "
   99 then
  100 	echo OSS driver modules do not match the current kernel >> $LOG
  101 	echo
  102 	echo Error: OSS driver modules do not match the current kernel
  103 	echo
  104 	echo "Kernel vermagic: " $KERNEL_VERMAGIC
  105 	echo "OSS    vermagic: " $OSS_VERMAGIC
  106 	echo
  107 	echo The most likely reason is that the kernel development package
  108         echo installed in the system is wrong. Please refer to the documentation
  109 	echo of your Linux distribution for more info about setting up the
  110 	echo kernel/driver development environment properly.
  111 	echo
  112 	exit 40
  113 fi
  114 
  115 if test -f $OSSLIBDIR/etc/license.asc
  116 then
  117    /usr/sbin/ossdetect -l >> $LOG
  118 fi
  119 
  120 if ! sh $OSSLIBDIR/scripts/remove_drv.sh>> $LOG
  121 then
  122 	echo Failed to disable conflicting sound drivers >> $LOG
  123 	echo Failed to disable conflicting sound drivers 
  124 	echo Reboot and try running soundon again
  125 	echo
  126 	echo Also check that you have not compiled sound support statically
  127 	echo into the kernel.
  128 	exit 50
  129 fi
  130 
  131 touch $OSSLIBDIR/starting
  132 sync
  133 
  134 echo >> $LOG
  135 echo '*** Loading OSS kernel modules ***' >> $LOG
  136 echo >> $LOG
  137 
  138 OPTIONS=
  139 if test -f $OSSLIBDIR/conf/osscore.conf
  140 then
  141   OPTIONS="`grep -v -h '^#' $OSSLIBDIR/conf/osscore.conf|sed 's/ //g'`"
  142 fi
  143 
  144 if ! /sbin/modprobe osscore $OPTIONS
  145 then
  146 	echo Loading the osscore module failed
  147 	echo Loading the osscore module failed >> $LOG
  148 	dmesg >> $LOG
  149 	exit 60
  150 fi
  151 
  152 echo "osscore module loaded OK" >> $LOG
  153 
  154 for n in `cat $OSSLIBDIR/etc/installed_drivers | sed 's/ .*//'`
  155 do
  156 	OPTIONS=
  157 
  158 	if test -f $OSSLIBDIR/conf/$n.conf
  159 	then
  160 	  OPTIONS="`grep -v -h '^#' $OSSLIBDIR/conf/$n.conf|sed 's/ //g'`"
  161 	fi
  162 
  163 	if ! /sbin/modprobe $n $OPTIONS
  164 	then
  165 		echo Loading module $n failed '-' ignored >> $LOG
  166 		echo Loading module $n failed '-' ignored
  167 	else
  168 		echo $n module loaded OK >> $LOG
  169 	fi
  170 done
  171 echo >> $LOG
  172 echo '*** Finished loading OSS kernel modules ***' >> $LOG
  173 echo >> $LOG
  174 
  175 if ! test -f /proc/opensound/devfiles
  176 then
  177 	echo OSS Core module refused to start >> $LOG
  178 	echo OSS Core module refused to start
  179 	dmesg >> $LOG
  180 	exit 70
  181 fi
  182 
  183 /usr/sbin/ossdetect -d >> $LOG 2>&1
  184 
  185 # Restore the legacy device links. This is necessary because in some
  186 # Linux distributions they get lost when the system is booted.
  187 if test -f $OSSLIBDIR/etc/legacy_devices
  188 then
  189 	sh $OSSLIBDIR/etc/legacy_devices >> $LOG 2>&1
  190 fi
  191 
  192 /usr/sbin/ossdevlinks -v >> $LOG 2>&1
  193 
  194 echo "+++ ossinfo -v3 +++" >> $LOG
  195 ossinfo -v3 >> $LOG 2>&1
  196 echo "+++ /dev/sndstat +++" >> $LOG
  197 cat /dev/sndstat >> $LOG 2>&1
  198 echo "+++ dmesg +++" >> $LOG
  199 dmesg >> $LOG
  200 echo "+++ lspci +++" >> $LOG
  201 lspci -v >> $LOG 2>&1
  202 echo "+++ /proc/interrupts +++" >> $LOG
  203 cat /proc/interrupts >> $LOG 2>&1
  204 echo "+++ /proc/cpuinfo +++" >> $LOG
  205 cat /proc/cpuinfo >> $LOG 2>&1
  206 echo "+++ /proc/opensound/devfiles +++" >> $LOG
  207 cat /proc/opensound/devfiles >> $LOG 2>&1
  208 ls -l /dev/dsp* /dev/mixer* /dev/midi* /dev/oss/*/* >> $LOG 2>&1
  209 
  210 /usr/sbin/savemixer -L >> $LOG 2>&1
  211 
  212 # Setup ALSA emulation
  213 
  214 if test -f $OSSLIBDIR/.cuckoo_installed
  215 then
  216 # Use kernel based ALSA compatibility
  217 
  218   if ! test -f /lib/modules/`uname -r`/kernel/sound/core/snd.ko
  219   then
  220 	sh $OSSLIBDIR/scripts/setup-alsa.sh >> $LOG 2>&1
  221   	depmod -a
  222   fi
  223 
  224   echo "*** Setting up ALSA compatibility ****" >> $LOG
  225   modprobe cuckoo >> $LOG 2>&1
  226   head -10 /proc/asound/version >> $LOG 2>&1
  227   lsmod|grep snd >> $LOG
  228   echo "**************************************" >> $LOG
  229 else
  230 # Use library based ALSA compatibility
  231 
  232   if test -f $OSSLIBDIR/lib/libsalsa.so.2.0.0
  233   then
  234      if test "`uname -m` " = "x86_64 "
  235      then
  236        ln -sf $OSSLIBDIR/lib/libsalsa.so.2.0.0 /usr/lib64/libasound.so.2
  237        #ln -sf $OSSLIBDIR/lib/libOSSlib.so /usr/lib64
  238      else
  239        if test -s /lib/libasound.so.2
  240        then
  241          ln -sf $OSSLIBDIR/lib/libsalsa.so.2.0.0 /lib/libasound.so.2
  242          #ln -sf $OSSLIBDIR/lib/libOSSlib.so /lib
  243        fi
  244   
  245        if test -s /usr/lib/libasound.so.2
  246        then
  247          ln -sf $OSSLIBDIR/lib/libsalsa.so.2.0.0 /usr/lib/libasound.so.2
  248          #ln -sf $OSSLIBDIR/lib/libOSSlib.so /usr/lib
  249        fi
  250      fi
  251   fi
  252 fi
  253 
  254 # Setup Flash 9 audio support plugin for OSS
  255 
  256 if test -f $OSSLIBDIR/lib/libflashsupport.so
  257 then
  258   rm -f /usr/lib/libflashsupport.so
  259   ln -sf $OSSLIBDIR/lib/libflashsupport.so /usr/lib/libflashsupport.so
  260 fi
  261 
  262 if test -x $OSSLIBDIR/soundon.user
  263 then
  264   echo Running $OSSLIBDIR/soundon.user >> $LOG
  265   $OSSLIBDIR/soundon.user >> $LOG 2>&1
  266 fi
  267 
  268 if test "$NOTIFY " = "1 "
  269 then
  270   echo
  271   echo OSS started OK
  272 fi
  273 
  274 rm -f $OSSLIBDIR/starting
  275 
  276 exit 0