git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/aux/git-checkers/systemdchecker
diff options
context:
space:
mode:
authorH. P. <harald.p.@xmart.de> 2018-11-01 13:30:58 +0100
committerH. P. <harald.p.@xmart.de> 2018-11-01 13:30:58 +0100
commit0632591996893fe136a1f2fe44d9b9f404f41f3e (patch)
tree7340edbe7c212da3db45a83219147143a3268c8d /aux/git-checkers/systemdchecker
downloadfedora-laptop-0632591996893fe136a1f2fe44d9b9f404f41f3e.tar.bz2
Initial commit
Diffstat (limited to 'aux/git-checkers/systemdchecker')
-rwxr-xr-xaux/git-checkers/systemdchecker17
1 files changed, 17 insertions, 0 deletions
diff --git a/aux/git-checkers/systemdchecker b/aux/git-checkers/systemdchecker
new file mode 100755
index 0000000..85cb24e
--- /dev/null
+++ b/aux/git-checkers/systemdchecker
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+GITROOT="$(git rev-parse --show-toplevel)"||exit 1
+
+echo -n "Locating systemd units..."
+SVCFILES=( $(find "$GITROOT" -name "*.service" -exec grep -l '\[Unit\]' '{}' \;) )
+TGTFILES=( $(find "$GITROOT" -name "*.target" -exec grep -l '\[Unit\]' '{}' \;) )
+TMRFILES=( $(find "$GITROOT" -name "*.timer" -exec grep -l '\[Unit\]' '{}' \;) )
+MNTFILES=( $(find "$GITROOT" -name "*.mount" -exec grep -l '\[Unit\]' '{}' \;) )
+SYSTEMDFILES=( ${SVCFILES[@]} ${TGTFILES[@]} ${TMRFILES[@]} ${MNTFILES[@]} )
+echo " found ${#SYSTEMDFILES[@]} unit$([ "${#SYSTEMDFILES[@]}" -gt 1 ]&&echo -n "s") to check."
+
+export LOOPRV=0
+for i in "${SYSTEMDFILES[@]}";do
+ systemd-analyze verify "$i"&&echo "$i: $(tput -Txterm smul)OK$(tput -Txterm rmul)"||((++LOOPRV))
+done
+exit $LOOPRV