Fix build/package/installation scripts for SLES (#5918)
Small changes to the SUSE installation script so that it allows installing on SLES 12+ in addition to openSUSE 42+
This commit is contained in:
parent
beffdcf94d
commit
7dcd4c83d9
28
build.psm1
28
build.psm1
|
@ -135,9 +135,11 @@ function Get-EnvironmentInformation
|
|||
$environment += @{'IsCentOS' = $LinuxInfo.ID -match 'centos' -and $LinuxInfo.VERSION_ID -match '7'}
|
||||
$environment += @{'IsFedora' = $LinuxInfo.ID -match 'fedora' -and $LinuxInfo.VERSION_ID -ge 24}
|
||||
$environment += @{'IsOpenSUSE' = $LinuxInfo.ID -match 'opensuse'}
|
||||
$environment += @{'IsOpenSUSE13' = $Environment.IsOpenSUSE -and $LinuxInfo.VERSION_ID -match '13'}
|
||||
$environment += @{'IsSLES' = $LinuxInfo.ID -match 'sles'}
|
||||
$environment += @{'IsOpenSUSE13' = $Environmenst.IsOpenSUSE -and $LinuxInfo.VERSION_ID -match '13'}
|
||||
$environment += @{'IsOpenSUSE42.1' = $Environment.IsOpenSUSE -and $LinuxInfo.VERSION_ID -match '42.1'}
|
||||
$environment += @{'IsRedHatFamily' = $Environment.IsCentOS -or $Environment.IsFedora -or $Environment.IsOpenSUSE}
|
||||
$environment += @{'IsRedHatFamily' = $Environment.IsCentOS -or $Environment.IsFedora}
|
||||
$environment += @{'IsSUSEFamily' = $Environment.IsSLES -or $Environment.IsOpenSUSE}
|
||||
|
||||
# Workaround for temporary LD_LIBRARY_PATH hack for Fedora 24
|
||||
# https://github.com/PowerShell/PowerShell/issues/2511
|
||||
|
@ -1486,8 +1488,6 @@ function Get-RedHatPackageManager {
|
|||
"yum install -y -q"
|
||||
} elseif ($Environment.IsFedora) {
|
||||
"dnf install -y -q"
|
||||
} elseif ($Environment.IsOpenSUSE) {
|
||||
"zypper --non-interactive install"
|
||||
} else {
|
||||
throw "Error determining package manager for this distribution."
|
||||
}
|
||||
|
@ -1577,6 +1577,26 @@ function Start-PSBootstrap {
|
|||
$baseCommand = $PackageManager
|
||||
}
|
||||
|
||||
# Install dependencies
|
||||
Start-NativeExecution {
|
||||
Invoke-Expression "$baseCommand $Deps"
|
||||
}
|
||||
} elseif ($Environment.IsSUSEFamily) {
|
||||
# Build tools
|
||||
$Deps += "gcc", "cmake", "make"
|
||||
|
||||
# Packaging tools
|
||||
if ($Package) { $Deps += "ruby-devel", "rpmbuild", "groff" }
|
||||
|
||||
$PackageManager = "zypper --non-interactive install"
|
||||
$baseCommand = "$sudo $PackageManager"
|
||||
|
||||
# On OpenSUSE 13.2 container, sudo does not exist, so don't use it if not needed
|
||||
if($NoSudo)
|
||||
{
|
||||
$baseCommand = $PackageManager
|
||||
}
|
||||
|
||||
# Install dependencies
|
||||
Start-NativeExecution {
|
||||
Invoke-Expression "$baseCommand $Deps"
|
||||
|
|
|
@ -104,15 +104,19 @@ if [[ "$SUDO" -eq "sudo" ]]; then
|
|||
fi
|
||||
|
||||
#Collect any variation details if required for this distro
|
||||
REV=`cat /etc/SuSE-release | grep 'VERSION' | sed s/.*=\ //`
|
||||
MAJORREV=`echo $REV | sed 's/\..*//'`
|
||||
source /etc/os-release
|
||||
MAJORREV=`echo $VERSION_ID | sed 's/\..*//'`
|
||||
#END Collect any variation details if required for this distro
|
||||
|
||||
#If there are known incompatible versions of this distro, put the test, message and script exit here:
|
||||
if [[ $MAJORREV < 42 ]]; then
|
||||
if [[ $ID == 'opensuse' && $MAJORREV < 42 ]]; then
|
||||
echo "OpenSUSE $VERSION_ID is not supported!" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [[ $ID == 'sles' && $MAJORREV < 12 ]]; then
|
||||
echo "SLES $VERSION_ID is not supported!" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
#END Verify The Installer Choice
|
||||
|
||||
|
|
|
@ -196,6 +196,8 @@ function Start-PSPackage {
|
|||
"deb", "nupkg"
|
||||
} elseif ($Environment.IsRedHatFamily) {
|
||||
"rpm", "nupkg"
|
||||
} elseif ($Environment.IsSUSEFamily) {
|
||||
"rpm", "nupkg"
|
||||
} else {
|
||||
throw "Building packages for $($Environment.LinuxInfo.PRETTY_NAME) is unsupported!"
|
||||
}
|
||||
|
@ -576,8 +578,8 @@ function New-UnixPackage {
|
|||
$Iteration += ".$DebDistro"
|
||||
}
|
||||
"rpm" {
|
||||
if (!$Environment.IsRedHatFamily) {
|
||||
throw ($ErrorMessage -f "Redhat Family")
|
||||
if (!$Environment.IsRedHatFamily -and !$Environment.IsSUSEFamily) {
|
||||
throw ($ErrorMessage -f "Redhat or SUSE Family")
|
||||
}
|
||||
}
|
||||
"osxpkg" {
|
||||
|
@ -614,9 +616,9 @@ function New-UnixPackage {
|
|||
|
||||
# Destination for symlink to powershell executable
|
||||
$Link = if ($Environment.IsLinux) {
|
||||
"/usr/bin"
|
||||
"/usr/bin/"
|
||||
} elseif ($Environment.IsMacOS) {
|
||||
"/usr/local/bin"
|
||||
"/usr/local/bin/"
|
||||
}
|
||||
$linkSource = "/tmp/pwsh"
|
||||
|
||||
|
@ -1038,7 +1040,7 @@ function New-AfterScripts
|
|||
$packagingStrings.RedHatAfterInstallScript -f "$Link/pwsh" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||
$packagingStrings.RedHatAfterRemoveScript -f "$Link/pwsh" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
|
||||
}
|
||||
elseif ($Environment.IsUbuntu -or $Environment.IsDebian) {
|
||||
elseif ($Environment.IsUbuntu -or $Environment.IsDebian -or $Environment.IsSUSEFamily) {
|
||||
$AfterInstallScript = [io.path]::GetTempFileName()
|
||||
$AfterRemoveScript = [io.path]::GetTempFileName()
|
||||
$packagingStrings.UbuntuAfterInstallScript -f "$Link/pwsh" | Out-File -FilePath $AfterInstallScript -Encoding ascii
|
||||
|
|
Loading…
Reference in a new issue