feat: adguard-shield als globalen CLI-Befehl registrieren + Doku

This commit is contained in:
Patrick Asmus
2026-05-09 21:18:44 +02:00
parent de521f73ed
commit 9e3656bfbc
11 changed files with 353 additions and 226 deletions

View File

@@ -244,7 +244,11 @@ func run() error {
case "report-test":
return report.SendTest(ctx, cfg)
case "report-install":
return report.InstallCron("/opt/adguard-shield/adguard-shield", cfg.Path, cfg)
binary := "/opt/adguard-shield/adguard-shield"
if _, err := os.Stat(installer.CLICommandPath); err == nil {
binary = installer.CLICommandPath
}
return report.InstallCron(binary, cfg.Path, cfg)
case "report-remove":
return report.RemoveCron()
case "firewall-create":
@@ -463,8 +467,8 @@ func usage() {
Nutzung:
adguard-shield version
adguard-shield install [--config-source PATH] [--skip-deps]
adguard-shield update [--config-source PATH] [--skip-deps]
adguard-shield install [--config-source PATH] [--skip-deps] [--no-register]
adguard-shield update [--config-source PATH] [--skip-deps] [--no-register]
adguard-shield uninstall [--keep-config]
adguard-shield install-status
adguard-shield [-config PATH] run|start|stop|dry-run
@@ -653,9 +657,11 @@ func parseInstallFlags(name string, args []string) (installer.Options, error) {
fs.StringVar(&opts.ConfigSource, "config-source", "", "Konfiguration fuer Neuinstallation uebernehmen")
fs.BoolVar(&opts.SkipDeps, "skip-deps", false, "Paketpruefung ueberspringen")
noEnable := fs.Bool("no-enable", false, "systemd Autostart nicht aktivieren")
noRegister := fs.Bool("no-register", false, "CLI-Befehl nicht in /usr/local/bin registrieren")
if err := fs.Parse(args); err != nil {
return opts, err
}
opts.Enable = !*noEnable
opts.RegisterCLI = !*noRegister
return opts, nil
}