Module Name: src Committed By: joerg Date: Wed Apr 15 22:36:05 UTC 2009
Modified Files: src/etc/rc.d: Makefile Added Files: src/sbin/rcorder: rcorder-visualize.sh Log Message: Add a small script to visualize the rc dependency graph and point to it. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/etc/rc.d/Makefile cvs rdiff -u -r0 -r1.1 src/sbin/rcorder/rcorder-visualize.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/etc/rc.d/Makefile diff -u src/etc/rc.d/Makefile:1.75 src/etc/rc.d/Makefile:1.76 --- src/etc/rc.d/Makefile:1.75 Fri Jan 16 01:59:23 2009 +++ src/etc/rc.d/Makefile Wed Apr 15 22:36:04 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.75 2009/01/16 01:59:23 haad Exp $ +# $NetBSD: Makefile,v 1.76 2009/04/15 22:36:04 joerg Exp $ .include <bsd.own.mk> @@ -10,6 +10,8 @@ # src/etc/mtree/special # src/usr.sbin/postinstall/postinstall # +# You can find a script to visualize the dependency graph in +# src/sbin/rcorder. CONFIGFILES=\ DAEMON LOGIN NETWORKING SERVERS \ Added files: Index: src/sbin/rcorder/rcorder-visualize.sh diff -u /dev/null src/sbin/rcorder/rcorder-visualize.sh:1.1 --- /dev/null Wed Apr 15 22:36:05 2009 +++ src/sbin/rcorder/rcorder-visualize.sh Wed Apr 15 22:36:05 2009 @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Writte by Joerg Sonnenberger. You may freely use and redistribute +# this script. +# +# Simple script to show the dependency graph for rc scripts. +# Output is in the dot(1) language and can be rendered using +# sh rcorder-visualize | dot -T svg -o rcorder.svg +# dot(1) can be found in graphics/graphviz in pkgsrc. + +rc_files=/etc/rc.d/* + +{ +echo ' digraph {' +for f in $rc_files; do +< $f awk ' +/# PROVIDE: / { provide = $3 } +/# REQUIRE: / { for (i = 3; i <= NF; i++) requires[$i] = $i } +/# BEFORE: / { for (i = 3; i <= NF; i++) befores[$i] = $i } + +END { + print " \"" provide "\";" + for (x in requires) print " \"" provide "\"->\"" x "\";" + for (x in befores) print " \"" x "\"->\"" provide "\";" +} +' +done +echo '}' +} | dot -Tsvg