nut-debian/debian/hotplug
2010-03-26 00:21:03 +01:00

25 lines
490 B
Bash

#!/bin/bash
# taken from libgphoto2
GROUP=nut
# for previous udev versions
if [ "$ACTION" = "add" ] && [ -f "$DEVICE" ]
then
# check if $GROUP really exists
if getent group $GROUP > /dev/null; then
chmod 660 "$DEVICE"
chown root:$GROUP "$DEVICE"
fi
fi
# for recent udev versions
if [ "$ACTION" = "add" ] && [ -r "$DEVNAME" ]
then
# check if $GROUP really exists
if getent group $GROUP > /dev/null; then
chmod 660 "$DEVNAME"
chown root:$GROUP "$DEVNAME"
fi
fi