[gnome-ostree] Revert guestfish.js lockfile changes



commit ab7ecff52bef2482e37480c83aca2af27cf0e816
Author: Colin Walters <walters verbum org>
Date:   Mon Jan 14 17:54:17 2013 -0500

    Revert guestfish.js lockfile changes
    
    This reverts commit d1b6dfceec92990338b87f0f73ff0d109cf0ea9c.
    This reverts commit e0a46ee5669fb2305a5bccf1661df7b3654a65c2.
    
    Actually, we need this...we'll just have to wait for RHEL 6.4 to be
    released to use it on the build server.

 src/ostbuild/js/guestfish.js |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/ostbuild/js/guestfish.js b/src/ostbuild/js/guestfish.js
index 1556807..9f057c8 100644
--- a/src/ostbuild/js/guestfish.js
+++ b/src/ostbuild/js/guestfish.js
@@ -88,7 +88,9 @@ const GuestMount = new Lang.Class({
 	this._lock();
 	try {
 	    this._mntdir = mntdir;
-	    let guestmountArgv = ['guestmount', '-o', 'allow_root'];
+	    this._mountPidFile = mntdir.get_parent().get_child(mntdir.get_basename() + '.guestmount-pid');
+	    let guestmountArgv = ['guestmount', '-o', 'allow_root',
+				  '--pid-file', this._mountPidFile.get_path()];
 	    this._appendOpts(guestmountArgv);
 	    guestmountArgv.push(mntdir.get_path());
             let context = new GSystem.SubprocessContext({ argv: guestmountArgv });
@@ -111,6 +113,12 @@ const GuestMount = new Lang.Class({
 	if (!this._mounted)
 	    return;
 
+        let pidStr = GSystem.file_load_contents_utf8(this._mountPidFile, cancellable);
+        if (pidStr.length == 0) {
+	    this._mounted = false;
+	    return;
+	}
+
         for (let i = 0; i < 30; i++) {
             // See "man guestmount" for why retry loops here might be needed if this
             // script is running on a client machine with programs that watch for new mounts



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]