mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
A small helper to draw a graph with dot(1) and show it with display(1): bash tools/hotplug/Linux/systemd/show_service_dependencies.sh \ tools/hotplug/Linux/systemd/*.in A red line means Requires= aka "enable it" A blue line means After= A green line means Before= Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Wei Liu <wei.liu2@citrix.com>
32 lines
731 B
Bash
32 lines
731 B
Bash
#!/bin/bash
|
|
# dot(1) from graphviz, display(1) from ImageMagick
|
|
# Usage: bash $0 tools/hotplug/Linux/systemd/*.in
|
|
(
|
|
echo " digraph systemd {"
|
|
for file in "$@"
|
|
do
|
|
if test -f "$file"
|
|
then
|
|
unit=${file##*/}
|
|
unit=${unit%.in}
|
|
requires="`grep ^Requires= $file | cut -f 2- -d =`"
|
|
before="`grep ^Before= $file | cut -f 2- -d =`"
|
|
after="`grep ^After= $file | cut -f 2- -d =`"
|
|
echo "\"$unit\" [fillcolor=lightgray color=black fontcolor=black style=filled];"
|
|
for i in $requires
|
|
do
|
|
echo "\"$i\" -> \"$unit\" [color=red];"
|
|
done
|
|
for i in $after
|
|
do
|
|
echo "\"$i\" -> \"$unit\" [color=blue];"
|
|
done
|
|
for i in $before
|
|
do
|
|
echo "\"$unit\" -> \"$i\" [color=green];"
|
|
done
|
|
fi
|
|
done
|
|
echo "}"
|
|
) | dot -Tpng | display -
|