File: weborf-generator

package info (click to toggle)
weborf 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,152 kB
  • sloc: sh: 5,272; ansic: 3,505; python: 762; makefile: 119; xml: 44
file content (24 lines) | stat: -rwxr-xr-x 657 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# This systemd generator creates dependency symlinks that make all weborf
# instances with start=auto configuration file be started/stopped/reloaded
# when weborf.service is started/stopped/reloaded.

set -eu

gendir="$1"
wantdir="$1/weborf.service.wants"
instance="/usr/lib/systemd/system/weborf@.service"

mkdir -p "$wantdir"

for conf in /etc/weborf.d/*.conf; do
	# abort loop if glob was not expanded (but accept dead symlinks)
	if ! test -e "$conf" && ! test -L "$conf"; then continue; fi

	if ! grep "^start=auto$" < $conf > /dev/null; then
            continue
	fi
	ln -s "$instance" "$wantdir/weborf@`basename $conf`.service"
done

exit 0