Implement Wallboard Display Toggle with Automations

Tá an tiomantas seo le fáil i:
Florian Brinker
2019-10-22 20:40:01 +02:00
tuismitheoir 31786e6658
tiomantas 2b83cf6374
D'athraigh 7 comhad le 119 breiseanna agus 9 scriosta

28
scripts/install-wallboard-sshkey.sh Comhad infheidhmithe
Féach ar an gComhad

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
DIR=$(dirname "$(readlink -f "$0")")
KEYFILE="$DIR/../ssh-key/homeassistant-wallboard-hdmi-sshkey"
TARGET="~/.ssh/authorized_keys"
if [ $# == 0 ] ; then
echo "Usage: install-wallboard-hdmi-sshkey.sh user@wallboard-ip"
exit 1;
fi
if [ ! -f $KEYFILE ]; then
echo "You need to create the SSH-Key-File first: \"$KEYFILE\""
echo "Use: \"ssh-keygen -t ed25519 -C homeassistant-wallboard-hdmi-sshkey -f $KEYFILE\""
exit 1
fi
SSHKEY=$(<"$KEYFILE.pub")
echo "command=\"vcgencmd \$SSH_ORIGINAL_COMMAND\" $SSHKEY" | ssh $1 '\
mkdir -p .ssh && \
chmod 700 .ssh && \
touch .ssh/authorized_keys && \
chmod 600 .ssh/authorized_keys && \
tee -a .ssh/authorized_keys \
' >/dev/null
echo "Installed the ssh key into \"$1:$TARGET\"."