dch-autoprovision/notify-online.sh

24 lines
505 B
Bash

#!/bin/sh
set -- \
-F "hostname=$(hostname -f)" \
-F 'sshkeys=<-;type=text/plain'
fw_cfg=/sys/firmware/qemu_fw_cfg/by_name/opt/dch/cfg-branch/raw
if [ -r "${fw_cfg}" ]; then
set -- "$@" -F branch="$(cat "${fw_cfg}")"
fi
set -- "$(cat /proc/cmdline)"
while [ $# -gt 0 ]; do
case "$1" in
dch.cfg-branch=*)
set -- "$@" -F branch="${1#*=}"
;;
esac
shift
done
cat /etc/ssh/ssh_host_*_key.pub \
| curl -fsS https://webhooks.pyrocufflink.blue/host/online "$@"