From 4d33f8600769e6d3d9b9581b2080d39c2a9d7880 Mon Sep 17 00:00:00 2001 From: twangboy Date: Tue, 25 Jul 2023 12:10:53 -0600 Subject: [PATCH] Set RootDir depending on Salt Version --- bootstrap-salt.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.ps1 b/bootstrap-salt.ps1 index 74c7b20..b7d528e 100644 --- a/bootstrap-salt.ps1 +++ b/bootstrap-salt.ps1 @@ -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) {