#!/bin/bash
set -e
[ "$EUID" -eq 0 ] || { sudo "$0" "$@"; exit $?; }
SHARE_ROOTS=("$HOME/.local/share" "/usr/local/share" "/usr/share")
for SHARE_ROOT in "${SHARE_ROOTS[@]}"; do
	if [ -d "$SHARE_ROOT/sudo-nopasswd" ]; then
		SHARE_DIR="$SHARE_ROOT/sudo-nopasswd"
		break
	fi
done
CONSTANTS="sudo_no_passwd_constants.sh"
source "$SHARE_DIR/$CONSTANTS"
while [ 1 ]; do
	while ! inotifywait -e close_write "$ETC_FILE"; do
		"$UPDATE_COMMAND"
	done
done
