File: hotplug

package info (click to toggle)
nut 2.7.4-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,964 kB
  • sloc: ansic: 70,278; sh: 12,814; python: 2,202; cpp: 1,715; makefile: 1,406; perl: 705; xml: 40
file content (24 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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