Files
setup-script/setupTmp.ps1

163 lines
7.8 KiB
PowerShell

$tmpPath = Join-Path $env:LOCALAPPDATA "Temp\Script-setup"
function DownloadFiles {
param (
[string] $Type
)
if (-not (Test-Path -Path $tmpPath -PathType Container)) {
New-Item -Path $tmpPath -ItemType Directory
}
switch ($Type) {
"Labo" {
$filesToDownload = @(
@{
Url = "https://winstars.net/files/version3/winstars_installer.exe" # Validated 15/11/23
FileName = "winstars_installer.exe"
Hash = "f3e97e1373ab84eb4c707f04fca78abbcb0ed289"
},
@{
Url = "https://cosphilog.fr/tectoglob3d/Tectoglob3D-win32-ia32.zip"
FileName = "Tectoglob3D-win32-ia32.zip"
},
@{
Url = "http://acces.ens-lyon.fr/acces/logiciels/applications/tectoglob/Tectoglob_11_complet.zip/at_download/file"
FileName = "Tectoglob_11_complet.zip"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/Sismolog.zip"
FileName = "Sismolog.zip"
Hash = "31d10f5f2816281e6ea632e2ca1f0d7daa9fbfff"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/respipoisson.exe"
FileName = "Respipoisson.exe"
Hash = "5ccbb52480f8a867d5c836d3c14360eb2ed66901"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/Regressi.msi"
FileName = "Regressi.msi"
Hash = "686b29fb89fd841c0f88fa27b83d58d03aff3e88"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/regavi.zip"
FileName = "regavi.zip"
Hash = "d61dc27dd13a32f9e46d3b291c3f468cf2c4507c"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/Radiochr_08.exe"
FileName = "Radiochr.exe"
Hash = "8452ca0ca30c4f17d60e5cc7f721624244e51290"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/Phylogene-Lycee-2021.zip"
FileName = "Phylogene-Lycee-2021.zip"
Hash = "39611185a4b788722989b8811adc374928090501"
},
@{
Url = "http://philippe.cosentino.free.fr/productions/paleoterre/paleoterre_el32.zip" # Validated 15/11/23
FileName = "paleoterre_el32.zip"
Hash = "ee282e54d7c1e682fb6b219bcc7fac395f2984e3"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/Eduanat2_Setup_2.0.0.exe"
FileName = "Eduanat2_Setup_2.0.0.exe"
Hash = "a423589d43a60432efb012147c2540d6e9dc9f78"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/Couvac.exe"
FileName = "Couvac.exe"
Hash = "298b1337e914c56bb96ce358dbc9e4d38371aca4"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/ChemSketch.zip"
FileName = "ChemSketch.zip"
Hash = "5c7fce37f60f613bad44f6515d789d3aaf672dc6"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/Anagene.zip"
FileName = "Anagene.zip"
Hash = "17d6a6fd898644b9b3771affa95842f0992d19cf"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/EduPython.zip"
FileName = "EduPython.zip"
Hash = "41cb919182beb4d0fe2ea7a91fdb94eaf9bc91cc"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/rastop.zip"
FileName = "rastop.zip"
Hash = "ae63a6aaf8c85adc16a93c7e2ebbab89b4796384"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/SalsaJ_2_3.exe"
FileName = "SalsaJ_2_3.exe"
Hash = "4998000aa25dbd6dee082839854efb4ab6ac9d56"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/AtelierScientifiqueElevePhy_FR_8_1_7.msi"
FileName = "AtelierScientifiqueElevePhy_FR_8_1_7.msi"
Hash = "7c5a3f080a5bc862072e8eba78299dc409b85b2c"
}
)
}
"Info" {
$filesToDownload = @(
@{
Url = "https://education.lego.com/_/downloads/EV3_Classroom_Windows_1.5.3_Global.msi" # Validated 15/11/23
FileName = "EV3_Classroom_Windows_1.5.3_Global.msi"
Hash = "70ed2ab3f18f157db6556f88e99f8575a2498379"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/simulation.zip"
FileName = "simulation.zip"
Hash = "2327c15c390d53d4d5929a1a53acea566c8fba42"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/googlesketchupwen.exe"
FileName = "googlesketchupwen.exe"
Hash = "f0628e6f05241f91e4f36d6be3b8685a408ad12b"
},
@{
Url = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/Setup%20files/RobotProg.zip"
FileName = "RobotProg.zip"
Hash = "5ed0962c5aefb5738d4408bb475655ea02e96dbb"
}
)
}
"Office" {
$filesToDownload = @(
@{
Url = "https://officecdn.microsoft.com/db/492350f6-3a01-4f97-b9c0-c7c6ddf67d60/media/fr-fr/O365ProPlusRetail.img" # Validated 15/11/23
FileName = "O365ProPlusRetail.img"
Hash = "6d603e00560bb9619453d1fa1c1a5984850db6d2"
}
)
}
"Office-online" {
$filesToDownload = @(
@{
Url = "https://c2rsetup.officeapps.live.com/c2r/download.aspx?ProductreleaseID=O365ProPlusRetail&platform=x64&language=fr-fr&version=O16GA" # Validated 23/01/24
FileName = "OfficeSetup.exe"
Hash = "6e01f58e614a0c5a71b68930564fa779764f8e5f"
}
)
}
default { Write-Host "Invalid selection." }
}
foreach ($fileInfo in $filesToDownload) {
$filePath = Join-Path $tmpPath $fileInfo.FileName
Write-Host "Checking $($fileInfo.FileName)..."
if (-not (Test-Path -Path $filePath -PathType Leaf)) {
Write-Host "File not found, downloading..."
Invoke-WebRequest -Uri $fileInfo.Url -OutFile $filePath
}
if ($fileInfo.Hash -and (Get-FileHash -Path $filePath -Algorithm SHA1).Hash -ne $fileInfo.Hash) {
Write-Host "File hash mismatch, redownloading..."
Invoke-WebRequest -Uri $fileInfo.Url -OutFile $filePath
}
}
}