1
0

softflowd-generator 601 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. set -eu
  3. service_file="/lib/systemd/system/softflowd@.service"
  4. want_dir="$1/softflowd.service.wants"
  5. config_dir=/etc/softflowd/
  6. if [ -d "$config_dir" ]; then
  7. mkdir -p "$want_dir"
  8. cd "$config_dir"
  9. for config in *.conf; do
  10. [ -f "$config" ] || continue
  11. instance="$(systemd-escape "${config%%.conf}")"
  12. link="$want_dir/softflowd@$instance.service"
  13. sh -n "$config_dir$config" 2>/dev/null || continue
  14. interface=
  15. . "$config_dir$config"
  16. [ "$interface" ] || continue
  17. ln -s "$service_file" "$link"
  18. done
  19. fi
  20. exit 0