Index: src/libexec/rc/rc.d/dumpon =================================================================== --- src/libexec/rc/rc.d/dumpon (revision 368353) +++ src/libexec/rc/rc.d/dumpon (working copy) @@ -35,6 +35,50 @@ dumpon_start() { + local n=6 camlist=`camcontrol devlist -v` + + # Wait for cam(4) devices attaching, 6 times at max by increasing + # 1s each (21s max in total) + # With root-MFS, it's likely that root_hold_wait() shortcuts + # before cam(4) probing finishes. In that case, we have /, but + # probably not /usr, so we don't utilize grep(1) e.g. + # Run unconditionally of dumpdev_enable setting, + # rcorder(8) dictates to do the delay at this place. + # + + while [ -n "${camlist}" ]; do + + echo "${camlist}" | while read line; do + # Skip line without "target 0 lun 0" pattern + [ X"${line}" != \ + X"${line#*target [[:xdigit:]]* lun [[:xdigit:]]*}" ] \ + || continue + + # If prefilterd line doesn't end with () or probe), we + # continue checking next line + [ X"${line% ()}" == X"${line}" ] && + [ X"${line%[apr][pro][rob][obe][be0-9][e0-9])}"\ + == X"${line}" ] && + continue + + return $n # no need to check remaining lines + done + camlist=$? # recycle to be refreshed camlist variable + + # $camlist is 0 if every line was no match obove, so simply + # break before delaying rc(8), since cam seems to be ready. + [ $camlist -gt 0 -a $camlist -le 6 ] || break + + # Initialize counter once only + [ $camlist -eq 6 ] && n=0 + + sleep $((n+=1)) + [ $n -lt 6 ] || break + camlist=`camcontrol devlist -v` + + done + + # Enable dumpdev so that savecore can see it. Enable it # early so a crash early in the boot process can be caught. #