summaryrefslogtreecommitdiff
path: root/get-authorized-keys
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-03-05 20:07:48 +0200
committerLars Wirzenius <liw@liw.fi>2022-03-05 20:47:36 +0200
commitbab489cdaec7c129d3ac5f088de9265106cf9114 (patch)
tree676c2cd629729847575ccf4c266297e6ec843d9b /get-authorized-keys
parent828be7f53844f39a5e1c48375a2b0846945211de (diff)
downloadv-i-bab489cdaec7c129d3ac5f088de9265106cf9114.tar.gz
feat: get root's authorized_keys file at boot up
Sponsored-by: author
Diffstat (limited to 'get-authorized-keys')
-rwxr-xr-xget-authorized-keys12
1 files changed, 12 insertions, 0 deletions
diff --git a/get-authorized-keys b/get-authorized-keys
new file mode 100755
index 0000000..8c24017
--- /dev/null
+++ b/get-authorized-keys
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+set -euo pipefail
+
+if [ ! -e /root/.ssh/authorized_keys ]; then
+ if mount -r LABEL=v-i-config /mnt; then
+ if [ -e /mnt/authorized_keys ]; then
+ cp /mnt/authorized_keys /root/.ssh/authorized_keys
+ fi
+ umount /mnt
+ fi
+fi