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.
This commit is contained in:
Franco Fichtner 2023-06-05 13:52:56 +02:00
parent 72cae559d7
commit 428bc2f4a2
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,6 @@
#!/bin/sh
# shutdown syshook / plugin scripts
/usr/local/etc/rc.syshook stop
/sbin/shutdown -op now

View File

@ -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}