summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xbin/container28
-rwxr-xr-xshare/hooks/notification-irc35
2 files changed, 35 insertions, 28 deletions
diff --git a/bin/container b/bin/container
index 0a6b7e3..37c87a3 100755
--- a/bin/container
+++ b/bin/container
@@ -57,34 +57,6 @@ do
fi
done
-# Notification
-if echo "${OPTIONS}" | grep -qs "\--no-notification"
-then
- OPTIONS="$(echo "${OPTIONS}" | sed -e 's|--no-notification||')"
-else
- case "${COMMAND}" in
- create|remove|rm|restart|start|stop)
- USER="${SUDO_USER:-${USER}}"
- DATE="$(date +%Y-%m-%d\ %H:%M:%S)"
- HOST="$(hostname -f)"
-
- # irc
- if [ -e /usr/bin/irk ] && [ -e "/etc/default/${SOFTWARE}" ]
- then
- . /etc/default/${SOFTWARE}
-
- if [ -n "${IRK_TARGETS}" ]
- then
- for TARGET in ${IRK_TARGETS}
- do
- irk ${TARGET} "\x0300${USER}\x03@\x0312${HOST}:\x03 \x0303${PROGRAM}\x03 \x0307${COMMAND}\x03 ${OPTIONS}"
- done
- fi
- fi
- ;;
- esac
-fi
-
# Run
exec "/usr/lib/${SOFTWARE}/${PROGRAM}/${COMMAND}" "${OPTIONS}"
diff --git a/share/hooks/notification-irc b/share/hooks/notification-irc
new file mode 100755
index 0000000..1b4b620
--- /dev/null
+++ b/share/hooks/notification-irc
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+CONFFILE="${0}.conf"
+
+if echo "${OPTIONS}" | grep -qs "\--no-notification"
+then
+ exit 0
+fi
+
+if [ ! -e /usr/bin/irk ] || [ ! -r "${CONFFILE}" ]
+then
+ exit 0
+fi
+
+. "${CONFFILE}"
+
+if [ -z "${IRC_CHANNELS}" ]
+then
+ exit 0
+fi
+
+case "${COMMAND}" in
+ create|remove|rm|restart|start|stop)
+ DATE="$(date +%Y-%m-%d\ %H:%M:%S)"
+ HOST="$(hostname -f)"
+ USER="${SUDO_USER:-${USER}}"
+
+ for CHANNEL in ${IRC_CHANNELS}
+ do
+ irk ${CHANNEL} "\x0300${USER}\x03@\x0312${HOST}:\x03 \x0303${PROGRAM}\x03 \x0307${COMMAND}\x03 ${OPTIONS}"
+ done
+ ;;
+esac