forked from Mirrors/flatpak-builder
Initial (empty) version of system helper
parent
fee5d4d169
commit
8ac40150a6
|
@ -64,6 +64,7 @@ include app/Makefile.am.inc
|
|||
include lib/Makefile.am.inc
|
||||
include builder/Makefile.am.inc
|
||||
include session-helper/Makefile.am.inc
|
||||
include system-helper/Makefile.am.inc
|
||||
include dbus-proxy/Makefile.am.inc
|
||||
include document-portal/Makefile.am.inc
|
||||
include Makefile.gtester
|
||||
|
|
|
@ -77,6 +77,15 @@ AC_ARG_WITH([systemduserunitdir],
|
|||
[with_systemduserunitdir='${prefix}/lib/systemd/user'])
|
||||
AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])
|
||||
|
||||
AC_ARG_WITH([systemdsystemunitdir],
|
||||
[AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
|
||||
[Directory for systemd system service files (default=PREFIX/lib/systemd/system)])],
|
||||
[],
|
||||
dnl This is deliberately not ${libdir}: systemd units always go in
|
||||
dnl .../lib, never .../lib64 or .../lib/x86_64-linux-gnu
|
||||
[with_systemdsystemunitdir='${prefix}/lib/systemd/system'])
|
||||
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
|
||||
|
||||
AC_ARG_WITH(system_fonts_dir,
|
||||
AS_HELP_STRING([--with-system-fonts-dir=PATH],[Directory where system fonts are, [default=/usr/share/fonts]]),
|
||||
with_system_fonts_dir="$withval", with_system_fonts_dir=/usr/share/fonts)
|
||||
|
|
|
@ -82,4 +82,10 @@
|
|||
</signal>
|
||||
</interface>
|
||||
|
||||
<interface name='org.freedesktop.XdgApp.SystemHelper'>
|
||||
<method name="Deploy">
|
||||
<arg type='ay' name='path' direction='in'/>
|
||||
</method>
|
||||
</interface>
|
||||
|
||||
</node>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
system_helper_resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/system-helper/xdg-app.gresource.xml)
|
||||
|
||||
libexec_PROGRAMS += \
|
||||
xdg-app-system-helper \
|
||||
$(NULL)
|
||||
|
||||
system-helper/xdg-app-resources.h: system-helper/xdg-app.gresource.xml
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< \
|
||||
--target=$@ --sourcedir=$(srcdir) --c-name _gtk --generate-header
|
||||
|
||||
system-helper/xdg-app-resources.c: system-helper/xdg-app.gresource.xml $(system_helper_resource_files)
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< \
|
||||
--target=$@ --sourcedir=$(srcdir) --c-name _gtk --generate-source
|
||||
|
||||
dbussystemservicedir = $(datadir)/dbus-1/system-services
|
||||
service_in_files += system-helper/org.freedesktop.XdgApp.SystemHelper.service.in
|
||||
dbussystemservice_DATA = system-helper/org.freedesktop.XdgApp.SystemHelper.service
|
||||
|
||||
dbusconfdir = ${sysconfdir}/dbus-1/system.d
|
||||
dbusconf_DATA = system-helper/org.freedesktop.XdgApp.SystemHelper.conf
|
||||
|
||||
service_in_files += system-helper/xdg-app-system-helper.service.in
|
||||
systemdsystemunit_DATA = system-helper/xdg-app-system-helper.service
|
||||
|
||||
EXTRA_DIST += system-helper/xdg-app.gresource.xml
|
||||
|
||||
xdg_app_system_helper_SOURCES = \
|
||||
system-helper/xdg-app-system-helper.c \
|
||||
system-helper/xdg-app-resources.h \
|
||||
system-helper/xdg-app-resources.c \
|
||||
$(NULL)
|
||||
|
||||
xdg_app_system_helper_LDADD = $(BASE_LIBS) libxdgapp-common.la
|
||||
xdg_app_system_helper_CFLAGS = $(BASE_CFLAGS)
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
|
||||
|
||||
<!DOCTYPE busconfig PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
|
||||
<!-- This configuration file specifies the required security policies
|
||||
for the the xdg-app system helper to work. -->
|
||||
|
||||
<policy user="root">
|
||||
<allow own="org.freedesktop.XdgApp.SystemHelper"/>
|
||||
</policy>
|
||||
|
||||
<!-- Allow anyone to call into the service - we'll reject callers using PolicyKit -->
|
||||
<policy context="default">
|
||||
<allow send_destination="org.freedesktop.XdgApp.SystemHelper"
|
||||
send_interface="org.freedesktop.XdgApp.SystemHelper"/>
|
||||
<allow send_destination="org.freedesktop.XdgApp.SystemHelper"
|
||||
send_interface="org.freedesktop.DBus.Introspectable"/>
|
||||
<allow send_destination="org.freedesktop.ColorManager"
|
||||
send_interface="org.freedesktop.DBus.Peer"/>
|
||||
</policy>
|
||||
|
||||
</busconfig>
|
|
@ -0,0 +1,4 @@
|
|||
[D-BUS Service]
|
||||
Name=org.freedesktop.XdgApp.SystemHelper
|
||||
Exec=@libexecdir@/xdg-app-system-helper
|
||||
SystemdService=xdg-app-system-helper.service
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* Copyright © 2014 Red Hat, Inc
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "xdg-app-dbus.h"
|
||||
|
||||
static GDBusNodeInfo *introspection_data = NULL;
|
||||
|
||||
void
|
||||
handle_deploy (void)
|
||||
{
|
||||
g_print ("deploy!");
|
||||
}
|
||||
|
||||
static void
|
||||
on_bus_acquired (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
XdgAppSystemHelper *helper;
|
||||
GError *error = NULL;
|
||||
|
||||
helper = xdg_app_system_helper_skeleton_new ();
|
||||
|
||||
g_signal_connect (helper, "handle-deploy", G_CALLBACK (handle_deploy), NULL);
|
||||
|
||||
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
|
||||
connection,
|
||||
"/org/freedesktop/XdgApp/SystemHelper",
|
||||
&error))
|
||||
{
|
||||
g_warning ("error: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_name_acquired (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
on_name_lost (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
exit (1);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char **argv)
|
||||
{
|
||||
guint owner_id;
|
||||
GMainLoop *loop;
|
||||
GBytes *introspection_bytes;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
g_setenv ("GIO_USE_VFS", "local", TRUE);
|
||||
|
||||
g_set_prgname (argv[0]);
|
||||
|
||||
introspection_bytes = g_resources_lookup_data ("/org/freedesktop/XdgApp/org.freedesktop.XdgApp.xml", 0, NULL);
|
||||
g_assert (introspection_bytes != NULL);
|
||||
|
||||
introspection_data = g_dbus_node_info_new_for_xml (g_bytes_get_data (introspection_bytes, NULL), NULL);
|
||||
|
||||
owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM,
|
||||
"org.freedesktop.XdgApp.SystemHelper",
|
||||
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||
on_bus_acquired,
|
||||
on_name_acquired,
|
||||
on_name_lost,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
g_main_loop_run (loop);
|
||||
|
||||
g_bus_unown_name (owner_id);
|
||||
|
||||
g_dbus_node_info_unref (introspection_data);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
[Unit]
|
||||
Description=xdg-app system helper
|
||||
|
||||
[Service]
|
||||
BusName=org.freedesktop.XdgApp.SystemHelper
|
||||
ExecStart=@libexecdir@/xdg-app-system-helper
|
||||
Type=dbus
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<gresources>
|
||||
<gresource prefix='/org/freedesktop/XdgApp'>
|
||||
<file alias="org.freedesktop.XdgApp.xml">data/org.freedesktop.XdgApp.xml</file>
|
||||
</gresource>
|
||||
</gresources>
|
Loading…
Reference in New Issue