PowerShell icon indicating copy to clipboard operation
PowerShell copied to clipboard

installpsh-redhat.sh fails to correctly install root owned .repo file

Open nkadel opened this issue 3 years ago • 0 comments

Prerequisites

Steps to reproduce

Run the instlalphs-redhat.sh script as a non-root user on an RHEL system.

Expected behavior

Install a .repo and RPM published copy of powershell

Actual behavior

The installer fails to update /etc/yum.repos.d/microsoft.repo, and continues on its merry way after the failure

Error details

The curl command to populate /etc/yum.repos.d/microsoft.repo is mistaken: it says:

echo "*** Setting up PowerShell repo..."
$SUDO curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/packages-microsoft-com-prod.repo


echo "*** Setting up PowerShell repo..."
curl https://packages.microsoft.com/config/rhel/7/prod.repo | $SUDO tee /etc/yum.repos.d/packages-microsoft-com-prod.repo


In addition, for consistent failures of the script the header should not merely say:

#!/bin/bash

It should say:

#!/bin/bash
set -e
set -o pipefail

Environment data

CentOS 8 Streaming, with a github cloned copy of the latest PowerShell 7.2.5 tag.

Visuals

No response

nkadel avatar Jul 23 '22 20:07 nkadel