1#!/bin/bash 2# dot(1) from graphviz, display(1) from ImageMagick 3# Usage: bash $0 tools/hotplug/Linux/systemd/*.in 4( 5echo " digraph systemd {" 6for file in "$@" 7do 8 if test -f "$file" 9 then 10 unit=${file##*/} 11 unit=${unit%.in} 12 requires="`grep ^Requires= $file | cut -f 2- -d =`" 13 before="`grep ^Before= $file | cut -f 2- -d =`" 14 after="`grep ^After= $file | cut -f 2- -d =`" 15 echo "\"$unit\" [fillcolor=lightgray color=black fontcolor=black style=filled];" 16 for i in $requires 17 do 18 echo "\"$i\" -> \"$unit\" [color=red];" 19 done 20 for i in $after 21 do 22 echo "\"$i\" -> \"$unit\" [color=blue];" 23 done 24 for i in $before 25 do 26 echo "\"$unit\" -> \"$i\" [color=green];" 27 done 28 fi 29done 30echo "}" 31) | dot -Tpng | display - 32