File: hotplug-netmd

package info (click to toggle)
linux-minidisc 0.9.13-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,096 kB
  • ctags: 1,530
  • sloc: ansic: 6,345; cpp: 2,569; python: 2,451; perl: 866; sh: 22; makefile: 8
file content (22 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

# hack: wait 1 second to improve chance that /proc/bus/usb file is present during add
sleep 1

# handle add event
if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
	logger -t netmd NetMD plugged in at $DEVICE
	chown root.usb $DEVICE
	chmod ug+w $DEVICE

	# create symbolic link to catch remove event
        mkdir -p `dirname $REMOVER`
        ln -s $0 $REMOVER	
fi

# handle remove event
if [ "${ACTION}" = "remove" ]
then
	logger -t netmd NetMD unplugged from $DEVICE
fi