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_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
expect <<EOF
spawn scp ${latest_deb_file} agtuser@${server_ip_205}:${debs_rel_dir_205}
expect {
"yes/no" {
send "yes\n"
exp_continue
}
"password:" { send "$passwd\n" }
}
expect eof
expect <<EOF
set timeout -1
spawn rsync -avz ${latest_deb_file} agtuser@${server_ip_205}:${debs_rel_dir_205}
expect {
"yes/no" {
send "yes\n"
exp_continue
}
"password:" { send "$passwd\n" }
}
expect eof
EOF
fi
if [ -n "${latest_tar_file}" ]; then
expect <<EOF
spawn scp ${latest_tar_file} agtuser@${server_ip_205}:${tars_rel_dir_205}
expect {
"yes/no" {
send "yes\n"
exp_continue
}
"password:" { send "$passwd\n" }
}
expect eof
expect <<EOF
set timeout -1
spawn rsync -avz ${latest_tar_file} agtuser@${server_ip_205}:${tars_rel_dir_205}
expect {
"yes/no" {
send "yes\n"
exp_continue
}
"password:" { send "$passwd\n" }
}
expect eof
EOF
fi
if [ -f "${quickstart_file}" ]; then
expect <<EOF
spawn scp ${quickstart_file} agtuser@${server_ip_205}:${wfc_rel_dir_205}
expect {
"yes/no" {
send "yes\n"
exp_continue
}
"password:" { send "$passwd\n" }
}
expect eof
expect <<EOF
set timeout -1
spawn rsync -avz ${quickstart_file} agtuser@${server_ip_205}:${wfc_rel_dir_205}
expect {
"yes/no" {
send "yes\n"
exp_continue
}
"password:" { send "$passwd\n" }
}
expect eof
EOF
fi