[Archvdr-devel] SF.net SVN: archvdr:[186] trunk/archvdr
Brought to you by:
huceke
|
From: <hu...@us...> - 2009-05-13 16:25:21
|
Revision: 186
http://archvdr.svn.sourceforge.net/archvdr/?rev=186&view=rev
Author: huceke
Date: 2009-05-13 16:25:12 +0000 (Wed, 13 May 2009)
Log Message:
-----------
If someone needs it ;).
Added Paths:
-----------
trunk/archvdr/vdr-1.7.7-ext/
trunk/archvdr/vdr-1.7.7-ext/files/
trunk/archvdr/vdr-1.7.7-ext/files/vdr.default
trunk/archvdr/vdr-1.7.7-ext/files/vdr.init
trunk/archvdr/vdr-1.7.7-ext/vdr.install
Added: trunk/archvdr/vdr-1.7.7-ext/files/vdr.default
===================================================================
--- trunk/archvdr/vdr-1.7.7-ext/files/vdr.default (rev 0)
+++ trunk/archvdr/vdr-1.7.7-ext/files/vdr.default 2009-05-13 16:25:12 UTC (rev 186)
@@ -0,0 +1,25 @@
+# /etc/default/vdr
+#
+# See also /usr/share/doc/README.Debian
+#
+
+# Change to 1 to enable vdr's init-script
+ENABLED=1
+
+# Change this to 1 if you want vdr to be able to shutdown the
+# computer
+ENABLE_SHUTDOWN=1
+
+# Options that will be passed to vdr's commandline
+# for example: OPTIONS="-w 15"
+OPTIONS="-w 60"
+
+# Set this to load only plugins with the correct patch level
+PLUGIN_CHECK_PATCHLEVEL="no"
+PLUGIN_CHECK_STARTABLE="no"
+
+# Locale which is used when running vdr
+VDR_LANG=de_DE.UTF-8
+
+VDR_CHARSET_OVERRIDE="ISO8859-15"
+
Added: trunk/archvdr/vdr-1.7.7-ext/files/vdr.init
===================================================================
--- trunk/archvdr/vdr-1.7.7-ext/files/vdr.init (rev 0)
+++ trunk/archvdr/vdr-1.7.7-ext/files/vdr.init 2009-05-13 16:25:12 UTC (rev 186)
@@ -0,0 +1,143 @@
+#! /bin/bash
+#
+# vdr start-stop script
+#
+### BEGIN INIT INFO
+# Provides: vdr
+# Required-Start: $network $syslog
+# Required-Stop: $network $syslog
+# Should-Start: $local_fs $remote_fs
+# Should-Stop: $local_fs $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Starts the Linux Video Disk Recorder (VDR)
+# Description: Starts the Linux Video Disk Recorder (VDR),
+# if it is enabled in /etc/default/vdr.
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+NAME=vdr
+DESC="Linux Video Disk Recorder"
+
+DAEMON=/usr/sbin/runvdr
+PIDFILE=/var/run/runvdr.pid
+VDRPRG=/usr/bin/vdr
+
+test -x $DAEMON || exit 0
+test -x $VDRPRG || exit 0
+
+. /usr/lib/vdr/config-loader.sh
+
+# Set shutdown command
+test "$ENABLE_SHUTDOWN" = "1" && VDRSHUTDOWN="/usr/lib/vdr/vdr-shutdown.wrapper" \
+ || VDRSHUTDOWN="/usr/lib/vdr/vdr-shutdown-message"
+
+. /usr/lib/vdr/plugin-loader.sh
+. /usr/lib/vdr/commands-loader.sh
+
+
+clean_console()
+{
+ if [ "$KEYB_TTY" != "" ]; then
+ tput -Tlinux clear > $KEYB_TTY
+ fi
+}
+
+configure_console_input()
+{
+ if [ "$KEYB_TTY" != "" ]; then
+ clean_console
+ echo -e "This tty is currently mapped to VDR, keypresses aren't echoed.\r" > $KEYB_TTY
+ echo -n "For a login prompt switch to another console." > $KEYB_TTY
+ REDIRECT="< $KEYB_TTY"
+ if [ "$KEYB_TTY_SWITCH" = "1" ]; then
+ chvt `echo "$KEYB_TTY" | sed "s/\/dev\/tty//"`
+ fi
+ fi
+}
+
+get_status()
+{
+ if start-stop-daemon --start --startas $DAEMON --test \
+ --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null
+ then
+ echo " - is not running."
+ exit 3
+ else
+ echo " - is running."
+ exit 0
+ fi
+}
+
+startvdr()
+{
+ if [ "$ENABLED" != "0" ] ; then
+ # only start vdr if there is no other instance running
+ if start-stop-daemon --start --startas $DAEMON --test \
+ --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null
+ then
+ getplugins
+ mergecommands "commands"
+ mergecommands "reccmds"
+ configure_console_input
+
+ if [ "$VFAT" == "1" ]; then
+ OPTIONS="--vfat $OPTIONS"
+ fi
+
+ start-stop-daemon --start --quiet --startas $DAEMON --background \
+ --name $(basename $DAEMON) --pidfile $PIDFILE --make-pidfile -- \
+ -v $VIDEO_DIR -c $CFG_DIR -L $PLUGIN_DIR -r $REC_CMD \
+ -s $VDRSHUTDOWN -E $EPG_FILE -u $USER -g /tmp \
+ --port $SVDRP_PORT --lirc $PLUGINS $OPTIONS $REDIRECT
+ else
+ echo -n " - seems to be running already"
+ fi
+ else
+ echo -n " - aborted (to enable the daemon, edit /etc/default/vdr)"
+ fi
+}
+
+stopvdr()
+{
+ if start-stop-daemon --stop --retry 30 \
+ --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null
+ then
+ start-stop-daemon --stop --retry 30 --oknodo --exec $VDRPRG >/dev/null
+ rm -f $PIDFILE
+ clean_console
+ else
+ echo -n " - seems not to be running"
+ fi
+}
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: $NAME"
+ startvdr
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping $DESC: $NAME"
+ stopvdr
+ echo "."
+ ;;
+ restart|force-reload)
+ echo -n "Restarting $DESC: $NAME"
+ stopvdr
+ sleep 4
+ startvdr
+ echo "."
+ ;;
+ status)
+ echo -n "Getting status of $DESC: $NAME"
+ get_status
+ ;;
+ *)
+ N=/etc/init.d/$NAME
+ echo "Usage: $N {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
Added: trunk/archvdr/vdr-1.7.7-ext/vdr.install
===================================================================
--- trunk/archvdr/vdr-1.7.7-ext/vdr.install (rev 0)
+++ trunk/archvdr/vdr-1.7.7-ext/vdr.install 2009-05-13 16:25:12 UTC (rev 186)
@@ -0,0 +1,69 @@
+# TODO: Is a fixed gid and uid good?
+
+_USER=vdr
+_GROUP=vdr
+_UID=77
+_GID=77
+_DIRS="/var/lib/video.00 /var/lib/vdr /var/cache/vdr /etc/vdr" # No whitespace in pathes allowed
+_GROUPS="video,optical,audio,storage,tty,power"
+
+# arg 1: the new package version
+post_install() {
+ local dir
+
+ echo ">>>"
+ echo ">>> VDR configuration files are installed at /etc/vdr."
+ echo ">>>"
+
+ echo -n ">>> - Adding group \"$_GROUP\" ... "
+ if groupadd --gid $_UID $_GROUP; then
+ echo "done"
+ fi
+
+ echo -n ">>> - Adding user \"$_USER\" ... "
+ if useradd --uid $_UID --gid $_GID --groups $_GROUPS \
+ --home-dir /var/lib/vdr --shell /bin/bash \
+ --comment "Video Disk Recorder" $_USER; then
+ echo "done"
+ fi
+
+ # Lock the account
+ #passwd -l vdr &>/dev/null
+
+ echo ">>> - Set filesystem permissions for user \"$_USER\": "
+ for dir in $_DIRS; do
+ echo -n ">>> $dir "
+ if [ -e "$dir" ] && chown -R $_USER:$_GROUP "$dir"; then
+ echo "done"
+ else
+ echo "failed"
+ fi
+ done
+
+ chown root:$_GROUP /usr/lib/vdr/ctvdrwrapper
+ chmod a=,u+srwx,g+srx /usr/lib/vdr/ctvdrwrapper
+ chown root:$_GROUP /usr/lib/vdr/vdr-shutdown.wrapper
+ chmod a=,u+srwx,g+srx /usr/lib/vdr/vdr-shutdown.wrapper
+
+ echo ">>>"
+ echo ">>> You may add the following to /etc/sudoers to allow VDR to shutdown"
+ echo ">>> the system, to restart the VDR daemon within VDR or to write the ACPI"
+ echo ">>> wakeup time."
+ echo ">>>"
+ echo ">>> vdr ALL=(root) NOPASSWD: ALL"
+ echo ">>>"
+}
+
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ post_install
+}
+
+# arg 1: the old package version
+post_remove() {
+ # will remove group too if nobody else left in (see man userdel)
+ userdel $_USER
+}
+
+# vim:set ts=2 sw=2 et:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|