Skip to content

Instantly share code, notes, and snippets.

@atotto
Created October 5, 2021 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atotto/1589cba7f11dfb3fae54a9499aecd330 to your computer and use it in GitHub Desktop.
Save atotto/1589cba7f11dfb3fae54a9499aecd330 to your computer and use it in GitHub Desktop.
generate plantuml text from fstab with systemd mount config
#!/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