@@ -13,6 +13,7 @@ import (
1313 "os/exec"
1414 "path/filepath"
1515 "regexp"
16+ "runtime"
1617 "strings"
1718 "sync"
1819 "time"
@@ -1492,7 +1493,7 @@ func (e *Engine) maybeOfferSelfUpdate(ctx context.Context, emit func(domain.Even
14921493 tag = "v" + info .HighestVersion
14931494 }
14941495
1495- cmdStr := "go install github.com/evolution-cms/installer/cmd/evo@" + tag
1496+ cmdStr := "evo self-update"
14961497
14971498 _ = emit (domain.Event {
14981499 Type : domain .EventLog ,
@@ -1519,9 +1520,14 @@ func (e *Engine) maybeOfferSelfUpdate(ctx context.Context, emit func(domain.Even
15191520
15201521 updateEnabled := true
15211522 reason := ""
1522- if _ , lookErr := exec .LookPath ("go" ); lookErr != nil {
1523+ bootstrapper , bootErr := findPHPBootstrapperEntry ()
1524+ if bootErr != nil || strings .TrimSpace (bootstrapper ) == "" {
15231525 updateEnabled = false
1524- reason = "Go not found in PATH"
1526+ if bootErr != nil {
1527+ reason = bootErr .Error ()
1528+ } else {
1529+ reason = "PHP bootstrapper not found"
1530+ }
15251531 }
15261532
15271533 choice , okSel := askSelect (ctx , emit , actions , stepID , domain.QuestionState {
@@ -1545,33 +1551,25 @@ func (e *Engine) maybeOfferSelfUpdate(ctx context.Context, emit func(domain.Even
15451551 Source : "install" ,
15461552 Severity : domain .SeverityInfo ,
15471553 Payload : domain.LogPayload {
1548- Message : "Updating installer…" ,
1554+ Message : "Exiting installer and running: " + cmdStr ,
15491555 },
15501556 })
15511557
1552- cmd := exec .CommandContext (ctx , "go" , "install" , "github.com/evolution-cms/installer/cmd/evo@" + tag )
1553- out , err := cmd .CombinedOutput ()
1554- if err != nil {
1555- _ = emit (domain.Event {
1556- Type : domain .EventWarning ,
1557- StepID : stepID ,
1558- Source : "install" ,
1559- Severity : domain .SeverityWarn ,
1560- Payload : domain.LogPayload {
1561- Message : "Self-update failed; continuing installation." ,
1562- Fields : map [string ]string {"error" : err .Error (), "output" : strings .TrimSpace (string (out ))},
1563- },
1564- })
1558+ if ! updateEnabled {
15651559 return false
15661560 }
15671561
1562+ cmd := []string {bootstrapper , "self-update" }
1563+ if runtime .GOOS == "windows" {
1564+ cmd = []string {"php" , bootstrapper , "self-update" }
1565+ }
15681566 _ = emit (domain.Event {
1569- Type : domain .EventLog ,
1567+ Type : domain .EventExecRequest ,
15701568 StepID : stepID ,
15711569 Source : "install" ,
15721570 Severity : domain .SeverityInfo ,
1573- Payload : domain.LogPayload {
1574- Message : "✔ Installer updated. Please restart the installer to use the new version." ,
1571+ Payload : domain.ExecRequestPayload {
1572+ Command : cmd ,
15751573 },
15761574 })
15771575
0 commit comments