Search
j0ke.net Open Build Service
>
Projects
>
multimedia
:
SL11
>
dvb
> rcdvb
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File rcdvb of Package dvb
#! /bin/bash # Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH # Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH # Copyright (c) 2002, 2003, 2004 SuSE Linux AG # Copyright (c) 2005 SUSE LINUX Products GmbH # # Author: Kurt Garloff, Ludwig Nussel # # init.d/dvb # # and symbolic its link # # /sbin/rcdvb # # System startup script for the dvb card driver # ### BEGIN INIT INFO # Provides: dvb # Required-Start: # Required-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: (re)loads drivers for DVB cards. # Description: This script is mostly useless nowadays as drivers # are loaded automatically. You may configure vdr to use it # to reload drivers in case vdr crashes though. See # /etc/sysconfig/vdr ### END INIT INFO # Source SuSE config . /etc/sysconfig/dvb kernelversion=`IFS=. read a b c < <(uname -r); echo $a.$b` av7110_loadkeys_path="/usr/share/dvb/av7110_loadkeys" if [ "$kernelversion" = 2.4 ]; then moddir=/lib/modules/`uname -r`/dvb else moddir=/lib/modules/`uname -r`/kernel/drivers/media/dvb fi frontend_modules() { if [ "$kernelversion" = 2.4 ]; then for vendor in ves alps_ st grundig_ tda mt; do for m in $moddir/$vendor*; do test -e $m && basename $m .o done done else for m in $moddir/frontends/*; do test -e $m && basename $m .ko done fi } load_modules() { if [ -z "$DVB_LOAD_MODULES" ]; then modprobe -q dvb-core # XXX this one could be PCI probed !!! modprobe -q dvb-ttpci # this one too (#36969) grep -q bttv /proc/modules && modprobe -q dvb-bt8xx # Frontends are behind an I2C bus, hard to probe. # insert all drivers and see which one finds a device. for m in `frontend_modules`; do modprobe -q $m done elif [ "$DVB_LOAD_MODULES" = "no" ]; then : else echo -n " [" for module in $DVB_LOAD_MODULES; do echo -n " $module" modprobe -q "$module" done echo -n " ]" fi } unload_modules() { if [ -z "$DVB_LOAD_MODULES" ]; then rmmod dvb-bt8xx 2>/dev/null rmmod dvb-ttpci for m in `frontend_modules`; do rmmod $m done rmmod dvb-core elif [ "$DVB_LOAD_MODULES" = "no" ]; then : else echo -n " [" for module in $DVB_LOAD_MODULES; do echo -n " $module" rmmod "$module" done echo -n " ]" fi } # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} # 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_failed <num> set local and overall rc status to <num><num> # rc_reset clear local rc status (overall remains) # rc_exit exit appropriate to overall rc status . /etc/rc.status # First reset status of this service rc_reset # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error # 2 - invalid or excess argument(s) # 3 - unimplemented feature (e.g. "reload") # 4 - insufficient privilege # 5 - program is not installed # 6 - program is not configured # 7 - program is not running # # Note that starting an already running service, stopping # or restarting a not-running service as well as the restart # with force-reload (in case signalling is not supported) are # considered a success. case "$1" in start) echo -n "Starting DVB" load_modules rc_status -v if [ -n "$DVB_AV7110_LOADKEYS_FILE" -a \ -e "$av7110_loadkeys_path/$DVB_AV7110_LOADKEYS_FILE" -a \ -w /proc/av7110_ir ]; then echo -n "Loading $DVB_AV7110_LOADKEYS_FILE" /usr/bin/av7110_loadkeys \ "$av7110_loadkeys_path/$DVB_AV7110_LOADKEYS_FILE" \ > /proc/av7110_ir rc_status -v fi ;; stop) echo -n "Shutting down DVB" if [ -n "$RUNLEVEL" -a \( "$RUNLEVEL" = 0 -o "$RUNLEVEL" = 6 \) ]; then # don't waste time unloading drivers at # shutdown/reboot : else unload_modules fi rc_failed 0 # don't say failed if modules were not loaded # Remember status and be verbose rc_status -v ;; try-restart) $0 status >/dev/null && $0 restart # Remember status and be quiet rc_status ;; restart) ## Stop the service and regardless of whether it was ## running or not, start it again. $0 stop $0 start # Remember status and be quiet rc_status ;; force-reload) echo -n "Reload service DVB" $0 stop && $0 start rc_status ;; reload) # not supported rc_failed 3 rc_status -v ;; status) echo -n "Checking for DVB: " # Status has a slightly different for the status command: # 0 - service running # 1 - service dead, but /var/run/ pid file exists # 2 - service dead, but /var/lock/ lock file exists # 3 - service not running # NOTE: checkproc returns LSB compliant status values. /sbin/lsmod|grep -q ^dvb || rc_failed 3 rc_status -v ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" exit 1 ;; esac rc_exit