git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/aux/git-checkers/sudoerschecker
diff options
context:
space:
mode:
Diffstat (limited to 'aux/git-checkers/sudoerschecker')
-rwxr-xr-xaux/git-checkers/sudoerschecker9
1 files changed, 9 insertions, 0 deletions
diff --git a/aux/git-checkers/sudoerschecker b/aux/git-checkers/sudoerschecker
new file mode 100755
index 0000000..1d7e7ed
--- /dev/null
+++ b/aux/git-checkers/sudoerschecker
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+GITROOT="$(git rev-parse --show-toplevel)"||exit 1
+SUDOERSDINV=( $(find "$GITROOT" -name sudoers.d -type d) )
+SUDOERSD=1
+[ "${#SUDOERSDINV[@]}" -eq 0 ]&&echo "No directory called sudoers.d found."&&SUDOERSD=0
+
+[ "$SUDOERSD" -eq 1 ]&&for i in "${SUDOERSDINV[@]}"/*;do /usr/sbin/visudo -cf "$i";done
+find "$GITROOT" -name sudoers -type f -exec /usr/sbin/visudo -cf '{}' \;