[vdr] 03/06: Migrate config files to /etc/vdr/conf.d
Tobias Grimm
tiber-guest at moszumanska.debian.org
Thu Mar 12 22:54:08 UTC 2015
This is an automated email from the git hooks/post-receive script.
tiber-guest pushed a commit to branch master
in repository vdr.
commit b64907f415ac10497fa81f8e44f2389b932a9857
Author: etobi <git at e-tobi.net>
Date: Sun Mar 8 01:40:32 2015 +0100
Migrate config files to /etc/vdr/conf.d
---
debian/00-vdr.conf | 21 ++++++
debian/changelog | 5 +-
debian/dvbhddevice.conf | 7 ++
debian/dvbsddevice.conf | 7 ++
debian/migrate-old-config.sh | 18 +++++
debian/plugin-loader.sh | 126 ----------------------------------
debian/vdr-plugin-dvbhddevice.install | 4 +-
debian/vdr-plugin-dvbhddevice.links | 1 +
debian/vdr-plugin-dvbsddevice.install | 2 +
debian/vdr-plugin-dvbsddevice.links | 1 +
debian/vdr.init | 25 +------
debian/vdr.install | 3 +-
debian/vdr.postinst | 4 ++
13 files changed, 71 insertions(+), 153 deletions(-)
diff --git a/debian/00-vdr.conf b/debian/00-vdr.conf
new file mode 100644
index 0000000..5d8f5a1
--- /dev/null
+++ b/debian/00-vdr.conf
@@ -0,0 +1,21 @@
+#
+# This file contains the arguments for VDR if invoked without arguments on the
+# command line.
+#
+# See `man vdr`.
+#
+
+[vdr]
+--video=/var/lib/video
+--config=/var/lib/vdr
+--lib=/usr/lib/vdr/plugins
+--record=/usr/lib/vdr/vdr-recordingaction
+--epgfile=/var/cache/vdr/epg.data
+--user=vdr
+--grab=/tmp
+--port=6419
+--watchdog=60
+--lirc
+--vfat
+#--shutdown=/usr/lib/vdr/vdr-shutdown.wrapper
+#--userdump
diff --git a/debian/changelog b/debian/changelog
index 44747a0..c2246a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-vdr (2.2.0-2) UNRELEASED; urgency=medium
+vdr (2.2.0-1) UNRELEASED; urgency=medium
* New upstream release
* Dropped upgrade code for pre-Squeeze releases
@@ -7,6 +7,9 @@ vdr (2.2.0-2) UNRELEASED; urgency=medium
* When LIRC is set to an empty string, disable LIRC. By default use
/var/run/lirc/lircd
* Updated copyright
+ * Arguments for vdr are now read from /etc/vdr/conf.d/
+ * Plugins must provide a config, which may cointain plugin arguments, in
+ /etc/vdr/conf.d/ in order to be loaded
-- Tobias Grimm <etobi at debian.org> Sat, 07 Mar 2015 13:02:02 +0100
diff --git a/debian/dvbhddevice.conf b/debian/dvbhddevice.conf
new file mode 100644
index 0000000..1d04398
--- /dev/null
+++ b/debian/dvbhddevice.conf
@@ -0,0 +1,7 @@
+#
+# dvbhddevice VDR plugin arguments
+#
+
+[dvbhddevice]
+
+# no arguments for this plugin
diff --git a/debian/dvbsddevice.conf b/debian/dvbsddevice.conf
new file mode 100644
index 0000000..8384ca1
--- /dev/null
+++ b/debian/dvbsddevice.conf
@@ -0,0 +1,7 @@
+#
+# dvbsddevice VDR plugin arguments
+#
+
+[dvbsddevice]
+
+# no arguments for this plugin
diff --git a/debian/migrate-old-config.sh b/debian/migrate-old-config.sh
new file mode 100644
index 0000000..60e43db
--- /dev/null
+++ b/debian/migrate-old-config.sh
@@ -0,0 +1,18 @@
+#
+# Move settings from /etc/default/vdr to /etc/vdr/conf.d/00-vdr.conf
+#
+
+. /usr/lib/vdr/config-loader.sh
+
+sed -e "s|\(--video\)=.*|\1=$VIDEO_DIR|g" \
+ -e "s|\(--port\)=.*|\1=$SVDRP_PORT|g" \
+ -e "s|\(--user\)=.*|\1=$USER|g" \
+ -e "s|\(--config\)=.*|\1=$CFG_DIR|g" \
+ -e "s|\(--lib\)=.*|\1=$PLUGIN_DIR|g" \
+ -e "s|\(--record\)=.*|\1=$REC_CMD|g" \
+ -e "s|\(--epfile\)=.*|\1=$EPG_FILE|g" \
+ -e "s|.*\(--vfat\)|$([ "$VFAT" != "1" ] && echo '#')\1|g" \
+ -e "s|.*\(--userdump\)|$([ "$ENABLE_CORE_DUMPS" != "1" ] && echo '#')\1|g" \
+ -e "s|.*\(--shutdown\)|$([ "$ENABLE_SHUTDOWN" != "1" ] && echo '#')\1|g" \
+ -e "s|.*--lirc.*|$([ -n "$LIRC" ] && echo "--lirc=$LIRC" || echo '#--lirc')|g" \
+ -i /etc/vdr/conf.d/00-vdr.conf
diff --git a/debian/plugin-loader.sh b/debian/plugin-loader.sh
deleted file mode 100644
index 3319e45..0000000
--- a/debian/plugin-loader.sh
+++ /dev/null
@@ -1,126 +0,0 @@
-#
-# This file is called by /etc/init.d/vdr
-#
-
-getplugins ()
-{
- local installed_plugins
- local ordered_plugins
- local ordered_top_plugins
- local ordered_bottom_plugins
- local plugin
- local i
- local arguments
- local plugins
- local packages
- local leftout
- local leftout2
- local vdrcmd
- local version
-
- vdrcmd="/usr/bin/vdr -u $USER $OPTIONS"
-
- CACHE_DIR="/var/cache/vdr"
- CACHE_FILE="${CACHE_DIR}/plugin_search_cache"
- CACHE_MD5="${CACHE_FILE}.md5"
-
- version=`eval "$vdrcmd -V -L/usr/bin/vdr 2>/dev/null | sed 's/.*(\(.*\)).*/\1/'"`
- test "$version" || version="unknown version"
-
- PLUGINS=""
-
- echo -ne "\nSearching for plugins (VDR $version) "
-
- # find installed plugins
- version=`echo "$version" | sed 's:.*/::'`
- # cached plugin index up to date ?
- if [ -e ${CACHE_MD5} ] && \
- [ -e ${CACHE_FILE} ] && \
- md5sum ${PLUGIN_DIR}/${PLUGIN_PREFIX}*.so.${version} ${CACHE_FILE} 2>&1 | cmp -s - ${CACHE_MD5}
- then
- plugins=`cat ${CACHE_FILE}`
- echo -ne "(cache hit):"
- else
- echo -ne "(cache miss):"
- # clear stale cache files
- rm -f ${CACHE_FILE} ${CACHE_MD5}
- plugins=(`find ${PLUGIN_DIR} -maxdepth 1 \
- -name "${PLUGIN_PREFIX}*.so.${version}" | \
- xargs -r dpkg -S 2>&1 | \
- sed "s/^dpkg:/'':/" | \
- sed "s/:.*${PLUGIN_PREFIX}\([^\.]\+\)\.so\.${version}.*$/:\1/"`)
- # write results into cache
- echo ${plugins[@]} > ${CACHE_FILE}
- md5sum ${PLUGIN_DIR}/${PLUGIN_PREFIX}*.so.${version} ${CACHE_FILE} > ${CACHE_MD5} 2>&1
- fi
- installed_plugins=(`echo ${plugins[@]} | sed 's/[^ ]*://g'`)
- packages=( vdr `echo ${plugins[@]} | sed 's/:[^ ]*//g'`)
-
- if [ "$PLUGIN_CHECK_STARTABLE" = "yes" ]; then
-
- # move not startable plugins to $leftout2
- for (( i=${#installed_plugins[@]}, i-- ; i >= 0 ; i-- )); do
- if ! eval "$vdrcmd -V -L $PLUGIN_DIR -P ${installed_plugins[$i]}" \
- 2>/dev/null | grep -q "^${installed_plugins[$i]} "; then
- leftout2="${leftout2} ${installed_plugins[$i]}"
- unset installed_plugins[$i]
- fi
- done
-
- # cleanup the installed_plugins array
- installed_plugins=( "${installed_plugins[@]}" )
- fi
-
- if [ -r "$PLUGIN_CFG_DIR/order.conf" ]; then
- # extract top and bottom ordered plugins from config
- while read plugin ; do
- for (( i=0 ; i<${#installed_plugins[@]} ; i++ )); do
- if [ "$plugin" = "*" ]; then
- ordered_top_plugins=( "${ordered_plugins[@]}" )
- unset ordered_plugins
- break
- fi
- if [ "$plugin" = "-${installed_plugins[$i]}" ]; then
- unset installed_plugins[$i]
- installed_plugins=( "${installed_plugins[@]}" )
- break
- fi
- if [ "$plugin" = "${installed_plugins[$i]}" ]; then
- ordered_plugins=( "${ordered_plugins[@]}" "$plugin" )
- unset installed_plugins[$i]
- installed_plugins=( "${installed_plugins[@]}" )
- break
- fi
- done
- done < <(egrep -v "(^\s*#|^\s*$)" $PLUGIN_CFG_DIR/order.conf)
- ordered_bottom_plugins=( "${ordered_plugins[@]}" )
- fi
-
- # append top ordered unordered and bottom ordered plugins
- ordered_plugins=( "${ordered_top_plugins[@]}" "${installed_plugins[@]}" "${ordered_bottom_plugins[@]}")
-
- # add the command line arguments for each plugin
- for plugin in ${ordered_plugins[@]}; do
- echo -n " $plugin"
- if [ -r "$PLUGIN_CFG_DIR/plugin.$plugin.conf" ] ; then
- arguments=( `cat $PLUGIN_CFG_DIR/plugin.$plugin.conf | sed "s/#.*$//"` )
- PLUGINS="$PLUGINS -P \"$plugin ${arguments[*]}\""
- else
- PLUGINS="$PLUGINS -P $plugin"
- fi
- done
-
- # warn about incompatible plugins
- if [ ! -z "$leftout" ]; then
- echo -ne "\nWARNING: The following plugins have been left out due to"\
- "possible binary incompatibility: "
- echo -n $leftout
- fi
-
- # warn about not startable plugins
- if [ ! -z "$leftout2" ]; then
- echo -ne "\nWARNING: The following plugins have been left out due to"\
- "really binary incompatibility: "
- echo -n $leftout2
- fi
-}
diff --git a/debian/vdr-plugin-dvbhddevice.install b/debian/vdr-plugin-dvbhddevice.install
index b2a7bf4..fc1eecc 100644
--- a/debian/vdr-plugin-dvbhddevice.install
+++ b/debian/vdr-plugin-dvbhddevice.install
@@ -1,2 +1,4 @@
usr/lib/vdr/plugins/libvdr-dvbhddevice.so.*
-usr/share/locale/*/*/vdr-dvbhddevice.*
\ No newline at end of file
+usr/share/locale/*/*/vdr-dvbhddevice.*
+
+debian/dvbhddevice.conf etc/vdr/conf.avail/
diff --git a/debian/vdr-plugin-dvbhddevice.links b/debian/vdr-plugin-dvbhddevice.links
new file mode 100644
index 0000000..61e67ac
--- /dev/null
+++ b/debian/vdr-plugin-dvbhddevice.links
@@ -0,0 +1 @@
+etc/vdr/conf.avail/dvbhddevice.conf etc/vdr/conf.d/50-dvbhddevice.conf
diff --git a/debian/vdr-plugin-dvbsddevice.install b/debian/vdr-plugin-dvbsddevice.install
index 77c0462..5d214e5 100644
--- a/debian/vdr-plugin-dvbsddevice.install
+++ b/debian/vdr-plugin-dvbsddevice.install
@@ -1 +1,3 @@
usr/lib/vdr/plugins/libvdr-dvbsddevice.so.*
+
+debian/dvbsddevice.conf etc/vdr/conf.avail/
diff --git a/debian/vdr-plugin-dvbsddevice.links b/debian/vdr-plugin-dvbsddevice.links
new file mode 100644
index 0000000..8b5e618
--- /dev/null
+++ b/debian/vdr-plugin-dvbsddevice.links
@@ -0,0 +1 @@
+etc/vdr/conf.avail/dvbsddevice.conf etc/vdr/conf.d/50-dvbsddevice.conf
diff --git a/debian/vdr.init b/debian/vdr.init
index 242fa81..e569641 100644
--- a/debian/vdr.init
+++ b/debian/vdr.init
@@ -28,11 +28,6 @@ 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/plugin-loader.sh
. /usr/lib/vdr/commands-loader.sh
@@ -81,26 +76,8 @@ startvdr()
mergecommands "reccmds"
configure_console_input
- if [ "$VFAT" == "1" ]; then
- OPTIONS="--vfat $OPTIONS"
- fi
-
- if [ -n "$LIRC" ]; then
- LIRC_OPT="--lirc=$LIRC"
- else
- LIRC_OPT=""
- fi
-
- if [ "$ENABLE_CORE_DUMPS" == "1" ]; then
- ulimit -c unlimited
- OPTIONS="$OPTIONS --userdump"
- fi
-
start-stop-daemon --start --quiet --startas $DAEMON --background -d /tmp \
- --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 $OPTIONS $LIRC_OPT $PLUGINS $REDIRECT
+ --name $(basename $DAEMON) --pidfile $PIDFILE --make-pidfile -- $REDIRECT
else
echo -n " - seems to be running already"
fi
diff --git a/debian/vdr.install b/debian/vdr.install
index 1863244..c478630 100644
--- a/debian/vdr.install
+++ b/debian/vdr.install
@@ -14,13 +14,13 @@ epg2html usr/lib/vdr/
debian/runvdr usr/sbin/
debian/config-loader.sh usr/lib/vdr/
-debian/plugin-loader.sh usr/lib/vdr/
debian/commands-loader.sh usr/lib/vdr/
debian/vdr-groups.sh usr/lib/vdr/
debian/vdr-recordingaction usr/lib/vdr/
debian/vdr-shutdown usr/lib/vdr/
debian/vdr-shutdown.wrapper usr/lib/vdr/
+debian/00-vdr.conf /etc/vdr/conf.d/
debian/vdr.groups etc/vdr/
debian/R90.custom etc/vdr/recording-hooks/
debian/S90.custom etc/vdr/shutdown-hooks/
@@ -34,3 +34,4 @@ debian/themes/*.theme var/lib/vdr/themes/
var/lib/vdr/channels.conf.sat usr/share/vdr/channels.conf-examples/
channels.conf.* usr/share/vdr/channels.conf-examples/
+debian/migrate-old-config.sh usr/share/vdr/
diff --git a/debian/vdr.postinst b/debian/vdr.postinst
index 6773f75..69b21af 100644
--- a/debian/vdr.postinst
+++ b/debian/vdr.postinst
@@ -115,6 +115,10 @@ case "$1" in
InstallUserAndGroupVdr
ConfigureOwnerShip
+
+ if dpkg --compare-versions "$2" lt "2.2.0-1"; then
+ sh /usr/share/vdr/migrate-old-config.sh || true
+ fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vdr-dvb/vdr.git
More information about the pkg-vdr-dvb-changes
mailing list