PowerShell
PowerShell copied to clipboard
installpsh-redhat.sh fails to correctly install root owned .repo file
Prerequisites
- [X] Write a descriptive title.
- [X] Make sure you are able to repro it on the latest released version
- [X] Search the existing issues.
- [X] Refer to the FAQ.
- [X] Refer to Differences between Windows PowerShell 5.1 and PowerShell.
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