1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2017 Rodolfo Giometti <giometti@enneenne.com>
4 # Based on Debian's script /etc/init.d/sysfsutils by
5 # Martin Pitt <mpitt@debian.org>
11 sed 's/#.*$//; /^[[:space:]]*$/d;
12 s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1 \2 \3/' \
14 while read f1 f2 f3
; do
15 if [ "$f1" = "mode" -a -n "$f2" -a -n "$f3" ]; then
16 if [ -f "/sys/$f2" ] ||
[ -d "/sys/$f2" ]; then
17 chmod "$f3" "/sys/$f2"
19 echo "unknown attribute $f2"
21 elif [ "$f1" = "owner" -a -n "$f2" -a -n "$f3" ]; then
22 if [ -f "/sys/$f2" ]; then
23 chown
"$f3" "/sys/$f2"
25 echo "unknown attribute $f2"
27 elif [ "$f1" -a -n "$f2" -a -z "$f3" ]; then
28 if [ -f "/sys/$f1" ]; then
29 # Some fields need a terminating newline, others
30 # need the terminating newline to be absent :-(
31 echo -n "$f2" > "/sys/$f1" 2>/dev
/null ||
32 echo "$f2" > "/sys/$f1"
34 echo "unknown attribute $f1"
37 echo "syntax error in $CONFFILE: '$f1' '$f2' '$f3'"
45 for file in /etc
/sysfs.conf
/etc
/sysfs.d
/*.conf
; do
46 [ -r "$file" ] ||
continue