#!/bin/sh LF=$(printf '\nX') LF=${LF%X} IFS=${LF} if [ -r /etc/defaults/rc.conf ]; then . /etc/defaults/rc.conf source_rc_confs elif [ -r /etc/rc.conf ]; then . /etc/rc.conf fi set -eu sysf=$(ls -1 /etc/rc.d/*) locf=$(ls -1 "$local_startup"/*) badrc= for i in $locf ; do if rcorder 2>&1 $sysf $i | grep -qi circular ; then badrc="$badrc${badrc:+" "}$i" fi done if test "$badrc" ; then echo "RC files introducting cycles:" printf '%s\n' "$badrc" exit 1 fi echo "No RC files introduce cycles by themselves. Trying full rcorder:" rcorder $sysf $locf >/dev/null echo "Done."