Skip to content

Commit 03b1f2b

Browse files
bjh7242TravisEz13
authored andcommitted
tools: fix comparison to see if sudo test is needed in install-*.sh (#6771)
The comparison to test if we were using sudo was failing when running as root. We would then run -v, and get a bad error message. fixing the comparison.
1 parent 9ca059d commit 03b1f2b

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

tools/installpsh-debian.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ if (( $EUID != 0 )); then
9494
fi
9595

9696
#Check that sudo is available
97-
if [[ "$SUDO" -eq "sudo" && ! ("'$*'" =~ skip-sudo-check) ]]; then
97+
if [[ "$SUDO" == "sudo" && ! ("'$*'" =~ skip-sudo-check) ]]; then
9898

9999
$SUDO -v
100100
if [ $? -ne 0 ]; then

tools/installpsh-redhat.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#Switches
1515
# -includeide - the script is being run headless, do not perform actions that require response from the console
1616
# -interactivetests - requires a human user in front of the machine - loads a script into the ide to test with F5 to ensure the IDE can run scripts
17+
# -skip-sudo-check - skips the check that the user has permission to use sudo. This is required to run in the VSTS Hosted Linux Preview.
1718

1819
#gitrepo paths are overrideable to run from your own fork or branch for testing or private distribution
1920

@@ -96,7 +97,7 @@ if (( $EUID != 0 )); then
9697
fi
9798

9899
#Check that sudo is available
99-
if [[ "$SUDO" -ne "" ]]; then
100+
if [[ "$SUDO" == "sudo" && ! ("'$*'" =~ skip-sudo-check) ]]; then
100101

101102
$SUDO -v
102103
if [ $? -ne 0 ]; then

tools/installpsh-suse.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#Switches
1515
# -includeide - the script is being run headless, do not perform actions that require response from the console
1616
# -interactivetests - requires a human user in front of the machine - loads a script into the ide to test with F5 to ensure the IDE can run scripts
17+
# -skip-sudo-check - skips the check that the user has permission to use sudo. This is required to run in the VSTS Hosted Linux Preview.
1718

1819
#gitrepo paths are overrideable to run from your own fork or branch for testing or private distribution
1920

@@ -94,7 +95,7 @@ if (( $EUID != 0 )); then
9495
fi
9596

9697
#Check that sudo is available
97-
if [[ "$SUDO" -eq "sudo" ]]; then
98+
if [[ "$SUDO" == "sudo" && ! ("'$*'" =~ skip-sudo-check) ]]; then
9899

99100
$SUDO -v
100101
if [ $? -ne 0 ]; then

0 commit comments

Comments
 (0)