[gnome-initial-setup] Fix removal of trigger file
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] Fix removal of trigger file
- Date: Thu, 10 Jan 2013 04:43:49 +0000 (UTC)
commit 21adafed8eba39df0d53be19324663e5cf8fe526
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 9 23:42:57 2013 -0500
Fix removal of trigger file
The file is in /var/lib/gdm/, where gnome-initial-setup can't
normally remove files. Work around by using pkexec with a custom
polkit rule.
data/20-gnome-initial-setup.rules | 1 +
data/Makefile.am | 4 +++
data/org.gnome.initial-setup.policy | 22 ++++++++++++++++++++
.../pages/summary/gis-summary-page.c | 8 ++++--
4 files changed, 32 insertions(+), 3 deletions(-)
---
diff --git a/data/20-gnome-initial-setup.rules b/data/20-gnome-initial-setup.rules
index 487fc63..620e719 100644
--- a/data/20-gnome-initial-setup.rules
+++ b/data/20-gnome-initial-setup.rules
@@ -10,6 +10,7 @@ polkit.addRule(function(action, subject) {
return undefined;
var actionMatches = (action.id === 'org.freedesktop.udisks2.filesystem-mount-system' ||
+ action.id === 'org.gnome.initial-setup.remove-trigger' ||
action.id.indexOf('org.freedesktop.accounts.') === 0 ||
action.id.indexOf('org.freedesktop.timedate1.') === 0 ||
action.id.indexOf('org.freedesktop.RealtimeKit1.') === 0);
diff --git a/data/Makefile.am b/data/Makefile.am
index 4b49fbd..d694b81 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -17,6 +17,10 @@ policy_DATA = \
20-gnome-initial-setup.rules \
$(NULL)
+actiondir = $(datadir)/polkit-1/actions
+action_DATA = \
+ org.gnome.initial-setup.policy
+
sessiondir = $(datadir)/gnome-session/sessions
session_DATA = \
gnome-initial-setup.session \
diff --git a/data/org.gnome.initial-setup.policy b/data/org.gnome.initial-setup.policy
new file mode 100644
index 0000000..c46be21
--- /dev/null
+++ b/data/org.gnome.initial-setup.policy
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC
+"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+<policyconfig>
+
+ <vendor>GNOME</vendor>
+ <vendor_url>http://www.gnome.org</vendor_url>
+
+ <action id="org.gnome.initial-setup.remove-trigger">
+ <description>Remove the initial-setup trigger file</description>
+ <message>Authentication is required to remove the initial-setup trigger file</message>
+ <defaults>
+ <allow_any>no</allow_any>
+ <allow_inactive>no</allow_inactive>
+ <allow_active>auth_admin_keep</allow_active>
+ </defaults>
+ <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/rm</annotate>
+ <annotate key="org.freedesktop.policykit.exec.argv1">/var/lib/gdm/run-initial-setup</annotate>
+ <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
+ </action>
+</policyconfig>
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c b/gnome-initial-setup/pages/summary/gis-summary-page.c
index 5c21ba2..04b4c7e 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -198,9 +198,11 @@ log_user_in (GisSummaryPage *page)
static void
remove_trigger_file (GisSummaryPage *page)
{
- if (g_remove (INITIAL_SETUP_TRIGGER_FILE) < 0) {
- g_warning ("Failed to remove '" INITIAL_SETUP_TRIGGER_FILE "': %s",
- g_strerror (errno));
+ GError *error = NULL;
+ if (!g_spawn_command_line_sync ("/usr/bin/pkexec /usr/bin/rm " INITIAL_SETUP_TRIGGER_FILE, NULL, NULL, NULL, &error))
+ {
+ g_warning ("Failed to remove '" INITIAL_SETUP_TRIGGER_FILE "': %s", error->message);
+ g_error_free (error);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]