--- /etc/init.d/sysfsutils.orig 2018-03-07 13:38:03.508635003 +0000 +++ /etc/init.d/sysfsutils 2018-03-07 13:45:18.011247443 +0000 @@ -13,34 +13,46 @@ # defaults) and /sys file permissions in /etc/sysfs.conf. ### END INIT INFO -# /etc/init.d/sysfsutils: +# /etc/init.d/sysfsutils: # # (c) 2005 Martin Pitt +# (c) 2005 Marc Schoechlin + CONFFILE=/etc/sysfs.conf CONFDIR=/etc/sysfs.d +EXITCODE=0 + [ -r "$CONFFILE" -o -d "$CONFDIR" ] || exit 0 . /lib/lsb/init-functions load_conffile() { FILE="$1" - sed 's/#.*$//; /^[[:space:]]*$/d; + sed 's/#.*$//; /^[[:space:]]*$/d; s/^[[:space:]]*\([^=[:space:]]*\)[[:space:]]*\([^=[:space:]]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1 \2 \3/' \ $FILE | { while read f1 f2 f3; do if [ "$f1" = "mode" -a -n "$f2" -a -n "$f3" ]; then if [ -f "/sys/$f2" ] || [ -d "/sys/$f2" ]; then chmod "$f3" "/sys/$f2" + if [ "$?" != "0" ];then + EXITCODE=1 + fi else log_failure_msg "unknown attribute $f2" + EXITCODE=1 fi elif [ "$f1" = "owner" -a -n "$f2" -a -n "$f3" ]; then if [ -f "/sys/$f2" ]; then chown "$f3" "/sys/$f2" + if [ "$?" != "0" ];then + EXITCODE=1 + fi else log_failure_msg "unknown attribute $f2" + EXITCODE=1 fi elif [ "$f1" -a -n "$f2" -a -z "$f3" ]; then if [ -f "/sys/$f1" ]; then @@ -48,8 +60,12 @@ # need the terminating newline to be absent :-( echo -n "$f2" > "/sys/$f1" 2>/dev/null || echo "$f2" > "/sys/$f1" + if [ "$?" != "0" ];then + EXITCODE=1 + fi else log_failure_msg "unknown attribute $f1" + EXITCODE=1 fi else log_failure_msg "syntax error in $CONFFILE: '$f1' '$f2' '$f3'" @@ -68,8 +84,7 @@ [ -r "$file" ] || continue load_conffile "$file" done - - log_end_msg 0 + log_end_msg $EXITCODE ;; stop) ;; @@ -79,4 +94,3 @@ ;; esac -