Fixing Isssues with install apps

This commit is contained in:
2023-11-13 11:45:44 +01:00
parent abf0a5913f
commit 48091d5596
4 changed files with 38 additions and 64 deletions

View File

@@ -7,18 +7,6 @@ function InstallMsi {
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qn" -Wait
}
function InstallZipMsi {
param (
[string] $zip,
[string] $msi
)
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
Write-Host "Installing $zipName..."
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath (Join-Path $tmpPath $zipName) -Force
$msiFilePath = Join-Path -Path $tmpPath -ChildPath $msi
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qn" -Wait
}
function InstallExeSetup {
param (
[string] $app
@@ -48,20 +36,30 @@ function InstallZipSetup {
)
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
Write-Host "Installing $zipName..."
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $tmpPath -Force
Start-Process -FilePath $(Join-Path -Path $tmpPath -ChildPath (Join-Path -Path $zipName -ChildPath $exe)) -ArgumentList "/allusers /s" -Wait
$expPath = Join-Path $tmpPath $zipName
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $expPath -Force
Start-Process -FilePath $(Join-Path -Path $expPath -ChildPath (Join-Path -Path $zipName -ChildPath $exe)) -ArgumentList "/allusers /s" -Wait
}
function InstallZip {
param (
[string] $zip,
[string] $exe,
[string] $app
[string] $app,
[bool] $createSubfolder = $false
)
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
Write-Host "Installing $zipName..."
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $env:ProgramFiles -Force
if (-not $zipName.Equals($app)) {
$targetPath = $env:ProgramFiles
if ($createSubfolder) {
$subFolder = Join-Path $env:ProgramFiles $zipName
if (-not (Test-Path -Path $subFolder -PathType Container)) {
New-Item -Path $subFolder -ItemType Directory
}
$targetPath = $subFolder
}
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))) {
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
@@ -107,14 +105,14 @@ function InstallApps {
InstallZip -zip "Tectoglob_11_complet.zip" -exe "TectoGlob.exe" -app "TectoGlob"
InstallExe -app "Respipoisson.exe"
InstallMsi -app "regressi-mpeg-setup.msi"
InstallZip -zip "regavi.zip" -exe "regavi.exe" -app "Regavi"
InstallZip -zip "regavi.zip" -exe "regavi.exe" -app "Regavi" -createSubfolder $true
InstallExe -app "Radiochr.exe"
InstallZip -zip "Phylogene-Lycee-2021.zip" -exe "Programmes\Phylo.exe" -app "Phylogene"
InstallZip -zip "paleoterre_el32.zip" -exe "paleoTerre.exe" -app "PaleoTerre"
InstallExeSetup -app "Eduanat2_Setup_2.0.0.exe"
InstallZip -zip "couvac_exe.zip" -exe "couvac.exe" -app "Couvac"
InstallZip -zip "couvac_exe.zip" -exe "couvac.exe" -app "Couvac" -createSubfolder $true
InstallZipSetup -zip "ACDLabs202311_ChemSketch_FInstall.zip" -exe "setup.exe"
InstallZipMsi -zip "Anagene.zip" -msi "Anagène 2.msi"
InstallZipSetup -zip "Anagene.zip" -exe "Anagene/Setup.exe"
}
"Info" {
InstallZip -zip "simulation.zip" -exe "simulation.exe" -app "Simulation Domotique"