From 0ae4224784474d6f09cee870116b0ab54800bf73 Mon Sep 17 00:00:00 2001 From: Erik Alexandre Pucci <eap08@c3sl.ufpr.br> Date: Fri, 16 Sep 2011 18:29:55 -0300 Subject: [PATCH] bootstrap-install: Changed installer to remove old seed_mec sudoers(1) rule Instead of doing nothing, remove the old rule and add the new one to sudoers(1) file. This modification corrects an error which the previous agent version caused in outdated systems (e.g. LE 3, Ubuntu 8), making the sudoers(1) file unreadable. Signed-off-by: Erik Alexandre Pucci <eap08@c3sl.ufpr.br> Acked-by: Adriano da Luz <al08@c3sl.ufpr.br> Acked-by: Bruno Ribas <ribas@c3sl.ufpr.br> --- bootstraps/bootstrap-install | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bootstraps/bootstrap-install b/bootstraps/bootstrap-install index 029c2f7..78599a6 100644 --- a/bootstraps/bootstrap-install +++ b/bootstraps/bootstrap-install @@ -193,14 +193,18 @@ crontab -u seed_mec -r if ! test -n "${PROJECTOR}" -o -f "/usr/sbin/projetor" -o \ -f "/etc/cmpc-release" -o -n "${UCA_SERVER}" -o \ -n "${UCA_CLASSMATE}"; then + # Remove any possible line containing a rule for seed_mec user before adding + # root permissions in the sudoers file + TMPFILE=$(mktemp) + sed '/^seed_mec[\t ]*ALL=(ALL/d' /etc/sudoers > "${TMPFILE}" + mv "${TMPFILE}" /etc/sudoers + chmod 440 /etc/sudoers # Add root permissions to seed_mec user, without the need of password - if ! grep -q "seed_mec" /etc/sudoers; then - if ! $(echo -e "seed_mec\tALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers) - then - printf "ERRO: Falha ao adicionar permissões de super-usuário %b" \ - "ao usuário seed_mec.\n" - exit 3 - fi + if ! $(echo -e "seed_mec\tALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers) + then + printf "ERRO: Falha ao adicionar permissões de super-usuário %b" \ + "ao usuário seed_mec.\n" + exit 3 fi fi -- GitLab