kexec-installer: also support authorized_keys2

This commit is contained in:
Jörg Thalheim 2022-11-25 10:13:32 +01:00
parent 65227bf951
commit 483c55c0ab

View file

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