Boot-config installation is optional.

This commit is contained in:
Jeffrey Townsend
2016-11-09 21:18:17 +00:00
parent 2ad51228d9
commit 48689e3d98
2 changed files with 23 additions and 11 deletions

View File

@@ -102,7 +102,7 @@ class Base:
src = os.path.join(self.im.installerConf.installer_dir, basename)
if os.path.exists(src):
self.copy2(src, dst)
return
return True
if basename in self.zf.namelist():
self.log.debug("+ unzip -p %s %s > %s",
@@ -110,11 +110,13 @@ class Base:
with self.zf.open(basename, "r") as rfd:
with open(dst, "wb") as wfd:
shutil.copyfileobj(rfd, wfd)
return
return True
if not optional:
raise ValueError("missing installer file %s" % basename)
return False
def installerDd(self, basename, device):
p = os.path.join(self.im.installerConf.installer_dir, basename)
@@ -354,7 +356,10 @@ class Base:
basename = 'boot-config'
with MountContext(dev.device, log=self.log) as ctx:
dst = os.path.join(ctx.dir, basename)
self.installerCopy(basename, dst)
if not self.installerCopy(basename, dst, True):
return
with open(dst) as fd:
buf = fd.read()

View File

@@ -85,9 +85,13 @@ class App(SubprocessMixin):
# constitute an /etc/onl/installer.conf in place
installerConf = InstallerConf(path="/dev/null")
with open("/etc/onl/loader/versions.json") as fd:
data = json.load(fd)
installerConf.onl_version = data['VERSION_ID']
vj = "/etc/onl/loader/versions.json"
if os.path.exists(vj):
with open(vj) as fd:
data = json.load(fd)
installerConf.onl_version = data['VERSION_ID']
else:
installerConf.onl_version = "unknown"
installerConf.installer_dir = chroot_idir
@@ -146,11 +150,14 @@ class App(SubprocessMixin):
self.log.debug("+ /bin/cp %s %s", src, dst)
shutil.copy2(src, dst)
with OnlMountContextReadWrite('ONL-BOOT', logger=self.log) as octx:
src = os.path.join(octx.directory, "boot-config")
dst = os.path.join(abs_idir, "boot-config")
self.log.debug("+ /bin/cp %s %s", src, dst)
shutil.copy2(src, dst)
#
# Disable until a system for boot-config upgrade is implemented.
# with OnlMountContextReadWrite('ONL-BOOT', logger=self.log) as octx:
# src = os.path.join(octx.directory, "boot-config")
# dst = os.path.join(abs_idir, "boot-config")
# self.log.debug("+ /bin/cp %s %s", src, dst)
# shutil.copy2(src, dst)
#
# chroot to the onl-install script
##cmd = ('chroot', ctx.dir,