Skip to content

Commit

Permalink
templates/ubuntu: conditionally move upstart ssh job, as it is now op…
Browse files Browse the repository at this point in the history
…tional.

Mimic the code from the debian template.

Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
  • Loading branch information
xnox authored and stgraber committed Aug 29, 2017
1 parent 72a4673 commit d99d8db
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions templates/lxc-ubuntu.in
Expand Up @@ -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

Expand Down

0 comments on commit d99d8db

Please sign in to comment.