From 8f58567a700e0283ee681acd7a790bc917a0c693 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 23 Jul 2024 11:05:51 -0400 Subject: [PATCH] Add ssh to default services of a built ubuntu image --- imgutil/imgutil | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/imgutil/imgutil b/imgutil/imgutil index 4ef06776..907a3b64 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -661,6 +661,12 @@ class DebHandler(OsHandler): run_constrainedx(fancy_chroot, (args, self.targpath)) args.cmd = ['apt-get', '-y', 'install'] + self.includepkgs run_constrainedx(fancy_chroot, (args, self.targpath)) + servicefile = os.path.join(self.targpath, 'usr/lib/systemd/system/ssh.service') + if os.path.exists(servicefile): + os.symlink('/usr/lib/systemd/system/ssh.service', os.path.join(self.targpath, 'etc/systemd/system/multi-user.target.wants/ssh.service')) + else: + os.symlink('/usr/lib/systemd/system/sshd.service', os.path.join(self.targpath, 'etc/systemd/system/multi-user.target.wants/sshd.service')) + class ElHandler(OsHandler):