diff --git a/playbook/preinstall/opentext/Setup-OpenText.ps1 b/playbook/preinstall/opentext/Setup-OpenText.ps1 index 865cbd1..a5ffe24 100644 --- a/playbook/preinstall/opentext/Setup-OpenText.ps1 +++ b/playbook/preinstall/opentext/Setup-OpenText.ps1 @@ -201,9 +201,23 @@ if ($mspExit -ne 0 -and $mspExit -ne 3010) { Write-SetupLog "" Write-SetupLog "Step 3: Deploying profiles/keymaps/menus/macros..." -# Map of source subdir -> destination subdir relative to the Hummingbird root +# Map of source subdir -> destination subdir relative to the Hummingbird root. +# Optional Exclude list drops specific filenames from both the source-to-dest +# copy AND from the destination if they were left over from a prior install. $contentMap = @( - @{ Src = 'Profile'; Dst = 'Profile' } + @{ + Src = 'Profile' + Dst = 'Profile' + # West Jefferson site-specific: these three .hep sessions aren't used + # on shopfloor PCs and just clutter the HostExplorer session picker. + # Leaving the .hep files in the bundled source for rollback, just + # skipping the deploy step. + Exclude = @( + 'WJ_Office.hep', + 'IBM_qks.hep', + 'mmcs.hep' + ) + } @{ Src = 'Accessories\EB'; Dst = 'Accessories\EB' } @{ Src = 'HostExplorer\Keymap'; Dst = 'HostExplorer\Keymap' } @{ Src = 'HostExplorer\Menu'; Dst = 'HostExplorer\Menu' } @@ -219,7 +233,27 @@ function Copy-HummingbirdContent { if (-not (Test-Path $srcPath)) { continue } $dstPath = Join-Path $RootDst $entry.Dst New-Item -Path $dstPath -ItemType Directory -Force | Out-Null + + # Remove any previously-deployed excluded files from the destination + # - handles the case where a PC got them from an older install. + if ($entry.Exclude) { + foreach ($name in $entry.Exclude) { + $stale = Join-Path $dstPath $name + if (Test-Path -LiteralPath $stale) { + try { + Remove-Item -LiteralPath $stale -Force -ErrorAction Stop + Write-SetupLog " $Label : removed stale $name" + } catch { + Write-SetupLog " $Label : failed to remove $stale : $_" + } + } + } + } + $files = Get-ChildItem -Path $srcPath -File -ErrorAction SilentlyContinue + if ($entry.Exclude) { + $files = @($files | Where-Object { $entry.Exclude -notcontains $_.Name }) + } foreach ($f in $files) { Copy-Item -Path $f.FullName -Destination $dstPath -Force }