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.

21 lines
434 B

  1. #!/bin/sh
  2. nut_serial() {
  3. local cfg="$cfg"
  4. config_get runas upsd runas "nut"
  5. config_get_bool enable_usb_serial "$cfg" enable_usb_serial 0
  6. }
  7. [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -z "${DEVNAME%ttyUSB*}" ] && {
  8. config load nut_server
  9. config_foreach nut_serial driver
  10. [ -z "$RUNAS" ] && {
  11. RUNAS="$runas"
  12. }
  13. [ "$enable_usb_serial" -eq 1 ] && {
  14. chown "${RUNAS:-nut}" /dev/$DEVNAME
  15. chmod g+rw /dev/$DEVNAME
  16. }
  17. }