1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
|
#!/bin/sh
if test -f /etc/oss.conf
then
. /etc/oss.conf
else
OSSLIBDIR=/usr/lib/oss
fi
if ! test -d /proc
then
echo soundon script requires procfs to be mounted at /proc!
exit 200
fi
if test -f /proc/opensound/devfiles
then
echo OSS is already loaded.
exit 0
fi
if test -f $OSSLIBDIR/starting
then
echo Previous start of OSS crashed the system
echo Please resolve the situation and remove file
echo \"$OSSLIBDIR/starting\". Then start OSS by
echo running soundon again.
exit 1
fi
NOTIFY=0
LOG=/var/log/soundon.log
echo "Open Sound System starting" `date` > $LOG
echo "OSS version: " `cat $OSSLIBDIR/version.dat` >> $LOG 2>&1
KERNEL_VERSION=`uname -r`
echo "Kernel version: " $KERNEL_VERSION >> $LOG
KERNEL_VERMAGIC=`/usr/sbin/ossvermagic -z -s`
echo "Kernel vermagic: " $KERNEL_VERMAGIC >> $LOG 2>&1
if ! test -f $OSSLIBDIR/etc/installed_drivers
then
echo No $OSSLIBDIR/etc/installed_drivers - running ossdetect >> $LOG
/usr/sbin/ossdetect -v >> $LOG
fi
if ! test -f $OSSLIBDIR/etc/installed_drivers
then
echo Still no $OSSLIBDIR/etc/installed_drivers - cannot continue >> $LOG
echo No $OSSLIBDIR/etc/installed_drivers - cannot continue
exit 10
fi
UBUNTU_OVERRIDE=
POS_UBUNTU_OVERRIDE=
if test -f /lib/modules/$KERNEL_VERSION/kernel/oss/osscore.ko
then
# Verify that vermagic of OSS matches the kernel vermagic
OSS_VERMAGIC=`/usr/sbin/ossvermagic -z -q /lib/modules/$KERNEL_VERSION/kernel/oss/osscore.ko`
if ! test "$OSS_VERMAGIC " = "$KERNEL_VERMAGIC "
then
OSS_ORIG_VERMAGIC="$OSS_VERMAGIC"
OSS_VERMAGIC=`/usr/sbin/ossvermagic -z -u -q /lib/modules/$KERNEL_VERSION/kernel/oss/osscore.ko`
POS_UBUNTU_OVERRIDE=1
fi
if ! test "$OSS_VERMAGIC " = "$KERNEL_VERMAGIC "
then
echo "Old vermagic: " $OSS_VERMAGIC >> $LOG
rm -rf /lib/modules/$KERNEL_VERSION/kernel/oss
echo Previous OSS modules were for a different kernel version - removed
echo Previous OSS modules were for a different kernel version - removed >> $LOG
elif test "$POS_UBUNTU_OVERRIDE " = "1 "
then
echo "Vermagic backup check activated for Ubuntu. Backup vermagic: $OSS_VERMAGIC. OSS stored vermagic $OSS_ORIG_VERMAGIC" >> $LOG
UBUNTU_OVERRIDE="-u"
fi
fi
if ! test -f /lib/modules/$KERNEL_VERSION/kernel/oss/osscore.ko
then
NOTIFY=1
echo Relinking OSS kernel modules for \"$KERNEL_VERMAGIC\"
echo This may take few moments - please stand by...
echo Relinking OSS kernel modules for $KERNEL_VERMAGIC >> $LOG
rm -f /var/log/relink.log
if ! (cd $OSSLIBDIR/build && sh install.sh > /var/log/relink.log 2>&1)
then
cat /var/log/relink.log >> $LOG 2>&1
cat /var/log/relink.log
echo
echo Relinking the OSS kernel modules failed
rm -f /var/log/relink.log
exit 20
fi
cat /var/log/relink.log >> $LOG 2>&1
echo Relinking OSS kernel modules finished
rm -f /var/log/relink.log
fi
if ! test -f /lib/modules/$KERNEL_VERSION/kernel/oss/osscore.ko
then
echo
echo No /lib/modules/$KERNEL_VERSION/kernel/oss/osscore.ko module >> $LOG
echo No /lib/modules/$KERNEL_VERSION/kernel/oss/osscore.ko module in the system
exit 30
fi
OSS_VERMAGIC=`/usr/sbin/ossvermagic -z $UBUNTU_OVERRIDE -q /lib/modules/$KERNEL_VERSION/kernel/oss/osscore.ko`
echo "OSS vermagic: " $OSS_VERMAGIC >> $LOG
if ! test "$OSS_VERMAGIC " = "$KERNEL_VERMAGIC "
then
echo OSS driver modules do not match the current kernel >> $LOG
echo
echo Error: OSS driver modules do not match the current kernel
echo
echo "Kernel vermagic: " $KERNEL_VERMAGIC
echo "OSS vermagic: " $OSS_VERMAGIC
echo
echo The most likely reason is that the kernel development package
echo installed in the system is wrong. Please refer to the documentation
echo of your Linux distribution for more info about setting up the
echo kernel/driver development environment properly.
echo
exit 40
fi
if test -f $OSSLIBDIR/etc/license.asc
then
/usr/sbin/ossdetect -l >> $LOG
fi
if test -d /proc/asound || grep -q '^ *14 ' < /proc/devices
then
if ! sh $OSSLIBDIR/scripts/remove_drv.sh>> $LOG
then
echo Failed to disable conflicting sound drivers >> $LOG
echo Failed to disable conflicting sound drivers
echo Reboot and try running soundon again
echo
echo Also check that you have not compiled sound support statically
echo into the kernel.
exit 50
fi
fi
echo >> $LOG
echo '*** Loading OSS kernel modules ***' >> $LOG
echo >> $LOG
touch $OSSLIBDIR/starting
sync
OPTIONS=
if test -f $OSSLIBDIR/conf/osscore.conf
then
OPTIONS="`grep -v -h '^#' $OSSLIBDIR/conf/osscore.conf|sed 's/[ \t]//g'`"
fi
if ! /sbin/modprobe osscore $OPTIONS
then
echo Loading the osscore module failed
echo Loading the osscore module failed >> $LOG
dmesg >> $LOG
exit 60
fi
echo "osscore module loaded OK" >> $LOG
for n in `cat $OSSLIBDIR/etc/installed_drivers | sed 's/#.*//'`
do
OPTIONS=
if test -f $OSSLIBDIR/conf/$n.conf
then
OPTIONS="`grep -v -h '^#' $OSSLIBDIR/conf/$n.conf|sed 's/[ \t]//g'`"
fi
if ! /sbin/modprobe $n $OPTIONS
then
echo Loading module $n failed '-' ignored >> $LOG
echo Loading module $n failed '-' ignored
else
echo $n module loaded OK >> $LOG
fi
done
echo >> $LOG
echo '*** Finished loading OSS kernel modules ***' >> $LOG
echo >> $LOG
if ! test -f /proc/opensound/devfiles
then
echo OSS Core module refused to start >> $LOG
echo OSS Core module refused to start
dmesg >> $LOG
exit 70
fi
/usr/sbin/ossdetect -d >> $LOG 2>&1
# Restore the legacy device links. This is necessary because in some
# Linux distributions they get lost when the system is booted.
if test -f $OSSLIBDIR/etc/legacy_devices
then
sh $OSSLIBDIR/etc/legacy_devices >> $LOG 2>&1
fi
/usr/sbin/ossdevlinks -v >> $LOG 2>&1
echo "+++ ossinfo -v3 +++" >> $LOG
ossinfo -v3 >> $LOG 2>&1
echo "+++ /dev/sndstat +++" >> $LOG
cat /dev/sndstat >> $LOG 2>&1
echo "+++ dmesg +++" >> $LOG
dmesg >> $LOG
echo "+++ lspci +++" >> $LOG
lspci -vnn >> $LOG 2>&1
echo "+++ /proc/interrupts +++" >> $LOG
cat /proc/interrupts >> $LOG 2>&1
echo "+++ /proc/cpuinfo +++" >> $LOG
cat /proc/cpuinfo >> $LOG 2>&1
echo "+++ /proc/opensound/devfiles +++" >> $LOG
cat /proc/opensound/devfiles >> $LOG 2>&1
ls -l /dev/dsp* /dev/mixer* /dev/midi* /dev/oss/*/* >> $LOG 2>&1
echo >> $LOG
/usr/sbin/savemixer -L -v >> $LOG 2>&1
# Setup ALSA emulation
if test -f $OSSLIBDIR/.cuckoo_installed
then
# Use kernel based ALSA compatibility
if ! test -f /lib/modules/$KERNEL_VERSION/kernel/sound/core/snd.ko
then
sh $OSSLIBDIR/scripts/setup-alsa.sh >> $LOG 2>&1
depmod -a
fi
echo "*** Setting up ALSA compatibility ****" >> $LOG
modprobe cuckoo >> $LOG 2>&1
head -10 /proc/asound/version >> $LOG 2>&1
lsmod|grep snd >> $LOG
echo "**************************************" >> $LOG
elif test -f $OSSLIBDIR/.libsalsa_installed
then
# Use library based ALSA compatibility
if test -f $OSSLIBDIR/lib/libsalsa.so.2.0.0
then
if test "`uname -m` " = "x86_64 "
then
ln -sf $OSSLIBDIR/lib/libsalsa.so.2.0.0 /usr/lib64/libasound.so.2
#ln -sf $OSSLIBDIR/lib/libOSSlib.so /usr/lib64
else
if test -s /lib/libasound.so.2
then
ln -sf $OSSLIBDIR/lib/libsalsa.so.2.0.0 /lib/libasound.so.2
#ln -sf $OSSLIBDIR/lib/libOSSlib.so /lib
fi
if test -s /usr/lib/libasound.so.2
then
ln -sf $OSSLIBDIR/lib/libsalsa.so.2.0.0 /usr/lib/libasound.so.2
#ln -sf $OSSLIBDIR/lib/libOSSlib.so /usr/lib
fi
fi
fi
fi
# Setup libOSSlib.so
if test -f $OSSLIBDIR/lib/libOSSlib.so
then
if test "`uname -m` " = "x86_64 "
then
ln -sf $OSSLIBDIR/lib/libOSSlib.so /usr/lib64
ln -sf $OSSLIBDIR/lib/libossmix.so /usr/lib64
else
if test -s /lib/libasound.so.2
then
ln -sf $OSSLIBDIR/lib/libOSSlib.so /lib
ln -sf $OSSLIBDIR/lib/libossmix.so /lib
fi
if test -s /usr/lib/libasound.so.2
then
ln -sf $OSSLIBDIR/lib/libOSSlib.so /usr/lib
ln -sf $OSSLIBDIR/lib/libossmix.so /usr/lib
fi
fi
fi
# Setup Flash 9 audio support plugin for OSS
if test -d /usr/lib64 && test -f $OSSLIBDIR/lib/libflashsupport_64.so
then
ln -sf $OSSLIBDIR/lib/libflashsupport_64.so /usr/lib64/libflashsupport.so
fi
if test -d /usr/lib32 && test -f $OSSLIBDIR/lib/libflashsupport_32.so
then
ln -sf $OSSLIBDIR/lib/libflashsupport_32.so /usr/lib32/libflashsupport.so
fi
if ! test -f /usr/lib/libflashsupport.so && test -f $OSSLIBDIR/lib/libflashsupport_32.so
then
ln -sf $OSSLIBDIR/lib/libflashsupport_32.so /usr/lib/libflashsupport.so
fi
if test -x $OSSLIBDIR/soundon.user
then
echo Running $OSSLIBDIR/soundon.user >> $LOG
$OSSLIBDIR/soundon.user >> $LOG 2>&1
fi
# Use alternative place for soundon.user
if test -x /etc/oss/soundon.user
then
echo Running /etc/oss/soundon.user >> $LOG
/etc/oss/soundon.user >> $LOG 2>&1
fi
if test "`ossinfo -g|grep TRIAL` " != " "
then
echo
echo "************************************************************"
echo "* NOTE! You are using trial version of Open Sound System *"
echo "************************************************************"
echo
sleep 1
fi
if test "`ossinfo -g|grep EXPIRED` " != " "
then
echo
echo "****************************************************************"
echo "* NOTE! Your Open Sound System evaluation license has expired *"
echo "****************************************************************"
echo
sleep 15
fi
if test "$NOTIFY " = "1 "
then
echo
echo OSS started OK
fi
rm -f $OSSLIBDIR/starting
exit 0
|