17 lines
398 B
Bash
17 lines
398 B
Bash
|
#!/bin/sh
|
||
|
set -xeuo pipefail
|
||
|
|
||
|
TMP_FILE=".ssh/authorized_keys.tmp"
|
||
|
CMD="$HOME/wol.sh"
|
||
|
|
||
|
|
||
|
truncate --size 0 $TMP_FILE
|
||
|
for target in $(cat operators | sed 's/curl \([^ ]*\).gpg .*/\1.keys/'); do
|
||
|
curl "$target" | sed 's#.*#command="'"$CMD"'" \0 '"$target"'#' >> $TMP_FILE
|
||
|
done
|
||
|
|
||
|
cat additional_keys | sed 's#.*#command="'"$CMD"'" \0#' >> $TMP_FILE
|
||
|
|
||
|
chmod 600 $TMP_FILE
|
||
|
mv $TMP_FILE .ssh/authorized_keys
|