scripts/misc-scripts/s6-deptree.sh

20 lines
408 B
Bash
Executable File

#!/bin/sh
#set -ex
(
echo 'digraph G {'
echo 'edge[tailport=e]'
echo 'graph [layout=dot rankdir=LR splines=true ranksep=1]'
find "$1" -maxdepth 3 -type f \( \
-path '*/contents.d/*' -o \
-path '*/dependencies.d/*' \
\) -print | while read -r LINE; do
PARENT="$(echo "$LINE" | cut -d'/' -f2)"
CHILD="$(echo "$LINE" | cut -d'/' -f4)"
echo "\"$PARENT\" -> \"$CHILD\""
done
echo '}'
) > "$2"