summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorRyota MIBU <r-mibu@cq.jp.nec.com>2016-08-11 07:11:32 +0900
committerRyota MIBU <r-mibu@cq.jp.nec.com>2016-08-11 07:11:32 +0900
commit8958c08a0309b22a58d7559217516f13a26e2036 (patch)
tree1132dbfabec98fdad6e5eb5a1c11aa0405889cbc /utils
parent41c309ff3d87b4916b6b9f2328309630780a6452 (diff)
fix requiretty check, use 'sudo -l'
A normal user doesn't have a right to read /etc/sudoers, so current script won't work if executed by non-root users. This patch replacing the check by geeting config from 'sudo -l' command. Change-Id: I608edabb73761cea0f6199045f1cde2217a34bf3 Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
Diffstat (limited to 'utils')
-rwxr-xr-xutils/jenkins-jnlp-connect.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh
index d268a28de..8dcaf35c5 100755
--- a/utils/jenkins-jnlp-connect.sh
+++ b/utils/jenkins-jnlp-connect.sh
@@ -49,8 +49,8 @@ main () {
fi
if [[ $(whoami) != "root" ]]; then
- if grep "^Defaults requiretty" /etc/sudoers
- then echo "please comment out Defaults requiretty from /etc/sudoers"
+ if sudo -l | grep "requiretty"; then
+ echo "please comment out Defaults requiretty from /etc/sudoers"
exit 1
fi
fi