secure_path in sudoers: deal with possible quotes

Sometimes the secure_path option value in /etc/sudoers is surrounded by
quotes, in this case the current command creates an invalid entry and
it's not possible to sudo anymore.
This fix adjust the sed command to deal with possible quotes

Change-Id: Ifd6f9e29b3c0d04d6f65d3f55524ad202fb3294e
This commit is contained in:
Gabriele Cerami 2016-08-03 15:03:14 +02:00
parent e49d347ba9
commit 5e957f6350

View file

@ -6,5 +6,5 @@ fi
set -eu
set -o pipefail
sed -i '/secure_path/ s/$/:\/usr\/local\/bin/' /etc/sudoers
sed -i -e "/secure_path/ s@\([\'\"]\?\)\$@:/usr/local/bin/\1@" /etc/sudoers
visudo -c