git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/aux/git-checkers/systemdchecker
blob: 85cb24ebf3553033516089b71325e6b6c899983d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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