diff options
author | Christian Pointner <equinox@anytun.org> | 2016-07-08 04:03:37 +0200 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2016-07-08 04:03:37 +0200 |
commit | b9aa07cbcf584a2d5bc9f9f2bd74cca2057e0494 (patch) | |
tree | a90d25b462437a484d502841f45dc36ded44997e /usr/lib | |
parent | fixed requires= wants= and also= (diff) |
added systemd generator
Diffstat (limited to 'usr/lib')
-rwxr-xr-x | usr/lib/systemd/system-generator/anytun-generator | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/usr/lib/systemd/system-generator/anytun-generator b/usr/lib/systemd/system-generator/anytun-generator new file mode 100755 index 0000000..8e04ba9 --- /dev/null +++ b/usr/lib/systemd/system-generator/anytun-generator @@ -0,0 +1,23 @@ +#!/bin/sh + +# This systemd generator creates dependency symlinks that make all anytun +# tunnels listed in /etc/anytun/autostart be started/stopped/reloaded +# when anytun.service is started/stopped/reloaded. + +set -eu + +GENDIR="$1" +WANTDIR="$1/anytun.service.wants" +SERVICEFILE="/lib/systemd/system/anytun@.service" +AUTOSTART="all" +CONFIG_DIR=/usr/local/etc/anytun + +mkdir -p "$WANTDIR" + +if [ -f $CONFIG_DIR/autostart ] ; then + for NAME in `sed 's/#.*//' < $CONFIG_DIR/autostart | grep -e '\w'`; do + ln -s "$SERVICEFILE" "$WANTDIR/anytun@$NAME.service" + done +fi + +exit 0 |