51 lines
1.5 KiB
Bash
Executable File
51 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
POWERSHELL_VERSION="7.4.2"
|
|
|
|
# Предварительные требования
|
|
|
|
source /etc/os-release
|
|
|
|
function Install-Ubuntu {
|
|
apt-get update
|
|
apt-get install -y wget apt-transport-https software-properties-common
|
|
|
|
# Download the PowerShell package file
|
|
wget https://github.com/PowerShell/PowerShell/releases/download/v${POWERSHELL_VERSION}/powershell_${POWERSHELL_VERSION}-1.deb_amd64.deb
|
|
|
|
###################################
|
|
# Install the PowerShell package
|
|
dpkg -i powershell_${POWERSHELL_VERSION}-1.deb_amd64.deb
|
|
|
|
# Resolve missing dependencies and finish the install (if necessary)
|
|
apt-get install -f
|
|
|
|
# Delete the downloaded package file
|
|
rm powershell_${POWERSHELL_VERSION}-1.deb_amd64.deb
|
|
}
|
|
|
|
function Install-Rhel {
|
|
dnf install https://github.com/PowerShell/PowerShell/releases/download/v${POWERSHELL_VERSION}/powershell-${POWERSHELL_VERSION}-1.rh.x86_64.rpm
|
|
}
|
|
|
|
if ! command -v pwsh &> /dev/null
|
|
then
|
|
echo "Powershell не установлен"
|
|
echo "Операционная система: $ID"
|
|
|
|
if [ "$ID" = "ubuntu" ]; then
|
|
Install-Ubuntu
|
|
elif [ "$ID" = "redos" ]; then
|
|
Install-Rhel
|
|
else
|
|
echo "Установите powershell для вашей $NAME, чтобы воспользоваться скриптом установки ЛЭРС"
|
|
|
|
exit 1;
|
|
fi
|
|
else
|
|
echo "Powershell установлен"
|
|
fi
|
|
|
|
pwsh -Command "Invoke-WebRequest https://sc.lers.ru/lers/Installer/raw/branch/main/Install-Lers.ps1 -OutFile Install-Lers.ps1"
|
|
chmod +x Install-Lers.ps1
|