softflowd-generator 615 B

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