git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/aux/git-checkers/sudoerschecker
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/sudoerschecker
downloadfedora-laptop-0632591996893fe136a1f2fe44d9b9f404f41f3e.tar.bz2
Initial commit
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 '{}' \;