]> git.madduck.net Git - code/molly-guard.git/blob - run.d/10-print-message

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

rework the scripts given andrew's patch
[code/molly-guard.git] / run.d / 10-print-message
1 #!/bin/sh
2 #
3 # 10-print-message - print a (command-specific or default) message
4 #
5 # Copyright © Andrew Ruthven <andrew@etc.gen.nz>
6 # Copyright © martin f. krafft <madduck@madduck.net>
7 # Released under the terms of the Artistic Licence 2.0
8 #
9 # Prints either /etc/molly-guard/messages.d/$MOLLYGUARD_CMD
10 #            or /etc/molly-guard/messages.d/default
11 # depending on whether the first exists.
12 #
13 set -eu
14
15 MESSAGESDIR=/etc/molly-guard/messages.d
16
17 for i in $MOLLYGUARD_CMD default; do
18   if [ -f "$MESSAGESDIR/$i" ] && [ -r "$MESSAGESDIR/$i" ]; then
19     cat $MESSAGESDIR/$i
20     exit 0
21   fi
22 done