Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] startup-script
I have build a little startup script, to help me loading the DVB-modules
at startup.
Maybe, someone can use it. It generates the /dev/ost-stuff on the fly if
required.
ciaou
Harry
-- Attached file included as plaintext by Listar --
-- File: dvb
#! /bin/sh
#
# Loading and unloading of DVB modules - actualy Ver 0.8.1
# creates devices in /dev/ost if needed on the fly
#
# Author: Harald Lipphaus Harald.Lipphaus@epost.de
#
# /sbin/init.d/dvb
#
# and symbolic its link
#
# /sbin/rcdvb
#
# is this running un a SuSE distribution ?
if test -e /var/adm/SuSE* ; then
SuSE="yes"
else
SuSE="no"
fi
if test "$SuSE" == "yes" ; then
. /etc/rc.status
. /etc/rc.config
fi
#this are the lists of modules
# they are loaded in the listed order
# and unloaded in reverse order
napi_modules="dvbdev
demux
video
audio
sec
frontend
ca
###" # this is needed by my reverse function
# perhaps you can find a better way...
dvb_modules="i2c-core
videodev
saa7146_core
saa7146_v4l
VES1893
VES1820
dmxdev
dvb_demux
dvb
tuner
###"
# this are the options for the modules
# curently only options for "dvb" and "saa7146_core are implemented
dvb_options="init_chan=1"
saa7146_core_options="mode=0"
#-------------------------------------------------------------------------------
# You schouldn't need to change anything below these line
#-------------------------------------------------------------------------------
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
if test "$SuSE" == "yes" ; then
# Force execution if not called by a runlevel directory.
test $link = $base && START_DVB=yes
test "$START_DVB" = yes || exit 0
fi
reverse ()
{
local _line
while read -d " \t" _line ; do
reverse
echo "$_line"
break
done
}
mkcdev ()
{
local i
if !( test -c "$1" ); then
echo "creating $1[0..2]"
for i in 0 1 2 3; do
mknod -m 0666 "$1"$i c $2 $(($3+$i))
done
cd /dev/ost
ln -s `basename "$1"0` `basename $1`
fi
}
check_napi ()
{
if !( test -d /dev/ost ); then
echo "NAPI-device-files not found !"
mkdir /dev/ost
chmod 755 /dev/ost
fi
mkcdev /dev/ost/video 250 0
mkcdev /dev/ost/sec 251 0
mkcdev /dev/ost/sec 251 0
mkcdev /dev/ost/audio 252 0
mkcdev /dev/ost/qpskfe 253 0
mkcdev /dev/ost/demux 254 0
mkcdev /dev/ost/dvr 254 64
}
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
# First reset status of this service
if test "$SuSE" == "yes" ; then
rc_reset
fi
case "$1" in
start)
echo "Starting service DVB"
check_napi
# At first the new napi devices
for i in $napi_modules ;do
if test "$i" != "###" ; then
echo -ne "Loading $i \r"
insmod $i >/dev/null
fi
done
echo "NAPI interface loaded..."
# and now the classsical DVB driver
for i in $dvb_modules; do
if test "$i" != "###" ; then
echo -ne "Loading $i \r"
case "$i" in
saa7146_core) insmod $i $saa7146_core_options >/dev/null
;;
dvb) insmod $i $dvb_options >/dev/null
;;
*) insmod $i >/dev/null
;;
esac
fi
done
echo "DVB-driver loaded..."
if test "$SuSE" == "yes" ; then
# Remember status and be verbose
rc_status -v
fi
;;
stop)
echo -n "Shutting down service DVB"
# first the classsical DVB driver
for i in `echo $dvb_modules | reverse`; do
echo -ne "Unoading $i \r"
rmmod $i
done
# ... and now the napi modules
for i in `echo $napi_modules | reverse`; do
echo -ne "Unoading $i \r"
rmmod $i
done
echo "DVB-driver unloaded..."
if test "$SuSE" == "yes" ; then
# Remember status and be verbose
rc_status -v
fi
;;
restart)
## If first returns OK call the second, if first or
## second command fails, set echo return value.
$0 stop && $0 start
# Remember status and be quiet
if test "$SuSE" == "yes" ; then
rc_status
fi
;;
reload)
$0 stop && $0 start
# Remember status and be verbose
rc_status -v
;;
status)
echo -n "Checking for service DVB: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
#checkproc /usr/sbin/foo && echo OK || echo No process
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
if test "$SuSE" == "yes" ; then
rc_exit
fi
---
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.
Home |
Main Index |
Thread Index