Merge Firefox install and configuration

This commit is contained in:
2026-05-24 10:02:47 +02:00
parent 9fb5fbc460
commit cbe534db31
5 changed files with 66 additions and 32 deletions
+4 -4
View File
@@ -20,7 +20,7 @@ Petite boîte à outils Windows pour installer des packs de logiciels libres ave
| Chemin | Rôle |
| --- | --- |
| 🧭 [`powershell/libres-softwares-install.ps1`](./powershell/libres-softwares-install.ps1) | Installateur interactif pour une liste de logiciels sélectionnés. |
| 🦊 [`powershell/Configure-FirefoxDefaults.ps1`](./powershell/Configure-FirefoxDefaults.ps1) | Définit Firefox ESR comme navigateur par défaut et force l'installation de uBlock Origin pour tous les utilisateurs. |
| 🦊 [`powershell/Install-Firefox.ps1`](./powershell/Install-Firefox.ps1) | Installe Firefox ESR, le définit comme navigateur par défaut et force l'installation de uBlock Origin pour tous les utilisateurs. |
| 🧹 [`powershell/Winget-Remove-BuiltInApps.ps1`](./powershell/Winget-Remove-BuiltInApps.ps1) | Suppression de certaines applications Windows intégrées pour l'utilisateur courant avec winget. |
| 🚫 [`powershell/Remove-BuiltInApps.ps1`](./powershell/Remove-BuiltInApps.ps1) | Suppression de certaines applications Appx intégrées sans winget avec blocages registre pour les futurs utilisateurs. |
| 🚀 [`winget/libre-soft-start-pack.yaml`](./winget/libre-soft-start-pack.yaml) | Pack automatisé de départ : Firefox ESR, 7-Zip et VLC. |
@@ -88,13 +88,13 @@ Exemple :
winget configure --file .\winget\libre-soft-start-pack.yaml --accept-configuration-agreements
```
Après l'installation d'un pack qui inclut Firefox ESR, lance le script de configuration Firefox depuis un terminal administrateur :
Pour installer Firefox ESR avec la configuration navigateur par défaut et uBlock Origin en une seule étape, lance :
```powershell
powershell -ExecutionPolicy Bypass -File .\powershell\Configure-FirefoxDefaults.ps1
powershell -ExecutionPolicy Bypass -File .\powershell\Install-Firefox.ps1
```
Le script écrit les policies Firefox, force l'installation de uBlock Origin depuis Mozilla Add-ons, configure les paramètres gérés de uBlock Origin et importe les associations d'applications Windows par défaut pour les futurs utilisateurs.
Le script installe Firefox ESR, écrit les policies Firefox, force l'installation de uBlock Origin depuis Mozilla Add-ons, configure les paramètres gérés de uBlock Origin et importe les associations d'applications Windows par défaut pour les futurs utilisateurs.
Documentation détaillée : [configuration Firefox ESR et uBlock Origin](./docs/firefox-ublock.md).
+4 -4
View File
@@ -20,7 +20,7 @@ Small Windows toolkit to install libre software packs with `winget` and remove s
| Path | Purpose |
| --- | --- |
| 🧭 [`powershell/libres-softwares-install.ps1`](./powershell/libres-softwares-install.ps1) | Interactive installer for a curated list of applications. |
| 🦊 [`powershell/Configure-FirefoxDefaults.ps1`](./powershell/Configure-FirefoxDefaults.ps1) | Sets Firefox ESR as default browser and force-installs uBlock Origin for all users. |
| 🦊 [`powershell/Install-Firefox.ps1`](./powershell/Install-Firefox.ps1) | Installs Firefox ESR, sets it as default browser and force-installs uBlock Origin for all users. |
| 🧹 [`powershell/Winget-Remove-BuiltInApps.ps1`](./powershell/Winget-Remove-BuiltInApps.ps1) | Removes selected built-in Windows applications for the current user with winget. |
| 🚫 [`powershell/Remove-BuiltInApps.ps1`](./powershell/Remove-BuiltInApps.ps1) | Removes selected built-in Appx applications without winget and writes registry blocks for future users. |
| 🚀 [`winget/libre-soft-start-pack.yaml`](./winget/libre-soft-start-pack.yaml) | Automated starter pack: Firefox ESR, 7-Zip and VLC. |
@@ -88,13 +88,13 @@ Example:
winget configure --file .\winget\libre-soft-start-pack.yaml --accept-configuration-agreements
```
After installing a pack that includes Firefox ESR, run the Firefox configuration script from an administrator terminal:
To install Firefox ESR with the default browser and uBlock Origin configuration in one step, run:
```powershell
powershell -ExecutionPolicy Bypass -File .\powershell\Configure-FirefoxDefaults.ps1
powershell -ExecutionPolicy Bypass -File .\powershell\Install-Firefox.ps1
```
The script writes Firefox enterprise policies, force-installs uBlock Origin from Mozilla Add-ons, configures managed uBlock Origin defaults and imports Windows default app associations for future users.
The script installs Firefox ESR, writes Firefox enterprise policies, force-installs uBlock Origin from Mozilla Add-ons, configures managed uBlock Origin defaults and imports Windows default app associations for future users.
More details: [Firefox ESR and uBlock Origin configuration](./docs/firefox-ublock.md).
+8 -7
View File
@@ -1,7 +1,7 @@
# Configuration Firefox ESR et uBlock Origin
Cette page documente la configuration appliquee par
[`powershell/Configure-FirefoxDefaults.ps1`](../powershell/Configure-FirefoxDefaults.ps1).
[`powershell/Install-Firefox.ps1`](../powershell/Install-Firefox.ps1).
Le but est de preparer Firefox ESR pour tous les utilisateurs Windows, y compris
les futurs profils :
@@ -12,16 +12,16 @@ les futurs profils :
## Execution
Lance le script dans un terminal PowerShell administrateur, apres installation de
Firefox ESR :
Lance le script dans un terminal PowerShell administrateur. Il installe Firefox
ESR puis applique la configuration :
```powershell
powershell -ExecutionPolicy Bypass -File .\powershell\Configure-FirefoxDefaults.ps1
powershell -ExecutionPolicy Bypass -File .\powershell\Install-Firefox.ps1
```
Le script est aussi appele automatiquement par
[`powershell/libres-softwares-install.ps1`](../powershell/libres-softwares-install.ps1)
quand Firefox ESR est installe via l'installateur interactif.
quand Firefox ESR est selectionne via l'installateur interactif.
## Fichiers et cles crees
@@ -195,8 +195,9 @@ dism.exe /Online /Get-DefaultAppAssociations
Les associations importees par DISM ciblent les futurs profils Windows. Un profil
deja cree peut conserver ses associations existantes.
Firefox doit etre installe avant l'execution du script, sinon les ProgID Firefox
peuvent etre absents.
Le script installe Firefox ESR avec winget avant de lire les ProgID Firefox. Si
winget echoue ou si Firefox ne s'enregistre pas correctement, les associations
par defaut ne peuvent pas etre importees.
uBlock Origin est telecharge par Firefox depuis Mozilla Add-ons au demarrage. La
machine doit donc avoir acces a `addons.mozilla.org`.
@@ -1,8 +1,9 @@
# Requires running as administrator
# Configures Firefox ESR as the default browser and force-installs uBlock Origin.
# Installs Firefox ESR, configures it as the default browser and force-installs uBlock Origin.
[CmdletBinding(SupportsShouldProcess = $true)]
param(
[string]$FirefoxPackageId = "Mozilla.Firefox.ESR.fr",
[string]$AssociationsPath = "$env:ProgramData\WindowsLibreSoftwareToolkit\FirefoxDefaultAssociations.xml"
)
@@ -17,6 +18,38 @@ if (-not $IsAdministrator) {
exit 1
}
function Install-FirefoxEsr {
param(
[string]$PackageId
)
if (-not (Get-Command winget -ErrorAction SilentlyContinue)) {
Write-Error "winget was not found. Install App Installer or enable winget before running this script."
exit 1
}
Write-Host "Installing Firefox ESR with winget: $PackageId" -ForegroundColor Cyan
if ($PSCmdlet.ShouldProcess($PackageId, "Install Firefox ESR")) {
$Arguments = @(
"install",
"--id", $PackageId,
"--silent",
"--accept-source-agreements",
"--accept-package-agreements"
)
$Process = Start-Process -FilePath "winget" -ArgumentList $Arguments -NoNewWindow -Wait -PassThru
if ($Process.ExitCode -ne 0) {
Write-Error "Firefox ESR installation failed. winget exit code: $($Process.ExitCode)"
exit $Process.ExitCode
}
Write-Host "Firefox ESR installed or already present." -ForegroundColor Green
}
}
function Get-FirefoxExecutablePath {
$CandidatePaths = @()
@@ -192,10 +225,12 @@ function Set-FirefoxDefaultAssociations {
}
}
Install-FirefoxEsr -PackageId $FirefoxPackageId
$FirefoxExe = Get-FirefoxExecutablePath
if (-not $FirefoxExe) {
Write-Error "Firefox was not found. Install Firefox ESR first, then run this script again."
Write-Error "Firefox was not found after installation. Check the winget package result and retry."
exit 1
}
@@ -204,4 +239,4 @@ Set-FirefoxEnterprisePolicies -FirefoxExe $FirefoxExe
Set-FirefoxDefaultAssociations -OutputPath $AssociationsPath
Write-Host ""
Write-Host "Firefox defaults configured. Restart Windows or sign out before creating/testing new users." -ForegroundColor Green
Write-Host "Firefox ESR installed and configured. Restart Windows or sign out before creating/testing new users." -ForegroundColor Green
+10 -12
View File
@@ -100,23 +100,21 @@ foreach ($logiciel in $logicielsAInstaller) {
Write-Host "ID winget: $($logiciel.ID)" -ForegroundColor Gray
try {
if ($logiciel.ID -eq "Mozilla.Firefox.ESR.fr") {
$installationFirefox = Join-Path $PSScriptRoot "Install-Firefox.ps1"
if (-not (Test-Path $installationFirefox)) {
throw "Script d'installation Firefox introuvable: $installationFirefox"
}
$process = Start-Process -FilePath "powershell" -ArgumentList "-ExecutionPolicy", "Bypass", "-File", $installationFirefox -NoNewWindow -Wait -PassThru
} else {
# Installation avec winget
$process = Start-Process -FilePath "winget" -ArgumentList "install", "--id", $logiciel.ID, "--silent", "--accept-source-agreements", "--accept-package-agreements" -NoNewWindow -Wait -PassThru
}
if ($process.ExitCode -eq 0) {
Write-Host "OK $($logiciel.Nom) installe avec succes" -ForegroundColor Green
if ($logiciel.ID -eq "Mozilla.Firefox.ESR.fr") {
$configurationFirefox = Join-Path $PSScriptRoot "Configure-FirefoxDefaults.ps1"
if (Test-Path $configurationFirefox) {
Write-Host "Configuration de Firefox ESR comme navigateur par defaut avec uBlock Origin..." -ForegroundColor Cyan
& $configurationFirefox
} else {
Write-Warning "Script de configuration Firefox introuvable: $configurationFirefox"
}
}
$reussites++
$resultats += @{Logiciel = $logiciel.Nom; Statut = "Succes"}
} else {