[gnome-shell/wip/rstrode/login-screen-extensions: 53/134] extensionSystem: Install pending updates on startup




commit 748edd33c533b3944fe5fba66d20d1f04e3b11cf
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Jan 22 15:09:05 2020 +0100

    extensionSystem: Install pending updates on startup
    
    Now that we have a way to check for updates and download them, we
    should actually apply them as well. Do this on startup before any
    extensions are initialized, to make sure we don't run into any
    conflicts with a previously loaded version.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/945

 js/ui/extensionSystem.js | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index 93faf48d45..36a248dc16 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -1,6 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-const { Gio, St } = imports.gi;
+const { GLib, Gio, St } = imports.gi;
 const Signals = imports.signals;
 
 const ExtensionUtils = imports.misc.extensionUtils;
@@ -26,6 +26,7 @@ var ExtensionManager = class {
     }
 
     init() {
+        this._installExtensionUpdates();
         this._sessionUpdated();
     }
 
@@ -424,6 +425,21 @@ var ExtensionManager = class {
         }
     }
 
+    _installExtensionUpdates() {
+        FileUtils.collectFromDatadirs('extension-updates', true, (dir, info) => {
+            let fileType = info.get_file_type();
+            if (fileType !== Gio.FileType.DIRECTORY)
+                return;
+            let uuid = info.get_name();
+            let extensionDir = Gio.File.new_for_path(
+                GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
+
+            FileUtils.recursivelyDeleteDir(extensionDir, false);
+            FileUtils.recursivelyMoveDir(dir, extensionDir);
+            FileUtils.recursivelyDeleteDir(dir, true);
+        });
+    }
+
     _loadExtensions() {
         global.settings.connect(`changed::${ENABLED_EXTENSIONS_KEY}`,
             this._onEnabledExtensionsChanged.bind(this));


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