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>
9 sed 's/#.*$//; /^[[:space:]]*$/d;
10 s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1 \2 \3/' \
12 while read f1 f2 f3
; do
13 if [ "$f1" = "mode" -a -n "$f2" -a -n "$f3" ]; then
14 if [ -f "/sys/$f2" ] ||
[ -d "/sys/$f2" ]; then
15 chmod "$f3" "/sys/$f2"
17 echo "unknown attribute $f2"
19 elif [ "$f1" = "owner" -a -n "$f2" -a -n "$f3" ]; then
20 if [ -f "/sys/$f2" ]; then
21 chown
"$f3" "/sys/$f2"
23 echo "unknown attribute $f2"
25 elif [ "$f1" -a -n "$f2" -a -z "$f3" ]; then
26 if [ -f "/sys/$f1" ]; then
27 # Some fields need a terminating newline, others
28 # need the terminating newline to be absent :-(
29 echo -n "$f2" > "/sys/$f1" 2>/dev
/null ||
30 echo "$f2" > "/sys/$f1"
32 echo "unknown attribute $f1"
35 echo "syntax error in $CONFFILE: '$f1' '$f2' '$f3'"
44 for file in /etc
/sysfs.conf
/etc
/sysfs.d
/*.conf
; do
45 [ -r "$file" ] ||
continue