Added skip for zip install due to decompression time

This commit is contained in:
2024-06-20 11:37:36 +02:00
parent 377f8b0a94
commit 1dabd4845b

View File

@@ -68,26 +68,31 @@ function InstallZip {
[string] $exe, [string] $exe,
[string] $app, [string] $app,
[bool] $createSubfolder = $false [bool] $createSubfolder = $false
[string] $skipIf
) )
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip) if (-not (Test-Path -Path $skipIf -PathType Container)) {
Write-Host "Installing $zipName..." $zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
$targetPath = $env:ProgramFiles Write-Host "Installing $zipName..."
if ($createSubfolder) { $targetPath = $env:ProgramFiles
$subFolder = Join-Path $env:ProgramFiles $zipName if ($createSubfolder) {
if (-not (Test-Path -Path $subFolder -PathType Container)) { $subFolder = Join-Path $env:ProgramFiles $zipName
New-Item -Path $subFolder -ItemType Directory if (-not (Test-Path -Path $subFolder -PathType Container)) {
New-Item -Path $subFolder -ItemType Directory
}
$targetPath = $subFolder
} }
$targetPath = $subFolder if (Test-Path -Path (Join-Path $targetPath $app) -PathType Container) {
Remove-Item -Path (Join-Path $targetPath $app) -Recurse -Force
}
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $targetPath -Force
if (-not $zipName.Equals($app) -and (-not (Test-Path -Path (Join-Path $targetPath $app) -PathType Container))) {
Start-Sleep -s 2
Move-Item -Path (Join-Path $env:ProgramFiles $zipName) -Destination (Join-Path $env:ProgramFiles $app)
}
CreateShortcut -exe $(Join-Path -Path $env:ProgramFiles -ChildPath (Join-Path -Path $app -ChildPath $exe)) -app $app
} else {
Write-Host "$app already installed."
} }
if (Test-Path -Path (Join-Path $targetPath $app) -PathType Container) {
Remove-Item -Path (Join-Path $targetPath $app) -Recurse -Force
}
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $targetPath -Force
if (-not $zipName.Equals($app) -and (-not (Test-Path -Path (Join-Path $targetPath $app) -PathType Container))) {
Start-Sleep -s 2
Move-Item -Path (Join-Path $env:ProgramFiles $zipName) -Destination (Join-Path $env:ProgramFiles $app)
}
CreateShortcut -exe $(Join-Path -Path $env:ProgramFiles -ChildPath (Join-Path -Path $app -ChildPath $exe)) -app $app
} }
function CreateShortcut { function CreateShortcut {
@@ -141,7 +146,7 @@ function InstallApps {
InstallExe -app "Couvac.exe" InstallExe -app "Couvac.exe"
InstallZipMsi -zip "ChemSketch.zip" -msi "script.msi" InstallZipMsi -zip "ChemSketch.zip" -msi "script.msi"
InstallZipMsi -zip "Anagene.zip" -msi "Anagene.msi" InstallZipMsi -zip "Anagene.zip" -msi "Anagene.msi"
InstallZip -zip "EduPython.zip" -exe "EduPython.exe" -app "EduPython" InstallZip -zip "EduPython.zip" -exe "EduPython.exe" -app "EduPython" -skipIf "C:\Program Files\EduPython"
InstallZip -zip "rastop.zip" -exe "RasTop.exe" -app "RasTop" InstallZip -zip "rastop.zip" -exe "RasTop.exe" -app "RasTop"
InstallExe -app "SalsaJ_2_3.exe" InstallExe -app "SalsaJ_2_3.exe"
} }