From 7afe8437d7b5d492d56a87c55be45c8fb5da09e7 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 13 Mar 2023 11:56:41 -0700 Subject: [PATCH] Fix mariner sudo detection (#19304) * Change the permissions on the symlink created for mariner * Update installpsh-mariner.sh * Update install-ps.yml * Update linux.yml * Update installpsh-mariner.sh --- .vsts-ci/install-ps.yml | 15 +++------------ .vsts-ci/linux.yml | 1 + tools/installpsh-mariner.sh | 10 +++++----- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.vsts-ci/install-ps.yml b/.vsts-ci/install-ps.yml index de78f55ce2..7c537bc130 100644 --- a/.vsts-ci/install-ps.yml +++ b/.vsts-ci/install-ps.yml @@ -9,13 +9,8 @@ trigger: - feature* paths: include: - - /tools/install-powershell.sh - - /tools/installpsh-amazonlinux.sh - - /tools/installpsh-debian.sh - - /tools/installpsh-osx.sh - - /tools/installpsh-redhat.sh - - /tools/installpsh-suse.sh - - /tools/install-powershell.ps1 + - /tools/install-powershell.* + - /tools/installpsh-*.sh - /.vsts-ci/install-ps.yml pr: branches: @@ -26,11 +21,7 @@ pr: paths: include: - /tools/install-powershell.sh - - /tools/installpsh-amazonlinux.sh - - /tools/installpsh-debian.sh - - /tools/installpsh-osx.sh - - /tools/installpsh-redhat.sh - - /tools/installpsh-suse.sh + - /tools/installpsh-*.sh - /tools/install-powershell.ps1 - /.vsts-ci/install-ps.yml diff --git a/.vsts-ci/linux.yml b/.vsts-ci/linux.yml index 6a3f0280d0..7e2b223583 100644 --- a/.vsts-ci/linux.yml +++ b/.vsts-ci/linux.yml @@ -44,6 +44,7 @@ pr: - test/common/markdown/* - test/perf/* - tools/releaseBuild/* + - tools/install* - tools/releaseBuild/azureDevOps/templates/* - README.md - .spelling diff --git a/tools/installpsh-mariner.sh b/tools/installpsh-mariner.sh index 9bb389fbda..e274f0b671 100644 --- a/tools/installpsh-mariner.sh +++ b/tools/installpsh-mariner.sh @@ -27,7 +27,7 @@ gitreposubpath="PowerShell/PowerShell/master" gitreposcriptroot="https://raw.githubusercontent.com/$gitreposubpath/tools" thisinstallerdistro=mariner repobased=false -gitscriptname="installpsh-mariner.psh" +gitscriptname="installpsh-mariner.sh" pwshlink=/usr/bin/pwsh echo @@ -109,11 +109,11 @@ fi SUDO='' if (( EUID != 0 )); then #Check that sudo is available - if [[ ("'$*'" =~ skip-sudo-check) && ("$(whereis sudo)" == *'/'* && "$(sudo -nv 2>&1)" != 'Sorry, user'*) ]]; then + if [[ ("'$*'" =~ skip-sudo-check) || ("$(whereis sudo)" == *'/'* && "$(sudo -nv 2>&1)" != 'Sorry, user'*) ]]; then SUDO='sudo' else echo "ERROR: You must either be root or be able to use sudo" >&2 - #exit 5 + exit 5 fi fi @@ -139,8 +139,8 @@ $SUDO tdnf install -y \ openssh-clients \ ca-certificates \ tar \ - curl \ - && tdnf clean all + curl +$SUDO tdnf clean all ##END Check requirements and prerequisites