Update 2023-10-30 20:13 OpenBSD/amd64-x13

This commit is contained in:
c0dev0id
2023-10-30 20:13:00 +01:00
parent 35a131fe79
commit 09f9fd0045
14 changed files with 56 additions and 2453 deletions

View File

@@ -1,8 +1,9 @@
#!/bin/sh
. $HOME/.bin/_config
PSSH="${USER}@${DOMAIN}"
LOC="p"
RPATH=/home/sdk/make-web/src/paste
SSH="sdk@home.codevoid.de"
WEB="https://home.codevoid.de/paste"
f="$1"
if [ "$1" = "-h" ]; then
@@ -14,42 +15,18 @@ if [ "$1" = "-h" ]; then
fi
if [ -z "$1" ]; then
f="$(date +"%Y-%m-%d_%M-%S")-$(pwgen -1 4 -A -0).txt"
ssh ${PSSH} "printf \"%s\" \"$(cat)\" > ${RPATH}/${LOC}/$f"
ssh ${SSH} "printf \"%s\" \"$(cat)\" > ${RPATH}/$f"
elif [ -f "$f" ]; then
scp "$f" ${PSSH}:"${RPATH}/${LOC}/${f##*/}"
scp "$f" ${SSH}:"${RPATH}/${f##*/}"
else
ssh ${PSSH} "printf \"%s\n\" \"$(cat)\" > ${RPATH}/${LOC}/${f##*/}"
ssh ${SSH} "printf \"%s\n\" \"$(cat)\" > ${RPATH}/${f##*/}"
fi
SELECTOR="9"
# if data comes from stdin
if [ ! -t 0 ]; then
# it's always 0
SELECTOR="0"
else
# if a parmeter is given and it's a file
if [ -f "$f" ]; then
# determine type and set selector
case "$(file --mime-type -b "$f")" in
image/*) SELECTOR="I";;
text/*) SELECTOR="0";;
message/*) SELECTOR="0";;
*/x-shellscript) SELECTOR="0";;
*/pgp-keys) SELECTOR="0";;
esac
else
# parameter given, but not a file, must be cat then...
SELECTOR=0
fi
fi
ssh sdk@home.codevoid.de "cd ~/make-web && make install"
printf "https://${DOMAIN}/${SELECTOR}/${LOC}/${f##*/}\n"
printf "https://${DOMAIN}/${SELECTOR}/${LOC}/${f##*/}" | xclip
# write paste history (for convenience and rmpaste)
printf "$(date +"%Y-%m-%d %M:%S")|$f\n" \
| ssh -q $PSSH "cat - >> $RPATH/${LOC}/.pastehistory"
printf "${WEB}/${f##*/}\n"
printf "${WEB}/${f##*/}" | xclip
[ -z $DISPLAY ] || notify-send "$(xclip -o)"