]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
templates/ubuntu: conditionally move upstart ssh job, as it is now optional.
authorDimitri John Ledkov <xnox@ubuntu.com>
Tue, 29 Aug 2017 14:11:55 +0000 (15:11 +0100)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 29 Aug 2017 18:15:33 +0000 (14:15 -0400)
Mimic the code from the debian template.

Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
templates/lxc-ubuntu.in

index a397a1dc4234d7eec6e0dc383d0e620aee388148..dba21066975d351c975fe8e9ba02cb04cc5698b2 100644 (file)
@@ -115,13 +115,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