summaryrefslogtreecommitdiff
path: root/scripts/generate-authorized_keys
blob: 21d182ef50e3eb15cdf57d967c1bde3df71f8814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

cd "${0%/*}/.."

rm -rf --one-file-system out
mkdir out

for host in hosts/*; do
  [ "${host#*/}" = 'all' ] && continue

  cat "${host}" "hosts/${host#*@}" 'hosts/all' \
  2>/dev/null \
  | sed '
    s@^@pubkeys/@
    s@$@.pub@
  ' \
  | xargs -r cat
  >"out/${host}.authorized_keys"
done