summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeine_Ahnung <no@mail.com>2013-01-25 21:30:41 +0100
committerKeine_Ahnung <no@mail.com>2013-01-25 21:30:41 +0100
commit5727d72f708345a39e1ccda222f7643a25732191 (patch)
tree1c055d4758f922dbd56b8d17799466072046d1d3
parent8e500e48aa6d27f3f61f6659e77cf49b599f7394 (diff)
downloadvdr-plugin-uactivity-5727d72f708345a39e1ccda222f7643a25732191.tar.gz
vdr-plugin-uactivity-5727d72f708345a39e1ccda222f7643a25732191.tar.bz2
starting the scripts, some fixes
-rw-r--r--Make.config.template4
l---------Makefile1
-rw-r--r--Makefile.1.62
-rw-r--r--Makefile.1.7.x12
-rw-r--r--script/uactivity/activity/README0
-rw-r--r--script/uactivity/key/README0
-rw-r--r--script/uactivity/watchdog/README0
-rw-r--r--script/vdr-uactivity43
8 files changed, 56 insertions, 6 deletions
diff --git a/Make.config.template b/Make.config.template
index c1a9c93..04fc5e2 100644
--- a/Make.config.template
+++ b/Make.config.template
@@ -8,10 +8,10 @@
# If you are using upstart you may use
# PLUGIN_UACTIVITY_COMMAND=initctl emit --system --no-wait vdr-uactivity reason=%1$$s orgin=%2$$s value=%3$$s ConfigDirectory=%4$$s CacheDirectory=%5$$s ResourceDirectory=%6$$s
-PLUGIN_UACTIVITY_COMMAND?=echo vdr-uactivity -r %1$$s -o %2$$s -v %3$$s -C %4$$s -c %5$$s -R %6$$s | at now
+PLUGIN_UACTIVITY_COMMAND?=vdr-uactivity -r %1$$s -o %2$$s -v %3$$s -C %4$$s -c %5$$s -R %6$$s
# Set to supress the install of the shell script package
-#PLUGIN_UACTIVITY_NOINSTALL=true
+#PLUGIN_UACTIVITY_NOINSTALL_BIN=true
diff --git a/Makefile b/Makefile
deleted file mode 120000
index eb51ab4..0000000
--- a/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-Makefile.1.6 \ No newline at end of file
diff --git a/Makefile.1.6 b/Makefile.1.6
index 5026e6a..21c6018 100644
--- a/Makefile.1.6
+++ b/Makefile.1.6
@@ -40,7 +40,7 @@ include $(VDRDIR)/Make.global
### Default values:
-PLUGIN_UACTIVITY_COMMAND?=echo vdr-uactivity -r %1$$s -o %2$$s -v %3$$s -C %4$$s -c %5$$s -R %6$$s | at now
+PLUGIN_UACTIVITY_COMMAND?=vdr-uactivity -r %1$$s -o %2$$s -v %3$$s -C %4$$s -c %5$$s -R %6$$s
### The version number of VDR's plugin API (taken from VDR's "config.h"):
diff --git a/Makefile.1.7.x b/Makefile.1.7.x
index 3695f3b..047ad15 100644
--- a/Makefile.1.7.x
+++ b/Makefile.1.7.x
@@ -21,6 +21,8 @@ LIBDIR = $(call PKGCFG,libdir)
LOCDIR = $(call PKGCFG,locdir)
PLGCFG = $(call PKGCFG,plgcfg)
BINDIR = $(call PKGCFG,bindir)
+CFGDIR = $(call PKGCFG,configdir)
+
#
TMPDIR ?= /tmp
@@ -43,7 +45,7 @@ APIVERSION = $(call PKGCFG,apiversion)
### Default values:
-PLUGIN_UACTIVITY_COMMAND?=echo vdr-uactivity -r %1$$s -o %2$$s -v %3$$s -C %4$$s -c %5$$s -R %6$$s | at now
+PLUGIN_UACTIVITY_COMMAND?=vdr-uactivity -r %1$$s -o %2$$s -v %3$$s -C %4$$s -c %5$$s -R %6$$s
### The name of the distribution archive:
@@ -117,7 +119,15 @@ install-lib: $(SOFILE)
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
install-bin:
+ifndef PLUGIN_UACTIVITY_NOINSTALL_BIN
install -D script/vdr-uactivity $(DESTDIR)$(BINDIR)/vdr-uactivity
+ install -d $(DESTDIR)$(CFGDIR)/plugins/$(PLUGIN)/activity
+ install script/uactivity/activity/* $(DESTDIR)$(CFGDIR)/plugins/$(PLUGIN)/activity
+ install -d $(DESTDIR)$(CFGDIR)/plugins/$(PLUGIN)/key
+ install script/uactivity/key/* $(DESTDIR)$(CFGDIR)/plugins/$(PLUGIN)/key
+ install -d $(DESTDIR)$(CFGDIR)/plugins/$(PLUGIN)/watchdog
+ install script/uactivity/watchdog/* $(DESTDIR)$(CFGDIR)/plugins/$(PLUGIN)/watchdog
+endif
install: install-lib install-i18n install-bin
diff --git a/script/uactivity/activity/README b/script/uactivity/activity/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/script/uactivity/activity/README
diff --git a/script/uactivity/key/README b/script/uactivity/key/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/script/uactivity/key/README
diff --git a/script/uactivity/watchdog/README b/script/uactivity/watchdog/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/script/uactivity/watchdog/README
diff --git a/script/vdr-uactivity b/script/vdr-uactivity
index 912cf63..b1504bf 100644
--- a/script/vdr-uactivity
+++ b/script/vdr-uactivity
@@ -1,5 +1,46 @@
#!/bin/sh
-logger -t vdr-uactivity "$1" "$2" "$3" "$4" "$5" "$6"
+# Log to syslog and to stderr
+LOG="mylog"
+
+mylog() {
+ [ -n "$(which logger)" ] && logger -t $(basename ${0}) "${1}"
+ echo "${1}" >&2;
+}
+
+usage(){
+ ${LOG} "Usage: $(basename $0) -r <reason activity|key|watchdog> -o <orgin startup|shutdown|running> -v <value>"
+ ${LOG} " -C <ConfigDirectory> -c <CacheDirectory> -R <ResourceDirectory>"
+ ${LOG} "$cmd_error"
+ exit 1
+}
+
+cmd_error=""
+while getopts ":r:o:v:C:c:R:" opt; do
+ case "$opt" in
+ r) PARAM_REASON="$OPTARG";;
+ o) PARAM_ORGIN="$OPTARG";;
+ v) PARAM_VALUE="$OPTARG";;
+ C) PARAM_CONFIGDIRECTORY="$OPTARG";;
+ c) PARAM_CACHEDIRECTORY="$OPTARG";;
+ R) PARAM_RESOURCEDIRECTORY="$OPTARG";;
+ --) break;;
+ \?) cmd_error="$(gettext 'Error: Error parsing Commandline')"; break;;
+ esac
+done
+
+[ -n "$cmd_error" ] && usage
+
+[ -d "${PARAM_CONFIGDIRECTORY}/${PARAM_REASON}" ] || exit 0
+
+hooks="$(find "${PARAM_CONFIGDIRECTORY}/${PARAM_REASON}" -maxdepth 1 -xtype f -name '[0-9][0-9]*' | sort)"
+for hook in ${hooks}; do
+ if [ -x $hook ]; then
+ $hook $PARAM_ORGIN $PARAM_VALUE "$PARAM_CONFIGDIRECTORY" "$PARAM_CACHEDIRECTORY" "$PARAM_RESOURCEDIRECTORY"
+ else
+ /bin/sh $hook $PARAM_ORGIN $PARAM_VALUE "$PARAM_CONFIGDIRECTORY" "$PARAM_CACHEDIRECTORY" "$PARAM_RESOURCEDIRECTORY"
+ fi
+ [ $? -ne 0 ] && ${LOG} "error when executing ${hook}"
+done
exit 0