From 428bc2f4a28fca7cf7d81dad709c06f5023daeda Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 5 Jun 2023 13:52:56 +0200 Subject: [PATCH] system: propagate error in rc.syshook scripts #6594 We could stop on first problem but that woul likely break a number of setups that use boot early/start hooks with sloppy coding. Instead make the full run as an error and report it at the end. --- src/etc/rc.halt | 1 + src/etc/rc.syshook | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/etc/rc.halt b/src/etc/rc.halt index 68fef391f..d8e65d4a8 100755 --- a/src/etc/rc.halt +++ b/src/etc/rc.halt @@ -1,5 +1,6 @@ #!/bin/sh +# shutdown syshook / plugin scripts /usr/local/etc/rc.syshook stop /sbin/shutdown -op now diff --git a/src/etc/rc.syshook b/src/etc/rc.syshook index e705ac415..fd9ce7aea 100755 --- a/src/etc/rc.syshook +++ b/src/etc/rc.syshook @@ -59,6 +59,7 @@ if [ ! -d ${SYSDIR}/${SYSLEVEL} ]; then fi SYSHOOKS="$(find -s ${SYSDIR}/${SYSLEVEL} -type f})" +RETURN=0 for _SYSHOOK in ${SYSHOOKS}; do SYSHOOK=${_SYSHOOK##"${SYSDIR}/"} @@ -69,7 +70,8 @@ for _SYSHOOK in ${SYSHOOKS}; do if ! ${_SYSHOOK} "${@}"; then echo ">>> Error in ${SYSLEVEL} script '${SYSNAME}'" + RETURN=1 fi done -exit 0 +exit ${RETURN}