#!/bin/bash

. ${TOOLKIT}-functions.sh

eval `grep 'APACHE_RUN_USER=' /etc/apache2/envvars`

# sudo entry for running validator helper
#
sudofile="/etc/sudoers"
command="/usr/sbin/validateuser"

grep -q "^$APACHE_RUN_USER[ ,	].*$command" $sudofile || {
	echo "  patching $sudofile for validator helper"
	echo "" >>$sudofile
	echo "#[ku] added by kusa on `date`" >>$sudofile
	echo "$APACHE_RUN_USER	ALL=NOPASSWD: $command" >>$sudofile
}

$SOMETHING_CHANGED && {
	restart_service apache2
}

exit 0
