From 9fbe6854f5111542ace72035fe4a170c6df4df55 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 15 Jul 2023 19:53:46 +0200 Subject: [PATCH] updated apt state --- states/apt/init.sls | 2 +- states/apt/templates/apt.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/states/apt/init.sls b/states/apt/init.sls index ded4978..60fbdfe 100644 --- a/states/apt/init.sls +++ b/states/apt/init.sls @@ -17,8 +17,8 @@ apt-proxy-detect-go: file.managed: - name: /usr/local/bin/apt-proxy-detect - source: {{ apt.fetch_url }}/apt_{{ apt.arch }} + - source_hash: {{ apt.fetch_url }}/hashes - template: jinja - - skip_verify: true - mode: "0755" {% for key, value in apt.config.items() -%} diff --git a/states/apt/templates/apt.go b/states/apt/templates/apt.go index 7b49172..45a658b 100644 --- a/states/apt/templates/apt.go +++ b/states/apt/templates/apt.go @@ -17,13 +17,18 @@ type Proxy struct { } func (p *Proxy) Format() string { + if p.PORT == 0 { + return fmt.Sprintf(TMPL_WITHOUT_PORT, p.SCHEME, p.HOSTNAME) +} else { return fmt.Sprintf(TMPL, p.SCHEME, p.HOSTNAME, p.PORT) } +} var DEFAULT_PORT = 8000 -var DEFAULT_PROXY = Proxy{SCHEME: "http", HOSTNAME: "apt.paulbsd.com", PORT: 8001} +var DEFAULT_PROXY = Proxy{SCHEME: "https", HOSTNAME: "apt.paulbsd.com", PORT: 0} const TMPL = "%s://%s:%d" +const TMPL_WITHOUT_PORT = "%s://%s" func main() { addr, err := net.ResolveUDPAddr("udp", mdns.DefaultAddress)