32 lines
542 B
Go
32 lines
542 B
Go
package codeserver
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
|
|
"zlh-agent/internal/provision/executil"
|
|
"zlh-agent/internal/provision/markers"
|
|
"zlh-agent/internal/state"
|
|
)
|
|
|
|
func Install(cfg state.Config) error {
|
|
const marker = "addon-codeserver"
|
|
|
|
if markers.IsPresent(marker) {
|
|
return nil
|
|
}
|
|
|
|
scriptPath := filepath.Join(
|
|
executil.ScriptsRoot,
|
|
"addons",
|
|
"codeserver",
|
|
"install.sh",
|
|
)
|
|
|
|
if err := executil.RunScript(scriptPath); err != nil {
|
|
return fmt.Errorf("codeserver install failed: %w", err)
|
|
}
|
|
|
|
return markers.Write(marker)
|
|
}
|