2
0

fix: cp use rsync

This commit is contained in:
zhangsz
2025-02-27 10:46:50 +08:00
parent c94e56a083
commit 93e9893b6a

View File

@@ -26,47 +26,50 @@ quickstart_file=${build_doc_dir}/03-WANFi软件快速安装.pdf
latest_tar_file=$(ls -t ${local_tars_rel_dir}/*${rel_date}* 2>/dev/null | head -n 1) latest_tar_file=$(ls -t ${local_tars_rel_dir}/*${rel_date}* 2>/dev/null | head -n 1)
latest_deb_file=$(ls -t ${local_debs_rel_dir}/*${rel_date}* 2>/dev/null | head -n 1) latest_deb_file=$(ls -t ${local_debs_rel_dir}/*${rel_date}* 2>/dev/null | head -n 1)
# Use expect to automatically answer yes and input password for SCP commands # Use expect to automatically answer yes and input password for rsync commands
if [ -n "${latest_deb_file}" ]; then if [ -n "${latest_deb_file}" ]; then
expect <<EOF expect <<EOF
spawn scp ${latest_deb_file} agtuser@${server_ip_205}:${debs_rel_dir_205} set timeout -1
expect { spawn rsync -avz ${latest_deb_file} agtuser@${server_ip_205}:${debs_rel_dir_205}
"yes/no" { expect {
send "yes\n" "yes/no" {
exp_continue send "yes\n"
} exp_continue
"password:" { send "$passwd\n" } }
} "password:" { send "$passwd\n" }
expect eof }
expect eof
EOF EOF
fi fi
if [ -n "${latest_tar_file}" ]; then if [ -n "${latest_tar_file}" ]; then
expect <<EOF expect <<EOF
spawn scp ${latest_tar_file} agtuser@${server_ip_205}:${tars_rel_dir_205} set timeout -1
expect { spawn rsync -avz ${latest_tar_file} agtuser@${server_ip_205}:${tars_rel_dir_205}
"yes/no" { expect {
send "yes\n" "yes/no" {
exp_continue send "yes\n"
} exp_continue
"password:" { send "$passwd\n" } }
} "password:" { send "$passwd\n" }
expect eof }
expect eof
EOF EOF
fi fi
if [ -f "${quickstart_file}" ]; then if [ -f "${quickstart_file}" ]; then
expect <<EOF expect <<EOF
spawn scp ${quickstart_file} agtuser@${server_ip_205}:${wfc_rel_dir_205} set timeout -1
expect { spawn rsync -avz ${quickstart_file} agtuser@${server_ip_205}:${wfc_rel_dir_205}
"yes/no" { expect {
send "yes\n" "yes/no" {
exp_continue send "yes\n"
} exp_continue
"password:" { send "$passwd\n" } }
} "password:" { send "$passwd\n" }
expect eof }
expect eof
EOF EOF
fi fi