Update 2024-12-23 18:34 OpenBSD/amd64-t14

This commit is contained in:
c0dev0id 2024-12-23 18:34:22 +01:00
parent 1bb57985ca
commit ec7fbad49f

View File

@ -1,7 +1,12 @@
#!/bin/sh -e #!/bin/sh -e
# manage files in a webroot # 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 ### CONFIGURATION
@ -110,6 +115,7 @@ then
ssh $_sshhost \ ssh $_sshhost \
"cd $_rpath/ \ "cd $_rpath/ \
&& mv -v \"$1\" \"$2\"" && mv -v \"$1\" \"$2\""
echo "$2" | remote_list_print
exit 0 exit 0
fi fi
@ -119,7 +125,8 @@ then
lastfile="$(remote_list | tail -1)" lastfile="$(remote_list | tail -1)"
ssh $_sshhost \ ssh $_sshhost \
"cd $_rpath/ \ "cd $_rpath/ \
&& mv -v \"$lastfile\" \"$2\"" && mv -v \"$lastfile\" \"$1\""
echo "$1" | remote_list_print
exit 0 exit 0
fi fi
@ -176,11 +183,11 @@ then
# target filename # target filename
file="$(basename "$item")$_ext" file="$(basename "$item")$_ext"
# CASE "file" "no archive" # CASE "file" "no archive mode"
if [ -f "$item" ] && [ -z "$_tgz" ] && [ -z "$_gz" ] if [ -f "$item" ] && [ -z "$_tgz" ] && [ -z "$_gz" ]
then then
echo "Uploading $item as $file" echo "Uploading $item as $file"
scp -q "$item" "$_sshhost:\"$_rpath/$file\"" scp -q "$item" $_sshhost:"$_rpath/$file"
copy_and_print "$file" copy_and_print "$file"
return return
fi fi
@ -196,7 +203,7 @@ then
# moving closer to the item to not archive the whole path # moving closer to the item to not archive the whole path
cd $(dirname "$item") cd $(dirname "$item")
tar czf - "$(basename "$item")" \ tar czf - "$(basename "$item")" \
| ssh $_sshhost "pv - > \"$_rpath/$file\"" | ssh $_sshhost "cat - > \"$_rpath/$file\""
copy_and_print "$file" copy_and_print "$file"
return return
fi fi
@ -207,7 +214,7 @@ then
file="$file.gz" file="$file.gz"
echo "Uploading \"$item\" as \"$file\"" echo "Uploading \"$item\" as \"$file\""
cat "$item" | gzip \ cat "$item" | gzip \
| ssh $_sshhost "pv - > \"$_rpath/$file\"" | ssh $_sshhost "cat - > \"$_rpath/$file\""
copy_and_print "$file" copy_and_print "$file"
return return
fi fi