2 # $NetBSD: rcorder-visualize.sh,v 1.5 2009/08/09 17:08:53 apb Exp $
4 # Written by Joerg Sonnenberger. You may freely use and redistribute
7 # Simple script to show the dependency graph for rc scripts.
8 # Output is in the dot(1) language and can be rendered using
9 # sh rcorder-visualize | dot -T svg -o rcorder.svg
10 # dot(1) can be found in graphics/graphviz in pkgsrc.
12 rc_files
=${*:-/etc/rc.d/*}
16 for f
in $rc_files; do
18 /# PROVIDE: / { provide = $3 }
19 /# REQUIRE: / { for (i = 3; i <= NF; i++) requires[$i] = $i }
20 /# BEFORE: / { for (i = 3; i <= NF; i++) befores[$i] = $i }
23 print " \"" provide "\";"
24 for (x in requires) print " \"" provide "\"->\"" x "\";"
25 for (x in befores) print " \"" x "\"->\"" provide "\";"