Set RootDir depending on Salt Version

This commit is contained in:
twangboy 2023-07-25 12:10:53 -06:00 committed by Pedro Algarvio
parent fdbe7db9ee
commit 4d33f86007

View file

@ -353,7 +353,14 @@ if ($RunService.ToLower() -eq "true") {
$ConfiguredAnything = $False
$RootDir = "C:\salt"
# Detect older version of Salt to determing default RootDir
if ($majorVersion -lt 3004) {
$RootDir = "$env:SystemDrive`:\salt"
} else {
$RootDir = "$env:ProgramData\Salt Project\Salt"
}
# Check for existing installation where RootDir is stored in the registry
$SaltRegKey = "HKLM:\SOFTWARE\Salt Project\Salt"
if (Test-Path -Path $SaltRegKey) {
if ($null -ne (Get-ItemProperty $SaltRegKey).root_dir) {