Improve custom desktop location support

This commit is contained in:
Ivan 2024-07-14 18:53:39 +03:00
parent 06c34b7966
commit 1b5eb3fa66
7 changed files with 41 additions and 29 deletions

View File

@ -1,7 +1,9 @@
# Install ConceptDeploy module for current user
Set-Variable -Name MODULE_NAME -Value 'ConceptDeploy' -Option Constant
$modulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\modules\$MODULE_NAME"
Set-Variable -Name MODULE_NAME -Value 'ConceptDeploy' -Option Constant
$localHome = 'C:\Tools'
$modulePath = "${localHome}\$MODULE_NAME"
if (Test-Path -Path $modulePath) {
Remove-Item $modulePath -Recurse -Force
}

Binary file not shown.

View File

@ -1,4 +1,4 @@
# Deploy ConceptDeploy module files to server storage
# Deploy ConceptDeploy module files to server storage
Set-StrictMode -Version 3.0
Set-Variable -Name MODULE_NAME -Value 'ConceptDeploy'

View File

@ -1,4 +1,4 @@
# Install Concept products from local distr
# Install Concept products from local distr
# Setup constants
Set-Variable -Name OFFICE_REGISTRY -Value 'HKCU:\SOFTWARE\Microsoft\Office\16.0' -Option Constant
@ -11,6 +11,10 @@ $word = If (Test-Path "${OFFICE_REGISTRY}\Word") {"${OFFICE_REGISTRY}\Word"} Els
$excel = If (Test-Path "${OFFICE_REGISTRY}\Excel") {"${OFFICE_REGISTRY}\Excel"} Else {''}
$visio = If (Test-Path "${OFFICE_REGISTRY}\Visio") {"${OFFICE_REGISTRY}\Visio"} Else {''}
$desktopPath = [Environment]::GetFolderPath('Desktop')
$localHome = 'C:\Tools'
$Env:PSModulePath += ";${localHome}"
function InstallAllProducts {
[CmdletBinding()]
Param(
@ -22,8 +26,8 @@ function InstallAllProducts {
Set-StrictMode -Version 3.0
if (-not (Test-Path -Path $distrPath)) {
Write-Error "Distribution path does not exist: $distrPath"
if (-not (Test-Path -Path ${distrPath})) {
Write-Error "Distribution path does not exist: ${distrPath}"
Exit 1
}
@ -32,29 +36,28 @@ function InstallAllProducts {
StartLog
Write-Host "Starting installation procedure for Concept technologies" -ForegroundColor DarkGreen
Write-Host "Sources: $distrPath"
Write-Host "Skip shortcuts: $skipShortcuts`n"
Write-Host "Sources: ${distrPath}"
Write-Host "Skip shortcuts: ${skipShortcuts}`n"
Write-Host "Dependencies status:" -ForegroundColor DarkGreen
StateSystemStatus
$driveLetter = MountPathDrive $distrPath
$distr = "${driveLetter}`:"
$localHome = "C:\Tools"
Write-Host "`nEnsure core is updated..." -ForegroundColor DarkGreen
PrepareCore $distr $distrPath $standalone $localHome
Write-Host "`nSetup SecureLocation options for $SERVER_PATH" -ForegroundColor DarkGreen
Write-Host "`nSetup SecureLocation options for ${SERVER_PATH}" -ForegroundColor DarkGreen
SetupTrustedLocations $SERVER_PATH
Write-Host "`nInitializing template path for Office applications: $TEMPLATES_PATH" -ForegroundColor DarkGreen
Write-Host "`nInitializing template path for Office applications: ${TEMPLATES_PATH}" -ForegroundColor DarkGreen
InitializeTemplates $TEMPLATES_PATH
Write-Host "Update templates at $TEMPLATES_PATH" -ForegroundColor DarkGreen
Write-Host "Update templates at ${TEMPLATES_PATH}" -ForegroundColor DarkGreen
UpdateTemplates "${distr}\data\Templates" $TEMPLATES_PATH $localHome
Copy-Item -Path "$TEMPLATES_PATH\Normal.dotm" -Destination "${TEMPLATES_NORMAL_PATH}\Normal.dotm"
Copy-Item -Path "$TEMPLATES_PATH\NormalEmail.dotm" -Destination "${TEMPLATES_NORMAL_PATH}\NormalEmail.dotm"
Copy-Item -Path "${TEMPLATES_PATH}\Normal.dotm" -Destination "${TEMPLATES_NORMAL_PATH}\Normal.dotm"
Copy-Item -Path "${TEMPLATES_PATH}\NormalEmail.dotm" -Destination "${TEMPLATES_NORMAL_PATH}\NormalEmail.dotm"
Write-Host "`nUpdating products..." -ForegroundColor DarkGreen
UpdateProducts $distr $TEMPLATES_PATH $localHome
@ -62,8 +65,8 @@ function InstallAllProducts {
if (-not ($skipShortcuts)) {
Write-Host "`nInstalling desktop shortcuts" -ForegroundColor DarkGreen
Copy-Item -Path "${distr}\data\Shortcuts\*" `
-Destination "$($Env:USERPROFILE)\Desktop\" `
-Exclude (Get-ChildItem "$($Env:USERPROFILE)\Desktop") -Force -Recurse
-Destination $desktopPath `
-Exclude (Get-ChildItem $desktopPath) -Force -Recurse
}
Write-Host "`nClean up procedure ..." -ForegroundColor Blue
@ -139,7 +142,7 @@ function UpdateProducts($distr, $templates, $localHome) {
$serverManifest = "${distr}\distribution_manifest.json"
$serverJSON = Open-DistrManifest $serverManifest
$localManifest = "C:\Tools\distribution_manifest.json"
$localManifest = "${localHome}\distribution_manifest.json"
$localJSON = Open-DistrManifest $localManifest
$firstRun = $localJSON.Count -eq 0

View File

@ -1,4 +1,8 @@
# Uninstall Concept products
# Uninstall Concept products
$localHome = 'C:\Tools'
$desktopPath = [Environment]::GetFolderPath('Desktop')
$Env:PSModulePath += ";${localHome}"
function UninstallConceptProducts {
[CmdletBinding()]
@ -19,8 +23,6 @@ function UninstallConceptProducts {
}
Import-Module -Name ConceptDeploy
$localHome = "C:\Tools"
Write-Host "`nRemoving Concept Products" -ForegroundColor DarkGreen
$localJSON = Open-DistrManifest "$localHome\distribution_manifest.json"
foreach ($product in $localJSON.Keys) {
@ -53,12 +55,12 @@ function UninstallConceptProducts {
Write-Host "`nRemoving ConceptDeploy library" -ForegroundColor DarkGreen
Remove-Module -Name ConceptDeploy
TryRemove "$env:USERPROFILE\Documents\WindowsPowerShell\modules\ConceptDeploy"
TryRemove "${localHome}\ConceptDeploy"
Write-Host "`nRemoving desktop shortcuts" -ForegroundColor DarkGreen
TryRemove "$($Env:USERPROFILE)\Desktop\Everything - поиск по имени.lnk"
TryRemove "$($Env:USERPROFILE)\Desktop\DocFetcher - поиск по содержимому.lnk"
TryRemove "$($Env:USERPROFILE)\Desktop\Double Commander.lnk"
TryRemove "${desktopPath}\Everything - поиск по имени.lnk"
TryRemove "${desktopPath}\DocFetcher - поиск по содержимому.lnk"
TryRemove "${desktopPath}\Double Commander.lnk"
Write-Host "`nUninstallation complete" -ForegroundColor Green
@ -71,7 +73,7 @@ function StartLog {
$ErrorActionPreference = "Continue"
$dateSuffix = (Get-Date -UFormat "%Y%m%d_%I-%M-%S").ToString()
$logFile = "$PSScriptRoot\logs\$($dateSuffix)_CP-uninstall_$($Env:USERNAME).txt"
$logFile = "${PSScriptRoot}\logs\$($dateSuffix)_CP-uninstall_$($Env:USERNAME).txt"
Start-Transcript -Path $logFile -IncludeInvocationHeader
}

View File

@ -1,4 +1,8 @@
# Install Concept products from local distr
# Install Concept products from local distr
$localHome = 'C:\Tools'
$Env:PSModulePath += ";${localHome}"
function UpdateConceptProducts {
[CmdletBinding()]
@ -18,8 +22,8 @@ function UpdateConceptProducts {
StartLog
Write-Host "Starting update procedure for Concept technologies" -ForegroundColor DarkGreen
Write-Host "Sources: $distrPath"
Write-Host "Requested products: $products"
Write-Host "Sources: ${distrPath}"
Write-Host "Requested products: ${products}"
$updates = New-Object System.Collections.Generic.List[System.Object]
$enable_products = New-Object System.Collections.Generic.List[System.Object]
@ -99,6 +103,7 @@ function UpdateProducts($distrPath, $products) {
Write-Host "Installing Powershell library: ConceptDeploy" -ForegroundColor DarkGreen
. "$driveLetter\src\ConceptDeploy\CD_Install.ps1"
}
Import-Module -Name ConceptDeploy
Write-Host "Using ConceptDeploy: $((Get-Module -Name 'ConceptDeploy').Version)" -ForegroundColor Gray

View File

@ -1 +1 @@
3.1.0
3.2.0