Merge branch 'master' of github.com:carlroth/OpenNetworkLinux

This commit is contained in:
Jeffrey Townsend
2016-11-30 19:34:27 -08:00
4 changed files with 25 additions and 5 deletions

View File

@@ -168,6 +168,12 @@ class App(SubprocessMixin, object):
##self.grubEnv = ConfUtils.GrubEnv(log=self.log.getChild("grub"))
with OnieBootContext(log=self.log) as self.octx:
self.octx.ictx.attach()
self.octx.ictx.unmount()
self.octx.ictx.detach()
# XXX roth -- here, detach the initrd mounts
self.octx.detach()
if self.octx.onieDir is not None:

View File

@@ -834,7 +834,7 @@ class InitrdContext(SubprocessMixin):
return self
def shutdown(self):
def unmount(self):
p = ProcMountsParser()
if self.dir is not None:
@@ -852,6 +852,10 @@ class InitrdContext(SubprocessMixin):
cmd = ('umount', p,)
self.check_call(cmd, vmode=self.V1)
def shutdown(self):
self.unmount()
if self.initrd and self.dir:
self.log.debug("cleaning up chroot in %s", self.dir)
self.rmtree(self.dir)

View File

@@ -189,11 +189,20 @@ class OnieBootContext:
def shutdown(self):
ctx, self.fctx = self.fctx, None
if ctx is not None: ctx.shutdown()
if ctx is not None:
ctx.shutdown()
ctx.attach()
ctx.shutdown()
ctx, self.ictx = self.ictx, None
if ctx is not None: ctx.shutdown()
if ctx is not None:
ctx.shutdown()
ctx.attach()
ctx.shutdown()
ctx, self.dctx = self.dctx, None
if ctx is not None: ctx.shutdown()
if ctx is not None:
ctx.shutdown()
ctx.attach()
ctx.shutdown()
def __exit__(self, eType, eValue, eTrace):
self.shutdown()

View File

@@ -32,7 +32,8 @@ class UpgradeHelper(Upgrader):
def _runInitrdShell(self, p):
if self.callback is not None:
self.callback(self, p)
return self.callback(self, p)
return 0
class App(SubprocessMixin):