From 12ad64b22c487afd5efff187266d797426563166 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Mon, 22 Oct 2007 20:37:07 +1300 Subject: [PATCH] Add Debian directory (this is Debian native, so no special branch). --- debian/changelog | 5 +++ debian/compat | 1 + debian/config | 25 +++++++++++++ debian/control | 18 ++++++++++ debian/copyright | 31 ++++++++++++++++ debian/cron.d | 4 +++ debian/dirs | 2 ++ debian/docs | 1 + debian/init.d | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ debian/install | 2 ++ debian/postinst | 61 +++++++++++++++++++++++++++++++ debian/postrm | 38 ++++++++++++++++++++ debian/rules | 50 ++++++++++++++++++++++++++ debian/templates | 15 ++++++++ 14 files changed, 347 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/config create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/cron.d create mode 100644 debian/dirs create mode 100644 debian/docs create mode 100644 debian/init.d create mode 100644 debian/install create mode 100644 debian/postinst create mode 100644 debian/postrm create mode 100755 debian/rules create mode 100644 debian/templates diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..8c68fad --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +mythtv-status (0.1) unstable; urgency=low + + * Initial Release. + + -- Andrew Ruthven Sat, 13 Oct 2007 14:23:33 +1300 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/config b/debian/config new file mode 100644 index 0000000..32bf787 --- /dev/null +++ b/debian/config @@ -0,0 +1,25 @@ +#!/bin/sh + +PACKAGE=mythtv-status + +CONFIGFILE=/etc/default/$PACKAGE +set -e +. /usr/share/debconf/confmodule + +# Load config file, if it exists. +if [ -e $CONFIGFILE ]; then + . $CONFIGFILE || true + + + # Store values from config file into + # debconf db. + + db_set $PACKAGE/enable $RUN + db_set $PACKAGE/host $HOST + +fi + +# Ask questions. +db_input medium $PACKAGE/host || true +db_input medium $PACKAGE/enable || true +db_go diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..68a2428 --- /dev/null +++ b/debian/control @@ -0,0 +1,18 @@ +Source: mythtv-status +Section: unknown +Priority: extra +Maintainer: Andrew Ruthven +Build-Depends: debhelper (>= 5) +Standards-Version: 3.7.2 + +Package: mythtv-status +Architecture: all +Depends: ${misc:Depends}, ${perl:Depends}, libwww-perl, libxml-libxml-perl, libdate-manip-perl +Description: Show the MythTV status + Shows the current MythTV status and the next 10 recordings + for today and tomorrow. + . + Also provides funtionality for updating the MOTD with + this information, this can provide a good heads on when + you should avoid heavy CPU or I/O work on your MythTV + backend. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..cf7ae02 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,31 @@ +This package was debianized by Andrew Ruthven on +Sat, 13 Oct 2007 14:23:33 +1300. + +Upstream Author(s): + + Andrew Ruthven + +Copyright: + + Copyright (C) 2007 Andrew Ruthven + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2007, Andrew Ruthven and +is licensed under the GPL, see above. diff --git a/debian/cron.d b/debian/cron.d new file mode 100644 index 0000000..1eeaade --- /dev/null +++ b/debian/cron.d @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the mythtv-status package +# +*/10 * * * * root /etc/init.d/mythtv-status reload > /dev/null diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..ca882bb --- /dev/null +++ b/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/sbin diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README diff --git a/debian/init.d b/debian/init.d new file mode 100644 index 0000000..e5336b9 --- /dev/null +++ b/debian/init.d @@ -0,0 +1,94 @@ +#!/bin/sh +# +# Example init.d script with LSB support. +# +# Please read this init.d carefully and modify the sections to +# adjust it to the program you want to run. +# +# Copyright (c) 2007 Javier Fernandez-Sanguino +# +# This is free software; you may redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2, +# or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License with +# the Debian operating system, in /usr/share/common-licenses/GPL; if +# not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA +# +### BEGIN INIT INFO +# Provides: mythtv-status +# Required-Start: $mythtv-backend +# Required-Stop: +# Should-Start: $named +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Update the MOTD with the MythTV status +# Description: Update the MOTD with the MythTV status +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +DAEMON=/usr/sbin/mythtv-update-motd # Introduce the server's location here +NAME=mythtv-status # Introduce the short server's name here +DESC="MythTV Status" # Introduce a short description here +LOGDIR=/var/log/mythtv-status # Log directory to use + +test -x $DAEMON || exit 0 +test -x $DAEMON_WRAPPER || exit 0 + +. /lib/lsb/init-functions + +# Default options, these can be overriden by the information +# at /etc/default/$NAME +LOGFILE=$LOGDIR/$NAME.log # Server logfile + +# Include defaults if available +if [ -f /etc/default/$NAME ] ; then + . /etc/default/$NAME +fi + +# Use this if you want the user to explicitly set 'RUN' in +# /etc/default/ +if [ "x$RUN" != "xyes" ] ; then + log_failure_msg "$NAME disabled, please adjust the configuration to your needs " + log_failure_msg "and then set RUN to 'yes' in /etc/default/$NAME to enable it." + exit +fi + +set -e + +case "$1" in + start|reload|refresh) + log_daemon_msg "Updating $DESC " "$NAME" + [ ! -f /var/run/motd.orig ] && cp /var/run/motd /var/run/motd.orig + + cp /var/run/motd.orig /var/run/motd.new + + if mythtv-status -h $HOST >> /var/run/motd.new + then + mv /var/run/motd.new /var/run/motd + fi + #$DAEMON + log_end_msg 0 + ;; + stop) + log_daemon_msg "Stoping $DESC " "$NAME" + [ -f /var/run/motd.orig ] && cp /var/run/motd.orig /var/run/motd + log_end_msg 0 + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|reload|refresh}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..0ef1641 --- /dev/null +++ b/debian/install @@ -0,0 +1,2 @@ +bin/mythtv-status usr/bin +bin/mythtv-update-motd usr/sbin diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..c35a57f --- /dev/null +++ b/debian/postinst @@ -0,0 +1,61 @@ +#!/bin/sh +# postinst script for mythtv-status +# +# see: dh_installdeb(1) + +PACKAGE=mythtv-status + +. /usr/share/debconf/confmodule + +set -e + +case "$1" in + configure|reconfigure) + DEBIANCONFIG=/etc/default/$PACKAGE + + # load current settings, most of which will be overwritten. + [ -f $DEBIANCONFIG ] && . $DEBIANCONFIG + + db_get $PACKAGE/host + HOST="${RET:-localhost}" + + db_get $PACKAGE/enable + RUN="${RET:-true}" + + if [ $RUN == 'true' ] + then + RUN='yes' + fi + + cat <<_eof > $DEBIANCONFIG +# $PACKAGE Debian configuration +# +# You can run 'dpkg-reconfigure $PACKAGE' to modify the values in this +# file, if you want. You can also change the values here and changes will +# be preserved. +# +# Do note that only the values are preserved; the rest of the file is +# rewritten. +# + +# RUN: +# Should we actually run and update the MOTD? +RUN=$RUN + +# HOST: +# What host should be check the status on? +HOST=$HOST +_eof + + db_stop + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..b39408b --- /dev/null +++ b/debian/postrm @@ -0,0 +1,38 @@ +#!/bin/sh +# postrm script for mythtv-status +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|failed-upgrade|abort-install|abort-upgrade|disappear) + if [ -f /var/run/motd.orig ] + then + mv /var/run/motd.orig /var/run/motd + fi + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..f804aef --- /dev/null +++ b/debian/rules @@ -0,0 +1,50 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + dh_clean + +install: + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + +# Build architecture-independent files here. +binary-indep: install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install + dh_installdebconf +# Make sure we start after mythtv-backend + dh_installinit -- defaults 21 + dh_installcron + dh_installman + dh_compress + dh_fixperms + dh_perl + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/debian/templates b/debian/templates new file mode 100644 index 0000000..b1283e9 --- /dev/null +++ b/debian/templates @@ -0,0 +1,15 @@ +Template: mythtv-status/host +Type: string +Default: localhost +Description: MythTV backend to check + The MythTV backend to check, you only need to change this if you want to check + a different host. + +Template: mythtv-status/enable +Type: boolean +Default: true +Description: Update the system MOTD? + Should the Message of the Day be updated on system boot and on a regular + basis? + . + To adjust how often the MOTD is updated, edit /etc/cron.d/mythtv-status. -- 2.30.2