Created
October 5, 2021 12:50
-
-
Save atotto/1589cba7f11dfb3fae54a9499aecd330 to your computer and use it in GitHub Desktop.
generate plantuml text from fstab with systemd mount config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# usage | |
# cd /etc/; fstab2uml | |
grep -v -e '^\s*#' -e '^\s*$' fstab | sed -r 's|(^[^ ]+) *([^ ]*) .*|database "\2" <<\1>>|g' | |
grep -v -e '^\s*#' -e '^\s*$' fstab | grep x-systemd | tr -s ' ' | cut -d ' ' -f 1,2 | xargs -n 1 -I {} bash -c 'grep ^$(echo {}| cut -d " " -f 1) fstab | tr "," "\n" | tr " " "\n" | grep "x-systemd\." | sed -r "s|x-systemd\.(.*)=(.*)|[\2]: \1|" | xargs -n 1 -I [] echo "[$(echo {} | cut -d " " -f 2)] -up-> []"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment