File: logger.agent

package info (click to toggle)
udev 0.105-4etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 672 kB
  • ctags: 54
  • sloc: sh: 1,636; makefile: 273
file content (32 lines) | stat: -rw-r--r-- 614 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
25
26
27
28
29
30
31
32
#!/bin/sh -e
#
# log the event to a file
#

cd /lib/udev/
. ./hotplug.functions

# provide env-like output when the real thing is not available
if [ ! -x /usr/bin/env ]; then
    env() {
        # bash prepends "declare -x " at the beginning of each line
        export -p | sed -e 's/^\(declare -x\|export\) //'
    }
fi

# writes a copy of the current hotplug event to stdout
log_to_stdout()
{
    {
	echo "HOTPLUG_TIME='$(date)'"
	env
	echo ''
    } | egrep -v "^'$|^(_|PATH|PWD|PPID|SHLVL|HOME|IFS|OPTIND|PS[1234])="
}

[ "$EVENTS_LOG" ] || EVENTS_LOG='/dev/hotplug.log'

log_to_stdout >> $EVENTS_LOG

exit 0