Merge pull request #30 from nix-community/ssh-keys

kexec-installer: also support authorized_keys2
This commit is contained in:
Jörg Thalheim 2022-11-25 10:15:07 +01:00 committed by GitHub
commit dbdd253ae2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,10 +19,13 @@
pwd
mkdir -p initrd/ssh
pushd initrd
if [ -e /root/.ssh/authorized_keys ]; then
# workaround for debian shenanigans
grep -o '\(ssh-[^ ]* .*\)' /root/.ssh/authorized_keys >> ssh/authorized_keys
fi
for key in /root/.ssh/authorized_keys /root/.ssh/authorized_keys2; do
if [ -e "$key" ]; then
# workaround for debian shenanigans
grep -o '\(ssh-[^ ]* .*\)' "$key" >> ssh/authorized_keys
fi
done
# Typically for NixOS
if [ -e /etc/ssh/authorized_keys.d/root ]; then
cat /etc/ssh/authorized_keys.d/root >> ssh/authorized_keys
fi