summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-04-10 09:53:40 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-04-10 09:53:40 +0000
commit607eafcd24573c2421f9a367d13810ae8e6ff121 (patch)
treeb32ed42af2f36420ea64152ffd7ef21c3dc9142c
parent51dfc6200e7601c0dca71d5537462afdd257b88e (diff)
Move astribank_hook from linux to tools. Install it by default
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@6344 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--xpp/Makefile2
-rwxr-xr-xxpp/astribank_hook42
2 files changed, 43 insertions, 1 deletions
diff --git a/xpp/Makefile b/xpp/Makefile
index c8084b8..e4a0337 100644
--- a/xpp/Makefile
+++ b/xpp/Makefile
@@ -81,7 +81,7 @@ install: all
$(INSTALL) -d $(DESTDIR)$(SBINDIR)
$(INSTALL) $(PROG_INSTALL) $(DESTDIR)$(SBINDIR)/
$(INSTALL) -d $(DESTDIR)$(DATADIR)
- $(INSTALL) xpp_fxloader $(DESTDIR)$(DATADIR)/
+ $(INSTALL) xpp_fxloader astribank_hook $(DESTDIR)$(DATADIR)/
$(INSTALL) waitfor_xpds $(DESTDIR)$(DATADIR)/
$(INSTALL) -d $(DESTDIR)$(MANDIR)
$(INSTALL_DATA) $(MAN_INSTALL) $(DESTDIR)$(MANDIR)/
diff --git a/xpp/astribank_hook b/xpp/astribank_hook
new file mode 100755
index 0000000..9510f7b
--- /dev/null
+++ b/xpp/astribank_hook
@@ -0,0 +1,42 @@
+#! /bin/sh
+
+me=`basename $0`
+dir=`dirname $0`
+LOGGER="logger -i -t '$me'"
+
+# Always redirect stderr somewhere, otherwise the shell script will die
+# when it tries to do I/O related stuff on closed file descriptor.
+# Our default is to throw it down the bit-bucket.
+#exec 2> /dev/console
+## If you wish to trace this script:
+#exec 2> "/tmp/${me}_$XBUS_NAME" 1>&2
+
+PATH="$dir:/usr/sbin:/sbin:/usr/bin:/bin"
+
+set -e
+
+echo "starting($ACTION): '$*'" | $LOGGER
+
+case "$ACTION" in
+add)
+ ;;
+remove)
+ ;;
+online)
+ if [ -x "$dir/twinstar_hook" ]; then
+ "$dir/twinstar_hook"
+ fi
+ ;;
+offline)
+ if [ -x "$dir/twinstar_hook" ]; then
+ "$dir/twinstar_hook"
+ fi
+ ;;
+*)
+ echo "$0: Unknown ACTION='$ACTION'" | $LOGGER
+ echo "$0: ARGS='$*'" | $LOGGER
+ echo "$0: ENV:" | $LOGGER
+ env | $LOGGER
+ exit 1
+esac
+