mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-17 10:10:25 +00:00
commit
b05c284f62
1 changed files with 28 additions and 12 deletions
|
@ -1866,6 +1866,26 @@ __apt_get_upgrade_noinput() {
|
|||
} # ---------- end of function __apt_get_upgrade_noinput ----------
|
||||
|
||||
|
||||
#--- FUNCTION -------------------------------------------------------------------------------------------------------
|
||||
# NAME: __temp_gpg_pub
|
||||
# DESCRIPTION: Create a temporary file for downloading a GPG public key.
|
||||
#----------------------------------------------------------------------------------------------------------------------
|
||||
__temp_gpg_pub() {
|
||||
if __check_command_exists mktemp; then
|
||||
tempfile="$(mktemp /tmp/salt-gpg-XXXXXXXX.pub 2>/dev/null)"
|
||||
|
||||
if [ -z "$tempfile" ]; then
|
||||
echoerror "Failed to create temporary file in /tmp"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
tempfile="/tmp/salt-gpg-$$.pub"
|
||||
fi
|
||||
|
||||
echo $tempfile
|
||||
} # ----------- end of function __temp_gpg_pub -----------
|
||||
|
||||
|
||||
#--- FUNCTION -------------------------------------------------------------------------------------------------------
|
||||
# NAME: __apt_key_fetch
|
||||
# DESCRIPTION: Download and import GPG public key for "apt-secure"
|
||||
|
@ -1874,8 +1894,13 @@ __apt_get_upgrade_noinput() {
|
|||
__apt_key_fetch() {
|
||||
url=$1
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__wait_for_apt apt-key adv ${_GPG_ARGS} --fetch-keys "$url"; return $?
|
||||
tempfile="$(__temp_gpg_pub)"
|
||||
|
||||
__fetch_url "$tempfile" "$url" || return 1
|
||||
apt-key add "$tempfile" || return 1
|
||||
rm -f "$tempfile"
|
||||
|
||||
return 0
|
||||
} # ---------- end of function __apt_key_fetch ----------
|
||||
|
||||
|
||||
|
@ -1887,16 +1912,7 @@ __apt_key_fetch() {
|
|||
__rpm_import_gpg() {
|
||||
url=$1
|
||||
|
||||
if __check_command_exists mktemp; then
|
||||
tempfile="$(mktemp /tmp/salt-gpg-XXXXXXXX.pub 2>/dev/null)"
|
||||
|
||||
if [ -z "$tempfile" ]; then
|
||||
echoerror "Failed to create temporary file in /tmp"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
tempfile="/tmp/salt-gpg-$$.pub"
|
||||
fi
|
||||
tempfile="$(__temp_gpg_pub)"
|
||||
|
||||
__fetch_url "$tempfile" "$url" || return 1
|
||||
rpm --import "$tempfile" || return 1
|
||||
|
|
Loading…
Add table
Reference in a new issue