#!/bin/sh

# This script changes the permissions and ownership of a USB device under
# /proc/bus/usb to grant access to this device to users in the nut group.
#
# Ownership is set to root.@RUN_AS_GROUP@, permissions are set to 0664.
#
# Arguments :
# -----------
# ACTION=[add|remove]
# DEVICE=/proc/bus/usb/BBB/DDD
# TYPE=usb

if [ "$ACTION" = "add" -a "$TYPE" = "usb" ]; then
  chown root:@RUN_AS_GROUP@ "$DEVICE"
  chmod 0664 "$DEVICE"
fi
