installer: corrections wizard C# (System.Management, AppContext.BaseDirectory), fix script Inno Setup GetDiskFreeSpaceEx, ajout SUIVI_INSTALLER

This commit is contained in:
EduBox Dev
2026-06-28 22:52:45 +00:00
parent 0f07a2d2a3
commit 3c519629d2
6 changed files with 128 additions and 9 deletions
+106
View File
@@ -0,0 +1,106 @@
# Feuille de route — Installateur studioE5 Agent
## Objectif
Fournir un **installateur professionnel Windows** pour studioE5 Agent, guidé pas à pas, qui gère les prérequis (WSL2 / Podman) et propose une désinstallation complète.
## Architecture choisie
- **Wizard C# Windows Forms (.NET 8)** : `setup-wizard/`
- Détecte les prérequis.
- Installe WSL2 si besoin (avec reprise après redémarrage via `RunOnce`).
- Installe Podman depuis le MSI officiel.
- Initialise et démarre la machine Podman.
- Lance le package Inno Setup de studioE5 Agent.
- Mode désinstallation via `/uninstall`.
- **Package agent (Inno Setup)** : `studioE5-agent.iss`
- Installe `studioE5-agent.exe` + binaires Tailscale.
- Crée les raccourcis.
- Gère la désinstallation.
## État actuel
### ✅ Réalisé
- Wizard C# avec 7 étapes guidées.
- Détection des prérequis : Windows, RAM, disque, WSL2, Podman.
- Installation WSL2 avec redémarrage + reprise automatique.
- Installation Podman via MSI bundlé.
- Configuration Podman (`machine init` + `machine start`).
- Lancement du package Inno Setup agent.
- Mode désinstallation complet.
- Script Inno Setup de base pour lagent.
### 🔄 En cours / À tester
- Compilation et test du wizard sur Windows.
- Packaging final (wizard + MSI Podman + setup agent) en un seul dossier distribuable.
### ⏳ À venir
- Signature de lexécutable pour éviter les alertes SmartScreen.
- Support macOS et Linux.
- Installateur silencieux possible pour déploiement GPO.
## Build du wizard
### Prérequis
- Windows 10/11
- .NET 8 SDK
- Inno Setup 6 (pour générer `studioE5-agent-setup.exe`)
### Fichiers à placer
Dans `setup-wizard/Resources/` :
```text
podman-installer-windows-amd64.msi
studioE5-agent-setup.exe
```
### Commande
```powershell
cd setup-wizard
dotnet publish -c Release -r win-x64 --self-contained true /p:PublishSingleFile=true
```
### Sortie
```text
setup-wizard\bin\Release\net8.0-windows\win-x64\publish\StudioE5-SetupWizard.exe
```
## Build du package agent (Inno Setup)
Structure attendue :
```text
agent/
├── studioE5-agent.exe
├── tailscale-bin/
│ └── windows/
│ ├── tailscale.exe
│ ├── tailscaled.exe
│ └── wintun.dll
└── installer/
└── studioE5-agent.iss
```
Ouvrir `studioE5-agent.iss` avec Inno Setup Compiler et compiler (`Ctrl+F9`).
Le fichier généré se trouve dans `installer-output/`.
## Notes importantes
- Le wizard doit être exécuté **en administrateur**.
- Linstallation de WSL2 nécessite un **redémarrage** de lordinateur.
- Le MSI Podman officiel pour Windows est `podman-installer-windows-amd64.msi`.
- Pour la désinstallation, le MSI Podman doit être présent dans `Resources/`.
## Liens utiles
- Releases Podman : <https://github.com/containers/podman/releases>
- Inno Setup : <https://jrsoftware.org/isdl.php>
- .NET 8 SDK : <https://dotnet.microsoft.com/download/dotnet/8.0>
+4 -4
View File
@@ -412,9 +412,9 @@ public partial class MainForm : Form
try try
{ {
var msiPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? ".", "Resources", "podman-setup.msi"); var msiPath = Path.Combine(AppContext.BaseDirectory, "Resources", "podman-installer-windows-amd64.msi");
if (!File.Exists(msiPath)) if (!File.Exists(msiPath))
throw new FileNotFoundException("Le fichier podman-setup.msi est introuvable. Vérifiez qu'il est bien inclus dans le package."); throw new FileNotFoundException("Le fichier podman-installer-windows-amd64.msi est introuvable. Vérifiez qu'il est bien inclus dans le package.");
RunCommand("msiexec.exe", $"/i \"{msiPath}\" /qn /norestart", "Installation de Podman en cours..."); RunCommand("msiexec.exe", $"/i \"{msiPath}\" /qn /norestart", "Installation de Podman en cours...");
_state.PodmanInstalled = true; _state.PodmanInstalled = true;
@@ -506,7 +506,7 @@ public partial class MainForm : Form
{ {
try try
{ {
var setupPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? ".", "Resources", "studioE5-agent-setup.exe"); var setupPath = Path.Combine(AppContext.BaseDirectory, "Resources", "studioE5-agent-setup.exe");
if (!File.Exists(setupPath)) if (!File.Exists(setupPath))
throw new FileNotFoundException("Le fichier studioE5-agent-setup.exe est introuvable. Vérifiez qu'il est bien inclus dans le package."); throw new FileNotFoundException("Le fichier studioE5-agent-setup.exe est introuvable. Vérifiez qu'il est bien inclus dans le package.");
@@ -600,7 +600,7 @@ public partial class MainForm : Form
} }
// 4. Uninstall Podman // 4. Uninstall Podman
var podmanMsiPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? ".", "Resources", "podman-setup.msi"); var podmanMsiPath = Path.Combine(AppContext.BaseDirectory, "Resources", "podman-installer-windows-amd64.msi");
if (File.Exists(podmanMsiPath)) if (File.Exists(podmanMsiPath))
{ {
RunCommand("msiexec.exe", $"/x \"{podmanMsiPath}\" /qn /norestart", "Désinstallation de Podman..."); RunCommand("msiexec.exe", $"/x \"{podmanMsiPath}\" /qn /norestart", "Désinstallation de Podman...");
+2 -2
View File
@@ -30,7 +30,7 @@ setup-wizard/
├── InstallerState.cs ├── InstallerState.cs
├── PrerequisiteChecker.cs ├── PrerequisiteChecker.cs
└── Resources/ └── Resources/
├── podman-setup.msi # MSI officiel Podman pour Windows ├── podman-installer-windows-amd64.msi # MSI officiel Podman pour Windows
└── studioE5-agent-setup.exe # Package Inno Setup de l'agent └── studioE5-agent-setup.exe # Package Inno Setup de l'agent
``` ```
@@ -58,7 +58,7 @@ bin\Release\net8.0-windows\win-x64\publish\StudioE5-SetupWizard.exe
1. Télécharger le MSI Podman Windows : 1. Télécharger le MSI Podman Windows :
<https://github.com/containers/podman/releases> <https://github.com/containers/podman/releases>
2. Le renommer en `podman-setup.msi` et le placer dans `Resources/`. 2. Le renommer en `podman-installer-windows-amd64.msi` et le placer dans `Resources/`.
3. Générer le package Inno Setup de lagent (`studioE5-agent-setup.exe`) et le placer dans `Resources/`. 3. Générer le package Inno Setup de lagent (`studioE5-agent-setup.exe`) et le placer dans `Resources/`.
4. Builder et publier le wizard. 4. Builder et publier le wizard.
@@ -11,7 +11,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Include="Resources\podman-setup.msi"> <PackageReference Include="System.Management" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\podman-installer-windows-amd64.msi">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Resources\studioE5-agent-setup.exe"> <Content Include="Resources\studioE5-agent-setup.exe">
+10 -1
View File
@@ -84,11 +84,20 @@ begin
Result := Exec('podman.exe', 'machine list', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) and (ResultCode = 0); Result := Exec('podman.exe', 'machine list', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) and (ResultCode = 0);
end; end;
function GetDiskFreeSpaceEx(
lpDirectoryName: string;
var lpFreeBytesAvailableToCaller: Int64;
var lpTotalNumberOfBytes: Int64;
var lpTotalNumberOfFreeBytes: Int64
): Boolean;
external 'GetDiskFreeSpaceExW@kernel32.dll stdcall';
function GetFreeDiskSpaceMB(const Path: string): Cardinal; function GetFreeDiskSpaceMB(const Path: string): Cardinal;
var var
FreeBytes, TotalBytes: Int64; FreeBytes, TotalBytes: Int64;
Dummy: Int64;
begin begin
if GetDiskFreeSpaceEx(Path, FreeBytes, TotalBytes, nil) then if GetDiskFreeSpaceEx(Path, FreeBytes, TotalBytes, Dummy) then
Result := Cardinal(FreeBytes div (1024 * 1024)) Result := Cardinal(FreeBytes div (1024 * 1024))
else else
Result := 0; Result := 0;
Binary file not shown.