find user's home directory via getent(1)

This commit is contained in:
Jérémy Lecour 2019-03-23 01:10:29 +01:00
parent 48cbf6385f
commit 3598154e4a

View file

@ -1369,8 +1369,8 @@ if [ "$IS_EVOMAINTENANCEUSERS" = 1 ]; then
users=$({ grep "^User_Alias *ADMIN" $sudoers | cut -d= -f2 | tr -d " "; grep "^sudo" /etc/group | cut -d: -f 4; } | tr "," "\n" | sort -u)
fi
for user in $users; do
# shellcheck disable=SC2086
if ! grep -qs "^trap.*sudo.*evomaintenance.sh" ~${user}/.*profile; then
user_home=$(getent passwd "$user" | cut -d: -f6)
if ! grep -qs "^trap.*sudo.*evomaintenance.sh" "${user_home}"/.*profile; then
failed "IS_EVOMAINTENANCEUSERS" "${user} doesn't have an evomaintenance trap"
## let's print an error for each user
# break