commit: c3419bb48a72395a829b68722f08af135a7473b2
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 20:18:00 2024 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 20:30:58 2024 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=c3419bb4
First shot at sshd image
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
catalyst/targets/diskimage_stage2.py | 1 +
targets/support/diskimagefs-update.sh | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/catalyst/targets/diskimage_stage2.py
b/catalyst/targets/diskimage_stage2.py
index bcad8b0d..8fab976d 100644
--- a/catalyst/targets/diskimage_stage2.py
+++ b/catalyst/targets/diskimage_stage2.py
@@ -33,6 +33,7 @@ class diskimage_stage2(StageBase):
"diskimage/readme",
"diskimage/rm",
"diskimage/type", # generic, cloud-init, ssh, console
+ "diskimage/sshkey",
"diskimage/unmerge",
"diskimage/users",
"diskimage/verify",
diff --git a/targets/support/diskimagefs-update.sh
b/targets/support/diskimagefs-update.sh
index 5204a31f..79277618 100755
--- a/targets/support/diskimagefs-update.sh
+++ b/targets/support/diskimagefs-update.sh
@@ -27,6 +27,13 @@ DHCP=yes
END
}
+configure_sshd() {
+ echo "Configuring sshd"
+ mkdir -vp /root/.ssh
+ chown root:root /root/.ssh
+ echo "${clst_diskimage_sshkey}" > /root/.ssh/authorized_keys
+}
+
echo "Generating /etc/locale.gen"
cat > /etc/locale.gen <<END
en_US ISO-8859-1
@@ -58,6 +65,15 @@ case ${clst_diskimage_type} in
systemd-firstboot --timezone=UTC || die "Failed running
systemd-firstboot"
configure_dhcp
;;
+ ssh)
+ echo "Setting up ssh log-in image, using key ${xxx}"
+ echo "Running systemd-firstboot"
+ systemd-firstboot --timezone=UTC || die "Failed running
systemd-firstboot"
+ configure_dhcp
+ configure_sshd
+ echo "Adding sshd service"
+ systemctl enable sshd
+ ;;
*)
die "As yet unsupported image type"
;;