vblade-generator 750 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. set -eu
  3. SERVICEFILE="/lib/systemd/system/vblade@.service"
  4. WANTDIR="$1/vblade.service.wants"
  5. CONFIG_DIR=/etc/vblade.conf.d/
  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/vblade@$INSTANCE.service"
  13. sh -n "$CONFIG_DIR$CONFIG" 2>/dev/null || continue
  14. shelf=
  15. slot=
  16. netif=
  17. filename=
  18. options=
  19. . "$CONFIG_DIR$CONFIG"
  20. [ "$netif" ] || continue
  21. [ "$shelf" ] || continue
  22. [ "$slot" ] || continue
  23. [ "$filename" ] || continue
  24. ln -s "$SERVICEFILE" "$LINK"
  25. done
  26. fi
  27. exit 0