only copy authorized_keys if it exists

This commit is contained in:
Gavin Li 2015-04-20 04:18:24 -07:00
parent 29f9ac51b7
commit d014a2433e
1 changed files with 5 additions and 3 deletions

View File

@ -394,9 +394,11 @@ postbootstrap_configuration() {
fi
# authorized_keys of root will be copied anyway
mkdir -p /archroot/root/.ssh/
chmod 700 /archroot/root/.ssh/
cp -p /root/.ssh/authorized_keys /archroot/root/.ssh/authorized_keys
if [ -e /root/.ssh/authorized_keys ]; then
mkdir -p /archroot/root/.ssh/
chmod 700 /archroot/root/.ssh/
cp -p /root/.ssh/authorized_keys /archroot/root/.ssh/authorized_keys
fi
# setup machine id
chroot /archroot systemd-machine-id-setup