Skip to content

Commit

Permalink
bootstrap: show logs when sudoers_add_users fails
Browse files Browse the repository at this point in the history
  • Loading branch information
davidandreoletti committed Mar 13, 2024
1 parent eacf730 commit 261392f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions install/common/shell/sudoers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ function sudoers_add_user() {
local stderr_file="/tmp/bootstrap.$$.sudoers.log"

if sudo visudo -c 1>${stderr_file} 2>&1; then
:
else
if grep "bad permission" "${stderr_file}"; then
rm -fv "$stderr_file"
else
cat "$stderr_file"
exit 1
fi
fi
Expand All @@ -20,9 +23,12 @@ function sudoers_add_user() {
sudo sed -i.bak -e "$pattern" "$sudoersFile"

if sudo visudo -c 1>${stderr_file} 2>&1; then
:
else
if grep "bad permission" "${stderr_file}"; then
rm -fv "$stderr_file"
else
cat "$stderr_file"
exit 1
fi
fi
Expand Down

0 comments on commit 261392f

Please sign in to comment.