diff options
-rwxr-xr-x | install | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -12,13 +12,13 @@ from __future__ import print_function from DysonInstaller.hdd import HDD from DysonInstaller.snack import * -from DysonInstaller.Network import * from snack import * from subprocess import Popen, PIPE, call from pprint import pprint from tempfile import mkstemp, mkdtemp from urllib2 import urlopen, URLError, HTTPError from time import sleep +from fnmatch import fnmatch from os.path import basename, exists import os import re @@ -788,6 +788,33 @@ def configure_nodename(): except: pass +def configure_smf(): + ''' Populate SMF repository. + We could start svccfg and write all commands to its stdin. + It is fast, but actual execution of import is slow for each manifest. + So we start svccfg for each manifest to be able to show real progress. + /proc and /devices must be mounted in chroot env. + ''' + try: + manifests = [] + os.chdir(rootdir) + for root, dirs, files in os.walk('lib/svc/manifest'): + manifests += [ os.path.join('/', root, xml) for xml in files if fnmatch(xml, '*.xml')] + progress = ProgressBar(screen, title='Configuring SMF repository', width=70, + text='Importing SMF manifests ...', top=len(manifests)) + for m in manifests: + progress.text = 'Importing ' + m + progress.advance() + svccfg_cmd = Popen(['/usr/sbin/chroot', rootdir, '/usr/sbin/svccfg', 'import', m], + stderr=PIPE, stdout=PIPE, stdin=PIPE, + env={'SVCCFG_REPOSITORY':'/etc/svc/repository.db'}) + svccfg_cmd.communicate() + svccfg_cmd.wait() + except: + pass + + + def configure_packages(): screen.suspend() call(['chroot', rootdir, '/usr/sbin/dpkg-reconfigure', 'tzdata', 'locales'], stderr=PIPE) @@ -836,6 +863,7 @@ def configure_bootenv(): pass set_root_password() create_bootarchive() + configure_smf() def slice4grub(s): |