Allora, premetto che uso Debian wheezy che non implementa upstart nativamente, quindi i mie script vengono avviati la prima volta da rc.local.
Se usi ubuntu invece non dovresti avere problemi nel farli partire in automatico al boot.
Sono partito anch'io da una distro minimale ( con deboostrap) per poi aggiungere quello che serviva.
Per vdr non ho usato la versione fornita con debian ma ho compilato il tutto da zero (1.7.28) e lasciandolo nella directory /VDR.
Per Xine e xbmc invece ho usato le versioni fornite da Debian, installando i pacchetti con apt-get per evitare l'installazione di ciò che non mi interessava.
Questo è l'elenco per xine, se mancano alcuni pacchetti (dev) non riesci a compilare o non ti parte xine per la mancanza dei plugin di input per vdr:
libxine2
libxine2-bin
libxine2-dev
libxine2-doc
libxine2-ffmpeg
libxine2-misc-plugins
libxine2-plugins
libxine2-vdr
libxine2-x
libxine2-xvdr
xine-ui
Come dicevo servono upstart, openbox e dbus2vdr e menuorg, upstart e openbox li ho ovviamente installati tramite apt-get.
Dbus2vdr lo scarichi con git:
Codice: Seleziona tutto
git clone https://github.com/flensrocker/vdr-plugin-dbus2vdr.git
lo script vdr-dbus-send.sh lo trovi nella dir del plugin, lo devi copiare in /usr/bin rinominandolo in vdr-dbus-send
menuorg:
http://projects.vdr-developer.org/attac ... 4.5.tar.gz
xine-plugins
http://home.vrweb.de/~rnissl/vdr-xine-0.9.4.tgz
patch per compilare xine:
http://patchwork.linuxtv.org/patch/12937/raw/
xineliboutput come da wiki:
Codice: Seleziona tutto
cvs -z3 -d:pserver:anonymous@xineliboutput.cvs.sourceforge.net:/cvsroot/xineliboutput co vdr-xineliboutput
Questi sono gli script che uso, la configurazione di vdr è sotto /etc/vdr.
/etc/vdr/vdr.conf
Codice: Seleziona tutto
DAEMON=/VDR/vdr
VDR_LANG=it_IT.UTF-8
VIDEO_DIR="/mnt/dati/video"
CFG_DIR="/etc/vdr"
VDRSHUTDOWN="/etc/vdr/vdrshutdown"
EPG_FILE="/etc/vdr/epg.data"
SVDRP_PORT="6419"
OPTIONS=" --localedir=/VDR/locale"
LIRC="--lirc=/var/run/lirc/lircd"
LIB_PLUGINS="/VDR/PLUGINS/lib"
PLUGINS="-Pxine -Pmenuorg -Pdbus2vdr -P'xineliboutput --local=none --primary --remote=37890'"
/etc/vdr/plugins/menuorg.xml
Codice: Seleziona tutto
!--
This is the config file for the Menuorg plug-in.
-->
<menus>
<system name="Schedule" />
<system name="Channels" />
<menu name="Timer">
<system name="Timers" />
<plugin name="epgsearchonly" />
<plugin name="quickepgsearch" />
<plugin name="conflictcheckonly" />
</menu>
<menu name="Video">
<system name="Recordings" />
<plugin name="burn" />
<plugin name="dvdswitch" />
<plugin name="dvdselect" />
<plugin name="dvd" />
<plugin name="xineliboutput" />
</menu>
<menu name="XBOX MEDIA CENTER">
<command name="XBMC" execute="/Script/menuorg-appswitcher standalone=yes app=xbmc &> /dev/null " />
</menu>
<menu name="Sistema">
<menu name="Comandi">
<command name="Rimozione unità USB in sicurezza" confirm="yes" execute="/usr/bin/halevt-umount -ra &> /dev/null" />
<command name="Aggiorna elenco registrazioni VDR" execute="vdr-dbus-send /Recording recording.Update &> /dev/null " />
<command name="Elenco Comandi" execute="/Script/echo_comandi.sh" />
<command name="Riavvia VDR" confirm="yes" execute="restart vdr" />
<command name="Riavvia sistema" confirm="yes" execute="/sbin/reboot" />
<command name="Arresta sistema" execute="/sbin/shutdown -h now > /dev/null & " />
</menu>
<system name="Setup" />
<plugin name="femon" />
<plugin name="filebrowser" />
<plugin name="avolctl" />
<plugin name="suspendoutput" />
<plugin name="recstatus" />
</menu>
</menus>
Ovviamente puoi togliere quello che non interessa, ma non dà problemi, le voci dei plugins vengono visualizate solo se presenti.
/Script/menuorg-appswitcher
Codice: Seleziona tutto
#!/bin/bash
# switch applications from vdr menu
for ARG in $@ ; do
KEY="${ARG/=*}"
VALUE="${ARG/*=}"
case $KEY in
standalone)
STANDALONE=$VALUE
;;
window)
WINDOW=$VALUE
;;
app)
APP=$VALUE
;;
display)
XDISPLAY=$VALUE
;;
*)
echo "unknown argument: $KEY"
;;
esac
done
# finished parsing arguments
STOP="/sbin/initctl stop --no-wait"
# minimum required arguments
if [ -z $STANDALONE ] || [ -z $APP ]; then
echo "minimum required argument (standalone, app) not given, exit now ..."
exit 0
fi
if [ ! -z $XDISPLAY ]; then
OPTIONS="DISPLAY=:$XDISPLAY"
export DISPLAY=:$XDISPLAY
else
OPTIONS="DISPLAY=:1"
export DISPLAY=:1
fi
if [ "x$STANDALONE" = "xyes" ]; then
$STOP vdr-frontend &> /dev/null
/sbin/initctl start --no-wait toggle JOBNAME=$APP OPTIONS=$OPTIONS STANDALONE=yes &> /dev/null
else
/sbin/initctl start --no-wait toggle JOBNAME=$APP OPTIONS=$OPTIONS &> /dev/null
fi
Questa è la parte di upstart, tutti i file sono sotto /etc/init
/etc/init/vdr.conf
Codice: Seleziona tutto
# Starts the vdr, with config and installed plugins
description "VDR upstart script"
author " "
start on ( (local-filesystems and started udev-finish and stopped networking) or \
stopped vdr-exit-other or \
resume )
stop on runlevel [!2345]
post-start script
LANG=C /sbin/status openbox | grep -q process && /sbin/initctl emit vdr-frontend-restart || /bin/true
end script
kill timeout 15
normal exit 0
nice -10
script
# load default values and overrides from /etc/default/vdr
. /etc/vdr/vdr.conf
# set language
LANG=it_IT.UTF-8
LC_ALL=it_IT.UTF-8
export LANG LC_ALL
eval $DAEMON -c $CFG_DIR -L $LIB_PLUGINS $PLUGINS -v $VIDEO_DIR $LIRC -E $EPG_FILE -s $VDRSHUTDOWN $OPTIONS 2>&1 >/tmp/vdr.log
end script
/etc/init/vdr-frontend.conf
Codice: Seleziona tutto
# vdr-frontend - Starts xine or vdr-sxfe
#
description "vdr-frontend"
author " "
start on vdr or vdr-frontend-restart or resume
stop on stopping vdr or suspend or stopping openbox
nice -10
respawn
pre-start script
if [ -e /tmp/.standalone ]; then
vdr-dbus-send /Remote remote.Disable ||:
exit 1
fi
end script
env HOME=/root
#env XINE_BUFFER_LOG=1
env USE_AUTOCROP=0
export USE_AUTOCROP
script
export DISPLAY=:1
#ASPECT_RATIO="anamorphic"
GEOMETRY=`xrandr | grep "\*" | cut -d" " -f4`
test -f /etc/default/xine && . /etc/default/xine
XINEOPTS="-G $GEOMETRY -A alsa -V xv -f --post vdr --post vdr_video --post tvtime --post vdr_audio --no-gui --no-logo --no-splash -pq"
if [ -n "$ASPECT_RATIO" ]; then
XINEOPTS="$XINEOPTS --aspect-ratio=$ASPECT_RATIO"
fi
if [ "$USE_AUTOCROP" = "1" ]; then
XINEOPTS="$XINEOPTS --post autocrop:enable_autodetect=1,enable_subs_detect=1,soft_start=1,stabilize=1"
fi
while [ ! -e /tmp/vdr-xine/stream ] ; do sleep 0.1 ; done
while ! grep -q "^ 0" /proc/asound/cards ; do sleep 1 ; done
exec start-stop-daemon --start --exec /usr/bin/xine --user root -c root -- $XINEOPTS "vdr:/tmp/vdr-xine/stream#demux:mpeg_pes" 2>&1 > /tmp/vdr-frontend.log
end script
ovviamente questo è per xine, se vuoi usare vdr-sxfe devi sostituire la parte interessata
/etc/init/xbmc.conf
Codice: Seleziona tutto
description "XBMC Daemon"
author " "
env DISPLAY=:1
export DISPLAY
pre-start script
vdr-dbus-send /Remote remote.Disable ||:
if [ ! -z $STANDALONE ] ; then
touch /tmp/.standalone
fi
end script
post-stop script
/bin/rm -f /tmp/.standalone
vdr-dbus-send /Remote remote.Enable ||:
/sbin/initctl emit --no-wait vdr-frontend-restart
end script
script
eval ulimit -c unlimited
su -c "python /usr/share/xbmc/FEH.py --standalone --lircdev /var/run/lirc/lircd" root
RET=$?
if [ $RET -ne 0 ]; then
exit $RET
fi
exec start-stop-daemon --start --exec /usr/lib/xbmc/xbmc.bin --user root --chuid root \
-- --standalone --lircdev /var/run/lirc/lircd
end script
/etc/init/xbmc-exit.conf
Codice: Seleziona tutto
start on stopped xbmc
task
script
logger -t "XBMC" "XBMC exit with exit status $EXIT_STATUS, $EXIT_SIGNAL, ENV: $(env) ."
case $EXIT_STATUS in
64|66)
vdr-dbus-send /Remote remote.HitKey string:'Power' || /bin/true
;;
*)
# signal-event reset-display-rate
initctl emit vdr-frontend-restart
;;
esac
end script
/etc/init/toggle.conf
Codice: Seleziona tutto
description "toggle job $JOBNAME"
author "Holger Reichelt <holgerr@yavdr.de>"
script
stop $JOBNAME || start $JOBNAME $OPTIONS STANDALONE=$STANDALONE
end script
/etc/init/openbox.conf
Codice: Seleziona tutto
start on (local-filesystems )
stop on runlevel [!2345]
respawn
env DISPLAY=:1
env XORGCONFIG=/etc/X11/xorg.conf
env xorg_driver
script
# D-bus
if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
eval `dbus-launch --sh-syntax --exit-with-session`
fi
if [ -e /etc/default/locale ]; then
. /etc/default/locale
fi
exec xinit /usr/bin/openbox --config-file /etc/X11/openbox/rc.xml --startup "/sbin/initctl emit --no-wait openbox-started" -- :1 vt7
end script
/etc/init/openbox-tools.conf
Codice: Seleziona tutto
start on openbox-started
task
env DISPLAY=:1
export DISPLAY
script
LANG=C /sbin/status vdr | grep -q process && /sbin/initctl emit vdr-frontend-restart || /bin/true
xset -dpms s off -display :1
if [ -e /etc/default/locale ] ; then
. /etc/default/locale
fi
if [ ! "$LANG" = "" ]; then
setxkbmap ${LANG/_*} ||:
else
setxkbmap ||:
fi
end script
In teoria non dovrei aver dimenticato nulla, ma non si può mai sapere
.
Comunque per avviare il tutto io lancio da rc.local in sequenza start openbox, start vdr e tutto parte.
Per avviare subito xbmc devo ancora dargli un'occhiata, solo che ora è tardi e domani sarò cotto.
Spero che possa esserti utile.
Ciao