Compare commits
2 Commits
d09892595c
...
3bc537df95
| Author | SHA1 | Date | |
|---|---|---|---|
| 3bc537df95 | |||
| 5d9ef44526 |
@ -200,20 +200,21 @@ func (inst *Installer) StartInstall(config InstallConfig) error {
|
||||
|
||||
func (inst *Installer) runInstall(config InstallConfig) {
|
||||
steps := []struct {
|
||||
name string
|
||||
percent float64
|
||||
fn func(config InstallConfig) error
|
||||
name string
|
||||
percent float64
|
||||
critical bool // if true, abort installation on failure
|
||||
fn func(config InstallConfig) error
|
||||
}{
|
||||
{"Creating installation directory", 5, inst.stepCreateDir},
|
||||
{"Extracting server binary", 10, inst.stepExtractBinary},
|
||||
{"Extracting models and firmware", 30, inst.stepExtractData},
|
||||
{"Extracting scripts", 48, inst.stepExtractScripts},
|
||||
{"Configuring system", 55, inst.stepConfigureSystem},
|
||||
{"Setting up USB driver", 62, inst.stepSetupLibusb},
|
||||
{"Setting up Python environment", 72, inst.stepSetupPython},
|
||||
{"Writing configuration", 85, inst.stepWriteConfig},
|
||||
{"Verifying installation", 90, inst.stepVerify},
|
||||
{"Setting up auto-start launcher", 95, inst.stepAutoRestart},
|
||||
{"Creating installation directory", 5, true, inst.stepCreateDir},
|
||||
{"Extracting server binary", 10, true, inst.stepExtractBinary},
|
||||
{"Extracting models and firmware", 30, true, inst.stepExtractData},
|
||||
{"Extracting scripts", 48, true, inst.stepExtractScripts},
|
||||
{"Configuring system", 55, false, inst.stepConfigureSystem},
|
||||
{"Setting up USB driver", 62, false, inst.stepSetupLibusb},
|
||||
{"Setting up Python environment", 72, false, inst.stepSetupPython},
|
||||
{"Writing configuration", 85, true, inst.stepWriteConfig},
|
||||
{"Verifying installation", 90, false, inst.stepVerify},
|
||||
{"Setting up auto-start launcher", 95, false, inst.stepAutoRestart},
|
||||
}
|
||||
|
||||
for _, step := range steps {
|
||||
@ -224,13 +225,21 @@ func (inst *Installer) runInstall(config InstallConfig) {
|
||||
})
|
||||
|
||||
if err := step.fn(config); err != nil {
|
||||
if step.critical {
|
||||
inst.emitProgress(ProgressEvent{
|
||||
Step: step.name,
|
||||
Message: fmt.Sprintf("Error: %s — %s", step.name, err),
|
||||
Percent: step.percent,
|
||||
IsError: true,
|
||||
})
|
||||
return // abort installation
|
||||
}
|
||||
inst.emitProgress(ProgressEvent{
|
||||
Step: step.name,
|
||||
Message: fmt.Sprintf("Warning: %s — %s", step.name, err),
|
||||
Message: fmt.Sprintf("Warning: %s — %s (skipped)", step.name, err),
|
||||
Percent: step.percent,
|
||||
IsError: true,
|
||||
})
|
||||
// Non-critical steps continue; critical ones are handled inside
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user