fix: harden operations and configuration recovery

This commit is contained in:
proxyctl coordinator
2026-08-30 11:13:45 +08:00
parent e34bf7d989
commit 8928986830
27 changed files with 542 additions and 125 deletions
+4 -5
View File
@@ -2,7 +2,6 @@
package apt
import (
"bufio"
"context"
"errors"
"fmt"
@@ -15,6 +14,7 @@ import (
"sort"
"strings"
"proxyctl/internal/execsafe"
"proxyctl/internal/profile"
"proxyctl/internal/securefs"
"proxyctl/internal/target"
@@ -77,7 +77,7 @@ type Runner interface {
type systemRunner struct{}
func (systemRunner) LookPath(name string) (string, error) { return exec.LookPath(name) }
func (systemRunner) LookPath(name string) (string, error) { return execsafe.LookPath(name) }
func (systemRunner) Output(ctx context.Context, name string, args ...string) ([]byte, error) {
return exec.CommandContext(ctx, name, args...).Output()
}
@@ -435,9 +435,8 @@ func aptQuote(value string) string {
func parseConfiguration(data []byte) map[string]string {
settings := make(map[string]string)
scanner := bufio.NewScanner(strings.NewReader(string(data)))
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
for _, raw := range strings.Split(string(data), "\n") {
line := strings.TrimSpace(raw)
if line == "" || strings.HasPrefix(line, "//") || strings.HasPrefix(line, "#") {
continue
}