forked from mirrored-repos/manjaro-tools
[deployiso] add ssh-agent support
This commit is contained in:
parent
084ef4267d
commit
a8e8ba6039
3 changed files with 26 additions and 0 deletions
|
@ -56,6 +56,7 @@ display_settings(){
|
|||
msg2 "account: %s" "${account}"
|
||||
msg2 "host: %s" "${host}"
|
||||
msg2 "alt_storage: %s" "${alt_storage}"
|
||||
msg2 "ssh_agentt: %s" "${ssh_agent}"
|
||||
|
||||
msg "UPLOAD QUEUE:"
|
||||
run show_profile "${build_list_iso}"
|
||||
|
|
|
@ -57,6 +57,9 @@
|
|||
# the server user
|
||||
# account=[SetUser]
|
||||
|
||||
# Set to 'true' to use ssh-agent to store passphrase.
|
||||
# ssh_agent=false
|
||||
|
||||
# use alternative storage server (one or the other might be more stable)
|
||||
# alt_storage=false
|
||||
|
||||
|
|
|
@ -42,6 +42,27 @@ prepare_transfer(){
|
|||
${hidden} && target_dir="${profile}/.${dist_release}"
|
||||
}
|
||||
|
||||
start_agent(){
|
||||
msg2 "Initializing SSH agent..."
|
||||
ssh-agent | sed 's/^echo/#echo/' > "$1"
|
||||
chmod 600 "$1"
|
||||
. "$1" > /dev/null
|
||||
ssh-add
|
||||
}
|
||||
|
||||
ssh_add(){
|
||||
local ssh_env="$USER_HOME/.ssh/environment"
|
||||
|
||||
if [ -f "${ssh_env}" ]; then
|
||||
. "${ssh_env}" > /dev/null
|
||||
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
|
||||
start_agent ${ssh_env};
|
||||
}
|
||||
else
|
||||
start_agent ${ssh_env};
|
||||
fi
|
||||
}
|
||||
|
||||
sync_dir(){
|
||||
cont=1
|
||||
max_cont=10
|
||||
|
@ -49,6 +70,7 @@ sync_dir(){
|
|||
|
||||
${torrent} && make_torrent
|
||||
${sign} && signiso "${src_dir}"
|
||||
${ssh_agent} && ssh_add
|
||||
|
||||
msg "Start upload [%s] to [%s] ..." "$1" "${project}"
|
||||
while [[ $cont -le $max_cont ]]; do
|
||||
|
|
Loading…
Reference in a new issue