From 775d8fa928863abfc5e9e904e19d64d688eaf3ea Mon Sep 17 00:00:00 2001 From: robertsweetman Date: Tue, 17 Dec 2024 12:40:37 +0000 Subject: [PATCH] put more vars into config and rename files --- .../NCR/{config.ps1 => ncr_config.ps1} | 3 ++- .../ONR/{config.ps1 => onr_config.ps1} | 5 +++-- powershell/Scripts/UserDataScripts/Bods.ps1 | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) rename powershell/Configs/NCR/{config.ps1 => ncr_config.ps1} (97%) rename powershell/Configs/ONR/{config.ps1 => onr_config.ps1} (97%) diff --git a/powershell/Configs/NCR/config.ps1 b/powershell/Configs/NCR/ncr_config.ps1 similarity index 97% rename from powershell/Configs/NCR/config.ps1 rename to powershell/Configs/NCR/ncr_config.ps1 index f42c5833..1402b935 100644 --- a/powershell/Configs/NCR/config.ps1 +++ b/powershell/Configs/NCR/ncr_config.ps1 @@ -12,9 +12,10 @@ $GlobalConfig = @{ "RegistryPath" = "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\winlogon" "LegalNoticeCaption" = "IMPORTANT" "LegalNoticeText" = "This system is restricted to authorized users only. Individuals who attempt unauthorized access will be prosecuted. If you are unauthorized terminate access now. Click OK to indicate your acceptance of this information" + "WorkingDirectory" = "E:\Software" + "AppDirectory" = "E:\App" } "nomis-combined-reporting-development" = @{ - } "nomis-combined-reporting-test" = @{ # "sysDbName" = "" diff --git a/powershell/Configs/ONR/config.ps1 b/powershell/Configs/ONR/onr_config.ps1 similarity index 97% rename from powershell/Configs/ONR/config.ps1 rename to powershell/Configs/ONR/onr_config.ps1 index 6950ade9..831bf994 100644 --- a/powershell/Configs/ONR/config.ps1 +++ b/powershell/Configs/ONR/onr_config.ps1 @@ -12,10 +12,11 @@ $GlobalConfig = @{ "RegistryPath" = "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\winlogon" "LegalNoticeCaption" = "IMPORTANT" "LegalNoticeText" = "This system is restricted to authorized users only. Individuals who attempt unauthorized access will be prosecuted. If you are unauthorized terminate access now. Click OK to indicate your acceptance of this information" + "WorkingDirectory" = "E:\Software" + "AppDirectory" = "E:\App" } "oasys-national-reporting-development" = @{ - "OnrShortcuts" = @{ - } + } "oasys-national-reporting-test" = @{ "sysDbName" = "T2BOSYS" diff --git a/powershell/Scripts/UserDataScripts/Bods.ps1 b/powershell/Scripts/UserDataScripts/Bods.ps1 index 5947011d..0e450d23 100644 --- a/powershell/Scripts/UserDataScripts/Bods.ps1 +++ b/powershell/Scripts/UserDataScripts/Bods.ps1 @@ -85,10 +85,10 @@ function Get-Config { $domainName = ($Tags.Tags | Where-Object { $_.Key -eq "domain-name" }).Value if ($ApplicationTag -eq "oasys-national-reporting") { - $configPath = Join-Path -Path $PSScriptRoot -ChildPath "..\..\Configs\ONR\config.ps1" + $configPath = Join-Path -Path $PSScriptRoot -ChildPath "..\..\Configs\ONR\onr_config.ps1" } elseif ($ApplicationTag -eq "nomis-combined-reporting") { - $configPath = Join-Path -Path $PSScriptRoot -ChildPath "..\..\Configs\NCR\config.ps1" + $configPath = Join-Path -Path $PSScriptRoot -ChildPath "..\..\Configs\NCR\ncr_config.ps1" } else { Write-Error "Unexpected application tag value: $ApplicationTag" @@ -875,9 +875,6 @@ Set-TimeZone -Name "GMT Standard Time" $Config = Get-Config -$WorkingDirectory = "E:\Software" -$AppDirectory = "E:\App" - $ModulesRepo = Join-Path $PSScriptRoot '..\..\Modules' # {{{ join domain if domain-name tag is set @@ -909,10 +906,10 @@ else { # {{{ prepare assets $ErrorActionPreference = "Stop" -New-Item -ItemType Directory -Path $WorkingDirectory -Force -New-Item -ItemType Directory -Path $AppDirectory -Force +New-Item -ItemType Directory -Path $Config.WorkingDirectory -Force +New-Item -ItemType Directory -Path $Config.AppDirectory -Force -Set-Location -Path $WorkingDirectory +Set-Location -Path $Config.WorkingDirectory if ($($Config.application) -eq "oasys-national-reporting") { Install-Oracle19cClient -Config $Config @@ -923,7 +920,7 @@ if ($($Config.application) -eq "oasys-national-reporting") { Set-LoginText -Config $Config New-SharedDriveShortcut -Config $Config } -else { +elseif ($($Config.application) -eq "nomis-combined-reporting") { # IMPORTANT: NCR BODS installation & TNS files etc. not ready yet Install-Oracle19cClient -Config $Config # New-TnsOraFile -Config $Config @@ -933,4 +930,8 @@ else { Set-LoginText -Config $Config # New-SharedDriveShortcut -Config $Config } +else { + Write-Error "No application tag found, exiting" + Exit 1 +} # }}}