feat(cli): add ctrld diag for provisioning support

This commit is contained in:
Anthony Wong
2026-09-04 16:47:29 +07:00
committed by Cuong Manh Le
parent 0f821a7907
commit e8e04ae094
8 changed files with 987 additions and 5 deletions
+12
View File
@@ -175,6 +175,7 @@ func initCLI() *cobra.Command {
InitClientsCmd(rootCmd)
InitUpgradeCmd(rootCmd)
InitLogCmd(rootCmd)
InitDiagCmd(rootCmd)
return rootCmd
}
@@ -1381,6 +1382,17 @@ func userHomeDir() (string, error) {
return ctrld.UserHomeDir()
}
// serviceHomeDir returns the directory where a ctrld service with root or
// administrator rights keeps its files. Unlike userHomeDir, it has no
// fallback to the home directory of the current user, so a caller without
// root that only reads looks where the service wrote.
func serviceHomeDir() (string, error) {
if isMobile() {
return homedir, nil
}
return ctrld.ServiceHomeDir()
}
// absHomeDir returns the absolute path of filename in the ctrld home
// directory. A custom homedir wins, so a file lands next to the log and
// the config that obey the same override.