From ec7fbad49fd3977c1af79a0d6d497144f784ea32 Mon Sep 17 00:00:00 2001 From: c0dev0id Date: Mon, 23 Dec 2024 18:34:22 +0100 Subject: [PATCH] Update 2024-12-23 18:34 OpenBSD/amd64-t14 --- .bin/upload | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.bin/upload b/.bin/upload index eee4526..8599ced 100755 --- a/.bin/upload +++ b/.bin/upload @@ -1,7 +1,12 @@ #!/bin/sh -e # manage files in a webroot -# needs: sh (cp,rm), openssh (ssh,scp), gzip, tar, sed, tail, xclip +# needs: +# - sh: cp, rm, mv, echo, basename, dirname +# - openssh: ssh, scp +# - coreutils: chmod, sed, tail +# - archivers: gzip, tar +# - xclip ### ### CONFIGURATION @@ -110,6 +115,7 @@ then ssh $_sshhost \ "cd $_rpath/ \ && mv -v \"$1\" \"$2\"" + echo "$2" | remote_list_print exit 0 fi @@ -119,7 +125,8 @@ then lastfile="$(remote_list | tail -1)" ssh $_sshhost \ "cd $_rpath/ \ - && mv -v \"$lastfile\" \"$2\"" + && mv -v \"$lastfile\" \"$1\"" + echo "$1" | remote_list_print exit 0 fi @@ -176,11 +183,11 @@ then # target filename file="$(basename "$item")$_ext" - # CASE "file" "no archive" + # CASE "file" "no archive mode" if [ -f "$item" ] && [ -z "$_tgz" ] && [ -z "$_gz" ] then echo "Uploading $item as $file" - scp -q "$item" "$_sshhost:\"$_rpath/$file\"" + scp -q "$item" $_sshhost:"$_rpath/$file" copy_and_print "$file" return fi @@ -196,7 +203,7 @@ then # moving closer to the item to not archive the whole path cd $(dirname "$item") tar czf - "$(basename "$item")" \ - | ssh $_sshhost "pv - > \"$_rpath/$file\"" + | ssh $_sshhost "cat - > \"$_rpath/$file\"" copy_and_print "$file" return fi @@ -207,7 +214,7 @@ then file="$file.gz" echo "Uploading \"$item\" as \"$file\"" cat "$item" | gzip \ - | ssh $_sshhost "pv - > \"$_rpath/$file\"" + | ssh $_sshhost "cat - > \"$_rpath/$file\"" copy_and_print "$file" return fi