blob: 36115ea04558270fe88dfd625e7007393bc069e9 (
plain)
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
|
#!/bin/sh
# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis)
# von Marc Wernecke - www.zulu-entertainment.de
# 24.03.2009
# runvdr
VDRLANG="de_DE.iso88591"
VDRCHARSET="ISO-8859-9"
KILL="/usr/bin/killall -q -TERM"
KERNEL=`uname -r`
VDRCONFIG=/etc/default/vdr
LOGGER="logger -s ${0##*/} "
function VdrSettings() {
# read vdr default configuration
if [ -f "$VDRCONFIG" ]; then
. $VDRCONFIG
else
$LOGGER "exit, because $VDRCONFIG does not exists"
exit 1
fi
# read sysconfig generated by setup-plugin
if [ "$setup" = "on" ] && [ -f "$VDRCONFDIR/plugins/setup/sysconfig" ]; then
. "$VDRCONFDIR/plugins/setup/sysconfig"
fi
# test if vdr exists and is executable
test -x "$VDRPRG" || exit 0
# create tmp files
$VDRPRG --help | sed -e '/^$/d' -e 's/^. //' > /tmp/vdr-help.tmp
$VDRPRG --version | sed -e 's/\(^[^ ]*\)\(.*$\)/\1_desc="\1\2"/' -e '/^streamdev/s/-/_/' -e 's/^\[.*//' | sort > /tmp/vdr-desc.cache
# export vdr language
export LANG=$VDRLANG
export LC_ALL=$VDRLANG
export VDR_CHARSET_OVERRIDE=$VDRCHARSET
# export HOME
if [ "$VDRUSER" = "root" ]; then
export HOME="/root"
else
export HOME="$VDRCONFDIR"
fi
# java / projectx for burn and dvdconvert
if [ "$burn" = "on" ] || [ "$dvdconvert" = "on" ]; then
[ -z "$JAVA_HOME" ] && export JAVA_HOME="/usr/lib/jvm/java-6-sun/jre"
[ -z "$PROJECTX_HOME" ] && export PROJECTX_HOME="/usr/bin/ProjectX"
fi
# set DISPLAY
# - activate automatic login
# - copy x-vdr/extra/xhost to ~/.kde/Autostart and set xhost executable
if [ "$softdevice" = "on" ] || [ "$xineliboutput" = "on" ]; then
[ -z "$DISPLAY" ] && export DISPLAY=:$XV_DISPLAY
fi
# load nvram
if [ `which nvram-wakeup | wc -l` -gt 0 ] && [ `lsmod | grep -cw 'nvram'` -eq 0 ]; then
modprobe -q nvram
fi
# load cdfs
if [ `lsmod | grep -cw 'cdfs'` -eq 0 ]; then
modprobe -q cdfs
fi
# load av7710ir
if [ -e /proc/av7110_ir ] || [ -e /proc/budget_ci_ir ]; then
for FILE in av7110_ir budget_ci_ir; do
if [ -e "/proc/$FILE" ]; then
chown $VDRUSER:$VDRGROUP /proc/$FILE
fi
done
if [ `lsmod | grep -cw 'evdev'` -eq 0 ]; then modprobe -q evdev ; fi
fi
# load em8300
if [ "$em8300" = "on" ]; then
# EM8300="/lib/modules/$KERNEL/em8300"
# if [ -f "$EM8300/adv717x.ko" ] && [ -f "$EM8300/bt865.ko" ] && [ -f "$EM8300/em8300.ko" ]; then
# $VDRSCRIPTDIR/rmm
# $VDRSCRIPTDIR/ldm
[ "$dxr3" != "on" ] && em8300setup
# fi
fi
# load parport
if [ "$graphlcd_base" = "on" ]; then
[ `lsmod | grep -cw 'parport'` -eq 0 ] && modprobe -q parport
[ `lsmod | grep -cw 'parport_pc'` -eq 0 ] && modprobe -q parport_pc
[ `lsmod | grep -cw 'ppdev'` -eq 0 ] && modprobe -q ppdev
# chmod 0666 /dev/parport0
fi
# only for mplayer via xine
# - copy x-vdr/extra/xhost to ~/.kde/Autostart and set xhost executable
if [ "$VDRUSER" != "root" ] && [ "$xine" = "on" ] && [ "$mplayer" = "on" ]; then
chmod 666 /dev/rtc
# echo 1024 > /proc/sys/dev/rtc/max-user-freq
fi
# plugins
PLUGINS=""
ignore_cmd=""
if [ "$USE_SYSCONFIG" = "on" ]; then # use PLUGINLIST from sysconfig
PLUGINS="$PLUGINLIST"
else # start creating a temporary pluginlist ...
# plugin api version
plugin_api="$(grep -m1 '^vdr_desc=' /tmp/vdr-desc.cache | sed -e 's/^vdr_desc=//' -e 's/[^)]*$//' -e 's/^[^\/]*//g' -e 's/\///' -e 's/\/*)//')"
[ -n "$plugin_api" ] || plugin_api="$($VDRPRG --version | grep -m1 '^vdr ' | sed -e 's/[^)]*$//' -e 's/^[^\/]*//g' -e 's/\///' -e 's/\/*)//')"
# put these plugins on top of the pluginlist
if [ -n "$PLUGINS_ON_TOP" ]; then
for p in $PLUGINS_ON_TOP ; do
if [ -f "$VDRLIBDIR/libvdr-${p}.so.${plugin_api}" ]; then
ignore_cmd="$ignore_cmd -I libvdr-${p}.so.${plugin_api}"
plugin=$(echo $p | sed -e "s/-/_/g") # this is for streamdev-...
if [ "${!plugin}" = "on" ]; then
plugin_args="${plugin}_args"
if [ -n "${!plugin_args}" ]; then
PLUGINS="$PLUGINS -P'${p} ${!plugin_args}'"
else
PLUGINS="$PLUGINS -P'${p}'"
fi
fi
fi
done
fi
# read libdir and continue creating pluginlist
files=$(ls -B $ignore_cmd "$VDRLIBDIR" | grep "^libvdr-" | grep ".so.${plugin_api}$" | sed -e "s/^libvdr-//g" -e "s/.so.${plugin_api}$//g")
if [ -n "$files" ]; then
for p in $files ; do
plugin=$(echo $p | sed -e "s/-/_/g") # this is for streamdev-...
if [ -z "${!plugin}" ] && [ -f "$VDRLIBDIR/libvdr-$(echo $plugin | sed -e "s/_/-/g").so.${plugin_api}" ]; then
echo "" >> $VDRCONFIG
echo "# $p" >> $VDRCONFIG
echo "${plugin}=\"off"\" >> $VDRCONFIG
eval ${plugin}="off"
# plugin args
nl=0; (( nl=$(grep -n "^$p " /tmp/vdr-help.tmp | cut -f 1 -d ":") +1 ))
[ $nl -gt 1 ] && [ $(sed -n "${nl}p" /tmp/vdr-help.tmp | grep -c "^-") -gt 0 ] && echo "${plugin}_args=\"\"" >> $VDRCONFIG
fi
if [ "${!plugin}" = "on" ]; then
plugin_args="${plugin}_args"
if [ -n "${!plugin_args}" ]; then
PLUGINS="$PLUGINS -P'${p} ${!plugin_args}'"
else
PLUGINS="$PLUGINS -P'${p}'"
fi
fi
done
fi
# special plugin settings
[ "$remote" = "on" ] && chmod 0666 $remote_event
fi
# scripts
VDRRECCMDS=""
[ -x "$VDRSCRIPTDIR/vdrreccmds" ] && VDRRECCMDS="-r $VDRSCRIPTDIR/vdrreccmds"
VDRSETTIME=""
[ -x "$VDRSCRIPTDIR/vdrsettime" ] && [ $(grep -c "\-T CMD, --timeset=CMD" /tmp/vdr-help.tmp) -gt 0 ] && VDRSETTIME="-T $VDRSCRIPTDIR/vdrsettime"
VDRSHUTDOWN=""
[ -x "$VDRSCRIPTDIR/vdrshutdown" ] && VDRSHUTDOWN="-s $VDRSCRIPTDIR/vdrshutdown"
# keyboard tty (terminal for vdr)
VDRKEYBTTY=""
if [ "$KEYB_TTY" != "" ]; then
VDRKEYBTTY="-t $KEYB_TTY"
[ "$VDRUSER" != "root" ] && chmod 0666 $KEYB_TTY
fi
# cmd
VDRCMD="$VDRPRG -w $WATCHDOG -v $VIDEODIR -c $VDRCONFDIR -E $VDRVARDIR/epg.data -L $VDRLIBDIR -u $VDRUSER \
$VDRRECCMDS $VDRSETTIME $VDRSHUTDOWN $VDRKEYBTTY $PLUGINS $OPTIONS "
}
# modules
function get_modulenames() {
KVERS=`uname -r | grep -e '2.6'`
if [ -z "$KVERS" ]; then
MODULES=`lsmod | grep 'dvb-core' | cut -d'[' -f2 | cut -d']' -f1`
else
MODULES=`lsmod | grep '^dvb_core' | awk '{print $4;}' | awk '{ gsub(/,/," ", $1); print }'`
fi
}
get_modulenames
if [ -z "$MODULES" ]; then # If no DVB-Modules were found, try to load
modprobe -q dvb # the module with the name dvb, this could
get_modulenames # be an alias for the dvb-ttpci-module or
fi # another dvb-module
MODULES="$MODULES dvb-core"
if [ `echo $MODULES | grep -cw 'b2c2_flexcop'` -gt 0 ] && [ `echo $MODULES | grep -cw 'b2c2_flexcop_pci'` -eq 0 ]; then
MODULES="b2c2_flexcop_pci $MODULES"
fi
# clear TTY
if [ "$KEYB_TTY" != "" ]; then
clear > $KEYB_TTY
fi
# main script
while (true) do
# load vdr settings
VdrSettings
# start X
MSG="Starting Xserver for VDRUSER: '$VDRUSER'"
[ "$XPLAYER" = "on" ] && echo "$MSG" && su "$VDRUSER" -c "startx &"
# start vdr
$LOGGER "Starting Video Disk Recorder at `date`"
eval $VDRCMD >/dev/null 2>&1
if test $? -eq 0; then
$LOGGER "Video Disk Recorder stopped at `date`"
[ "$XPLAYER" = "on" ] && $KILL Xorg
exit 0
fi
# stop vdr
$LOGGER "Stopping Video Disk Recorder at `date`"
[ "$XPLAYER" = "on" ] && $KILL Xorg
$KILL $VDRPRG
wait `pidof $VDRPRG`
# unload modules
for MODULE in $MODULES; do
rmmod $MODULE >/dev/null 2>&1
wait `pidof rmmod`
done
# load modules
for MODULE in $MODULES; do
modprobe $MODULE >/dev/null 2>&1
done
done
# clear tty
if [ "$KEYB_TTY" != "" ]; then
clear > $KEYB_TTY
fi
|