You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
401 B

  1. #!/bin/sh
  2. # Copyright (C) 2016 OpenWrt.org
  3. # Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
  4. [ "$SUBSYSTEM" = "virtio-ports" ] || exit 0
  5. syspath="/sys/$DEVPATH"
  6. name="$(cat "$syspath/name" 2>/dev/null)"
  7. [ -n "$name" ] || exit 0
  8. case "$ACTION" in
  9. "add")
  10. mkdir -p /dev/virtio-ports
  11. ln -s "/dev/$DEVNAME" "/dev/virtio-ports/$name"
  12. ;;
  13. "del")
  14. rm -f "/dev/virtio-ports/$name"
  15. ;;
  16. esac