check for AWS environment before running sudo
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
		| @@ -207,6 +207,8 @@ else | ||||
|   # Refresh sudo credentials if needed | ||||
|   if ping -c 1 -q metadata.google.internal &> /dev/null; then | ||||
|     echo 'Running on GCE, not asking for sudo credentials' | ||||
|   elif ping -c 1 -q 169.254.169.254 &> /dev/null; then | ||||
|     echo 'Running on AWS, not asking for sudo credentials' | ||||
|   elif sudo --non-interactive "$(which bash)" -c true 2> /dev/null; then | ||||
|     # if we can run bash without a password, it's a pretty safe bet that either | ||||
|     # we can run any command without a password, or that sudo credentials | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Davanum Srinivas
					Davanum Srinivas