changelog/plugins-available/content-hastebin.sh
2020-05-18 01:10:06 +02:00

17 lines
717 B
Bash

#!/bin/bash
# Sends the changelog information to a changelog server
# see https://git.interhacker.space/alban/changelog-server
# Requires an environmental variable to work
# ex: HASTEBIN_SERVER=https://paste.interhacker.space
PLUGIN_CONTENT+=( hookContentHastebin )
hookContentHastebin(){
[[ -z "$1" ]] && echo "Store a file by name in pastebin" && return
[[ -z "$HASTEBIN_SERVER" ]] && echo "Missing HASTEBIN_SERVER variable. Exiting." && return
TMP="$1"
read -e -p "File location? " FILE
[[ ! -f $FILE ]] && panic "Not a valid file" && exit
URL=$( curl -X POST -s -d "$(cat "$FILE" )" "$HASTEBIN_SERVER/documents" | awk -F '"' '{print "'$HASTEBIN_SERVER'/raw/"$4}'; )
echo "$FILE: $URL" >> $TMP
}