diff --git a/bootstraps/bootstrap-install b/bootstraps/bootstrap-install index 029c2f7e40ba1e6bf6f3813c60ddf23703e9db25..78599a64ec5e65bc56fb9e363ed02841f4ab15fc 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