Only install gen-hostkeys when sshd is installed

This commit is contained in:
Anders Ingemann 2013-10-06 13:20:39 +02:00
parent 54791268e1
commit d4601f08af

View file

@ -1,5 +1,6 @@
from base import Task
from common import phases
from common.tools import log_check_call
import os.path
@ -10,9 +11,15 @@ class ResolveInitScripts(Task):
def run(self, info):
init_scripts = {'expand-volume': 'expand-volume'}
from subprocess import CalledProcessError
try:
log_check_call(['/usr/sbin/chroot', info.root,
'/usr/bin/dpkg-query', '-W', 'openssh-server'])
init_scripts['generate-ssh-hostkeys'] = 'generate-ssh-hostkeys'
if info.manifest.system['release'] == 'squeeze':
init_scripts['generate-ssh-hostkeys'] = 'squeeze/generate-ssh-hostkeys'
except CalledProcessError:
pass
disable_scripts = ['hwclock.sh']
if info.manifest.system['release'] == 'squeeze':
@ -37,7 +44,6 @@ class InstallInitScripts(Task):
stat.S_IRGRP | stat.S_IXGRP |
stat.S_IROTH | stat.S_IXOTH)
from shutil import copy
from common.tools import log_check_call
for name, src in info.initd['install'].iteritems():
dst = os.path.join(info.root, 'etc/init.d', name)
copy(src, dst)