mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-12-19 03:37:46 +00:00
[UTILS] FSGET: Use /etc/apt/auth.conf.d/*.conf for APT auth
This commit is contained in:
@@ -31,15 +31,26 @@ setup_common()
|
|||||||
grep
|
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()
|
configure_auth()
|
||||||
{
|
{
|
||||||
local domain=$1
|
local domain=$1
|
||||||
local username=${2:-signalwire}
|
local username=${2:-signalwire}
|
||||||
local token=$3
|
local token=$3
|
||||||
if ! grep -q "machine ${domain}" /etc/apt/auth.conf; then
|
local auth_file="/etc/apt/auth.conf.d/${domain}.conf"
|
||||||
echo "machine ${domain} login ${username} password ${token}" >> /etc/apt/auth.conf
|
|
||||||
chmod 600 /etc/apt/auth.conf
|
mkdir -p /etc/apt/auth.conf.d
|
||||||
fi
|
|
||||||
|
echo "machine ${domain} login ${username} password ${token}" > "${auth_file}"
|
||||||
|
chmod 600 "${auth_file}"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_freeswitch()
|
install_freeswitch()
|
||||||
@@ -99,11 +110,12 @@ if [ "${ID,,}" = "debian" ]; then
|
|||||||
echo "FreeSWITCH Community ($RELEASE)"
|
echo "FreeSWITCH Community ($RELEASE)"
|
||||||
|
|
||||||
setup_common
|
setup_common
|
||||||
|
disable_global_auth
|
||||||
configure_auth "${DOMAIN}" "" "${TOKEN}"
|
configure_auth "${DOMAIN}" "" "${TOKEN}"
|
||||||
|
|
||||||
curl \
|
curl \
|
||||||
--fail \
|
--fail \
|
||||||
--netrc-file /etc/apt/auth.conf \
|
--netrc-file "/etc/apt/auth.conf.d/${DOMAIN}.conf" \
|
||||||
--output ${GPG_KEY} \
|
--output ${GPG_KEY} \
|
||||||
https://${DOMAIN}/repo/deb/${RPI}debian-release/signalwire-freeswitch-repo.gpg
|
https://${DOMAIN}/repo/deb/${RPI}debian-release/signalwire-freeswitch-repo.gpg
|
||||||
|
|
||||||
@@ -132,11 +144,12 @@ if [ "${ID,,}" = "debian" ]; then
|
|||||||
echo "FreeSWITCH Enterprise ($RELEASE)"
|
echo "FreeSWITCH Enterprise ($RELEASE)"
|
||||||
|
|
||||||
setup_common
|
setup_common
|
||||||
|
disable_global_auth
|
||||||
configure_auth "${DOMAIN}" "" "${TOKEN}"
|
configure_auth "${DOMAIN}" "" "${TOKEN}"
|
||||||
|
|
||||||
curl \
|
curl \
|
||||||
--fail \
|
--fail \
|
||||||
--netrc-file /etc/apt/auth.conf \
|
--netrc-file "/etc/apt/auth.conf.d/${DOMAIN}.conf" \
|
||||||
--output ${GPG_KEY} \
|
--output ${GPG_KEY} \
|
||||||
https://${DOMAIN}/repo/deb/fsa${RPI}/keyring.gpg
|
https://${DOMAIN}/repo/deb/fsa${RPI}/keyring.gpg
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user