[gnome-initial-setup/mcatanzaro/resurrect-software-page: 1/4] Add polkit rule to allow executing fedora-third-party




commit cb01d1cae608189936bc8dfd041cdf835515d49d
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Thu Aug 5 14:46:49 2021 -0500

    Add polkit rule to allow executing fedora-third-party
    
    This is based on an Endless commit by Philip Chimento.
    
    Note that gnome-initial-setup will execute fedora-third-party wherever
    it is found in PATH, since there is some debugging benefit to allowing
    this, but it will require a password prompt unless it's the trusted
    version of the script installed in bindir.

 ...tial-setup.rules => 20-gnome-initial-setup.rules.in} |  6 ++++++
 data/meson.build                                        | 17 ++++++++++++-----
 meson.build                                             |  3 ++-
 3 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/data/20-gnome-initial-setup.rules b/data/20-gnome-initial-setup.rules.in
similarity index 81%
rename from data/20-gnome-initial-setup.rules
rename to data/20-gnome-initial-setup.rules.in
index 33d7e300..bff0f211 100644
--- a/data/20-gnome-initial-setup.rules
+++ b/data/20-gnome-initial-setup.rules.in
@@ -17,6 +17,12 @@ polkit.addRule(function(action, subject) {
                          action.id.indexOf('org.freedesktop.realmd.') === 0 ||
                          action.id.indexOf('com.endlessm.ParentalControls.') === 0);
 
+    // For the Software page. Feel free to add rules for your distro here.
+    if (action.id === 'org.freedesktop.policykit.exec' &&
+            action.lookup('program') === '@bindir@/fedora-third-party') {
+        actionMatches = true;
+    }
+
     if (actionMatches) {
         if (subject.local)
             return 'yes';
diff --git a/data/meson.build b/data/meson.build
index facbba96..ae8d9f95 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -59,10 +59,11 @@ i18n.merge_file(
     type: 'desktop'
 )
 
-if enable_systemd
-    unitconf = configuration_data()
-    unitconf.set('libexecdir', libexec_dir)
+data_conf = configuration_data()
+data_conf.set('bindir', bin_dir)
+data_conf.set('libexecdir', libexec_dir)
 
+if enable_systemd
     unit_files = {
         'gnome-initial-setup-first-login.service' : [ 'gnome-session.target.wants/' ],
         'gnome-initial-setup-copy-worker.service' : [ 'gnome-session.target.wants/' ],
@@ -72,7 +73,7 @@ if enable_systemd
         configure_file(
             input: unit + '.in',
             output: unit,
-            configuration: unitconf,
+            configuration: data_conf,
             install_dir: systemd_userunitdir
         )
 
@@ -102,7 +103,13 @@ endif
 
 
 rules_dir = join_paths(data_dir, 'polkit-1', 'rules.d')
-install_data('20-gnome-initial-setup.rules', install_dir: rules_dir)
+configure_file(
+    input: '20-gnome-initial-setup.rules.in',
+    output: '20-gnome-initial-setup.rules',
+    install: true,
+    install_dir: rules_dir,
+    configuration: data_conf,
+)
 
 session_dir = join_paths(data_dir, 'gnome-session', 'sessions')
 configure_file(
diff --git a/meson.build b/meson.build
index 6f129697..c31ff8dc 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,7 @@ project('gnome-initial-setup',
         ['c'],
         version: '41.beta',
         license: 'GPLv2',
-        meson_version: '>= 0.49.0',
+        meson_version: '>= 0.50.0',
 )
 
 cc = meson.get_compiler('c')
@@ -11,6 +11,7 @@ i18n = import('i18n')
 
 prefix = get_option('prefix')
 po_dir = join_paths(meson.source_root(), 'po')
+bin_dir = join_paths(prefix, get_option('bindir'))
 data_dir = join_paths(prefix, get_option('datadir'))
 locale_dir = join_paths(prefix, get_option('localedir'))
 libexec_dir = join_paths(prefix, get_option('libexecdir'))


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