From: s3rj1k Date: Fri, 11 Jul 2025 18:52:22 +0000 (+0200) Subject: [UTILS] FSGET: Use `/etc/apt/auth.conf.d/*.conf` for APT auth X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25417d34be57c8be1c4f73b182fa8607aa14b724;p=thirdparty%2Ffreeswitch.git [UTILS] FSGET: Use `/etc/apt/auth.conf.d/*.conf` for APT auth --- diff --git a/scripts/packaging/fsget.sh b/scripts/packaging/fsget.sh index 049e5085b8..580b7032ff 100755 --- a/scripts/packaging/fsget.sh +++ b/scripts/packaging/fsget.sh @@ -31,15 +31,26 @@ setup_common() grep } +disable_global_auth() +{ + local auth_file="/etc/apt/auth.conf" + + if [ -f "${auth_file}" ]; then + sed -i 's/^machine \(freeswitch\.signalwire\.com\|fsa\.freeswitch\.com\)/# machine \1/' "${auth_file}" + fi +} + configure_auth() { local domain=$1 local username=${2:-signalwire} local token=$3 - if ! grep -q "machine ${domain}" /etc/apt/auth.conf; then - echo "machine ${domain} login ${username} password ${token}" >> /etc/apt/auth.conf - chmod 600 /etc/apt/auth.conf - fi + local auth_file="/etc/apt/auth.conf.d/${domain}.conf" + + mkdir -p /etc/apt/auth.conf.d + + echo "machine ${domain} login ${username} password ${token}" > "${auth_file}" + chmod 600 "${auth_file}" } install_freeswitch() @@ -99,11 +110,12 @@ if [ "${ID,,}" = "debian" ]; then echo "FreeSWITCH Community ($RELEASE)" setup_common + disable_global_auth configure_auth "${DOMAIN}" "" "${TOKEN}" curl \ --fail \ - --netrc-file /etc/apt/auth.conf \ + --netrc-file "/etc/apt/auth.conf.d/${DOMAIN}.conf" \ --output ${GPG_KEY} \ https://${DOMAIN}/repo/deb/${RPI}debian-release/signalwire-freeswitch-repo.gpg @@ -132,11 +144,12 @@ if [ "${ID,,}" = "debian" ]; then echo "FreeSWITCH Enterprise ($RELEASE)" setup_common + disable_global_auth configure_auth "${DOMAIN}" "" "${TOKEN}" curl \ --fail \ - --netrc-file /etc/apt/auth.conf \ + --netrc-file "/etc/apt/auth.conf.d/${DOMAIN}.conf" \ --output ${GPG_KEY} \ https://${DOMAIN}/repo/deb/fsa${RPI}/keyring.gpg