mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
iop: ssh_upgrade: Use ssh instead of scp
Use SSH with a pipe to transfer the file and invoke sysupgrade in one go. Using SSH instead of SCP gives a higher throughput (not very noticable for small files like the ones we use for sysupgrade, though), but using only one command invocation saves a significant overhead of TCP and SSH connection setup. The main reason for this change is though that OpenSSH 9.0 and later use SFTP instead of the scp protocol when using the scp command in an effort of deprecating the very clunky legacy SCP protocol. One can use scp -O to continue using scp, but switching to ssh only has other benefits outlined above. Signed-off-by: Andreas Gnau <andreas.gnau@iopsys.eu>
This commit is contained in:
parent
3a7d8b1c51
commit
0078265697
1 changed files with 6 additions and 3 deletions
|
|
@ -285,9 +285,12 @@ function ssh_upgrade {
|
|||
[ $upd_noreboot -eq 1 ] && extra_args="$extra_args -d"
|
||||
[ $upd_keepconf -eq 0 ] && extra_args="$extra_args -n"
|
||||
|
||||
scp $upd_fw root@$upd_host:/tmp/ &&
|
||||
ssh -o ConnectTimeout=60 root@$upd_host "sysupgrade -v $extra_args /tmp/$upd_fw_base" &&
|
||||
echo "sysupgrade done!"
|
||||
pv "$upd_fw" |
|
||||
ssh \
|
||||
-o ConnectTimeout=60 \
|
||||
root@"$upd_host" \
|
||||
sh -c "cat > '/tmp/$upd_fw_base' && (set -x && sysupgrade -v $extra_args /tmp/$upd_fw_base)" ||
|
||||
echo "Sysupgrade failed" >&2 && return 1
|
||||
}
|
||||
|
||||
register_command "ssh_upgrade" "-h <host> -f <file> [opts] Install firmware on remote host with SSH"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue