Don't complain about GPG_AGENT_INFO if using newer gpg-agent (#189)
This commit is contained in:
committed by
Tom Limoncelli
parent
dd0234874b
commit
5a05be06c7
@@ -681,3 +681,20 @@ function vcs_notice_generic_file() {
|
|||||||
echo "WARNING: If so, manually update the ignore file"
|
echo "WARNING: If so, manually update the ignore file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gpg_agent_version_check() {
|
||||||
|
if ! hash 'gpg-agent' &> /dev/null; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
local gpg_agent_version=$(gpg-agent --version | head -1 | awk '{ print $3 }' | tr -d '\n')
|
||||||
|
semverLT $gpg_agent_version "2.1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
function gpg_agent_notice() {
|
||||||
|
if [[ $(gpg_agent_version_check) == '0' && -z $GPG_AGENT_INFO ]];then
|
||||||
|
echo 'WARNING: You probably want to run gpg-agent as'
|
||||||
|
echo 'you will be asked for your passphrase many times.'
|
||||||
|
echo 'Example: $ eval $(gpg-agent --daemon)'
|
||||||
|
read -r -p 'Press CTRL-C now to stop. ENTER to continue: '
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
@@ -180,3 +180,109 @@ function fail_if_in_root_directory() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function semverParseInto() {
|
||||||
|
local RE='[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z-]*\)'
|
||||||
|
#MAJOR
|
||||||
|
eval $2=`echo $1 | sed -e "s#$RE#\1#"`
|
||||||
|
#MINOR
|
||||||
|
eval $3=`echo $1 | sed -e "s#$RE#\2#"`
|
||||||
|
#MINOR
|
||||||
|
eval $4=`echo $1 | sed -e "s#$RE#\3#"`
|
||||||
|
#SPECIAL
|
||||||
|
eval $5=`echo $1 | sed -e "s#$RE#\4#"`
|
||||||
|
}
|
||||||
|
|
||||||
|
function semverEQ() {
|
||||||
|
local MAJOR_A=0
|
||||||
|
local MINOR_A=0
|
||||||
|
local PATCH_A=0
|
||||||
|
local SPECIAL_A=0
|
||||||
|
|
||||||
|
local MAJOR_B=0
|
||||||
|
local MINOR_B=0
|
||||||
|
local PATCH_B=0
|
||||||
|
local SPECIAL_B=0
|
||||||
|
|
||||||
|
semverParseInto $1 MAJOR_A MINOR_A PATCH_A SPECIAL_A
|
||||||
|
semverParseInto $2 MAJOR_B MINOR_B PATCH_B SPECIAL_B
|
||||||
|
|
||||||
|
if [ $MAJOR_A -ne $MAJOR_B ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $MINOR_A -ne $MINOR_B ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $PATCH_A -ne $PATCH_B ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "_$SPECIAL_A" != "_$SPECIAL_B" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function semverLT() {
|
||||||
|
local MAJOR_A=0
|
||||||
|
local MINOR_A=0
|
||||||
|
local PATCH_A=0
|
||||||
|
local SPECIAL_A=0
|
||||||
|
|
||||||
|
local MAJOR_B=0
|
||||||
|
local MINOR_B=0
|
||||||
|
local PATCH_B=0
|
||||||
|
local SPECIAL_B=0
|
||||||
|
|
||||||
|
semverParseInto $1 MAJOR_A MINOR_A PATCH_A SPECIAL_A
|
||||||
|
semverParseInto $2 MAJOR_B MINOR_B PATCH_B SPECIAL_B
|
||||||
|
|
||||||
|
if [ $MAJOR_A -lt $MAJOR_B ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $MAJOR_A -le $MAJOR_B && $MINOR_A -lt $MINOR_B ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $MAJOR_A -le $MAJOR_B && $MINOR_A -le $MINOR_B && $PATCH_A -lt $PATCH_B ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "_$SPECIAL_A" == "_" ]] && [[ "_$SPECIAL_B" == "_" ]] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [[ "_$SPECIAL_A" == "_" ]] && [[ "_$SPECIAL_B" != "_" ]] ; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [[ "_$SPECIAL_A" != "_" ]] && [[ "_$SPECIAL_B" == "_" ]] ; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "_$SPECIAL_A" < "_$SPECIAL_B" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function semverGT() {
|
||||||
|
semverEQ $1 $2
|
||||||
|
local EQ=$?
|
||||||
|
|
||||||
|
semverLT $1 $2
|
||||||
|
local LT=$?
|
||||||
|
|
||||||
|
if [ $EQ -ne 0 ] && [ $LT -ne 0 ]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,7 @@
|
|||||||
export PATH=/usr/bin:/bin:"$PATH"
|
export PATH=/usr/bin:/bin:"$PATH"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
source "${0%/*}/_blackbox_common.sh"
|
||||||
|
|
||||||
if [[ -z $GPG_AGENT_INFO ]]; then
|
gpg_agent_notice
|
||||||
eval $(gpg-agent --daemon)
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec blackbox_postdeploy "$@"
|
exec blackbox_postdeploy "$@"
|
||||||
|
|||||||
@@ -7,13 +7,7 @@
|
|||||||
set -e
|
set -e
|
||||||
source "${0%/*}/_blackbox_common.sh"
|
source "${0%/*}/_blackbox_common.sh"
|
||||||
|
|
||||||
if [[ -z $GPG_AGENT_INFO ]]; then
|
gpg_agent_notice
|
||||||
echo 'WARNING: You probably want to run gpg-agent as'
|
|
||||||
echo 'you will be asked for your passphrase many times.'
|
|
||||||
echo 'Example: $ eval $(gpg-agent --daemon)'
|
|
||||||
read -r -p 'Press CTRL-C now to stop. ENTER to continue: '
|
|
||||||
fi
|
|
||||||
|
|
||||||
prepare_keychain
|
prepare_keychain
|
||||||
|
|
||||||
modified_files=()
|
modified_files=()
|
||||||
|
|||||||
@@ -7,13 +7,7 @@
|
|||||||
set -e
|
set -e
|
||||||
source "${0%/*}/_blackbox_common.sh"
|
source "${0%/*}/_blackbox_common.sh"
|
||||||
|
|
||||||
if [[ -z $GPG_AGENT_INFO ]]; then
|
gpg_agent_notice
|
||||||
echo 'WARNING: You probably want to run gpg-agent as'
|
|
||||||
echo 'you will be asked for your passphrase many times.'
|
|
||||||
echo 'Example: $ eval $(gpg-agent --daemon)'
|
|
||||||
read -r -p 'Press CTRL-C now to stop. ENTER to continue: '
|
|
||||||
fi
|
|
||||||
|
|
||||||
disclose_admins
|
disclose_admins
|
||||||
prepare_keychain
|
prepare_keychain
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,7 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
fail_if_not_in_repo
|
fail_if_not_in_repo
|
||||||
|
gpg_agent_notice
|
||||||
if [[ -z $GPG_AGENT_INFO ]]; then
|
|
||||||
echo 'WARNING: You probably want to run gpg-agent as'
|
|
||||||
echo 'you will be asked for your passphrase many times.'
|
|
||||||
echo 'Example: $ eval $(gpg-agent --daemon)'
|
|
||||||
read -r -p 'Press CTRL-C now to stop. ENTER to continue: '
|
|
||||||
fi
|
|
||||||
|
|
||||||
COLUMNS=`tput cols`
|
COLUMNS=`tput cols`
|
||||||
FILE=$1
|
FILE=$1
|
||||||
|
|||||||
Reference in New Issue
Block a user