File: softflowd-generator

package info (click to toggle)
softflowd 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 612 kB
  • sloc: ansic: 5,624; sh: 197; perl: 196; makefile: 26
file content (30 lines) | stat: -rwxr-xr-x 601 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
25
26
27
28
29
30
#!/bin/sh

set -eu

service_file="/lib/systemd/system/softflowd@.service"
want_dir="$1/softflowd.service.wants"

config_dir=/etc/softflowd/

if [ -d "$config_dir" ]; then
    mkdir -p "$want_dir"
    cd "$config_dir"
    for config in *.conf; do
        [ -f "$config" ] || continue
        instance="$(systemd-escape "${config%%.conf}")"
        link="$want_dir/softflowd@$instance.service"

        sh -n "$config_dir$config" 2>/dev/null || continue

        interface=

        . "$config_dir$config"

        [ "$interface" ] || continue

        ln -s "$service_file" "$link"
    done
fi

exit 0