[lxc-devel] [lxc/master] templates/ubuntu: conditionally move upstart ssh job, as it is now op…

xnox on Github lxc-bot at linuxcontainers.org
Tue Aug 29 14:13:27 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 355 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170829/df9535b1/attachment.bin>
-------------- next part --------------
From ed6c81c881c0d2dfbae1cdbc4e2e33968eaf4625 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <xnox at ubuntu.com>
Date: Tue, 29 Aug 2017 15:11:55 +0100
Subject: [PATCH] templates/ubuntu: conditionally move upstart ssh job, as it
 is now optional.

Mimic the code from the debian template.
---
 templates/lxc-ubuntu.in | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
index 7fc3e5132..dee136f2a 100644
--- a/templates/lxc-ubuntu.in
+++ b/templates/lxc-ubuntu.in
@@ -152,13 +152,20 @@ exit 101
 EOF
         chmod +x $rootfs/usr/sbin/policy-rc.d
 
+        if [ -f "$rootfs/etc/init/ssh.conf" ]; then
+            mv "$rootfs/etc/init/ssh.conf" "$rootfs/etc/init/ssh.conf.disabled"
+        fi
+
         rm -f $rootfs/etc/ssh/ssh_host_*key*
-        mv $rootfs/etc/init/ssh.conf $rootfs/etc/init/ssh.conf.disabled
+
         DPKG_MAINTSCRIPT_PACKAGE=openssh DPKG_MAINTSCRIPT_NAME=postinst chroot $rootfs /var/lib/dpkg/info/openssh-server.postinst configure
-        mv $rootfs/etc/init/ssh.conf.disabled $rootfs/etc/init/ssh.conf
 
         sed -i "s/root@$(hostname)/root@$hostname/g" $rootfs/etc/ssh/ssh_host_*.pub
 
+        if [ -f "$rootfs/etc/init/ssh.conf.disabled" ]; then
+            mv "$rootfs/etc/init/ssh.conf.disabled" "$rootfs/etc/init/ssh.conf"
+        fi
+
         rm -f $rootfs/usr/sbin/policy-rc.d
     fi
 


More information about the lxc-devel mailing list