Remove stub daemon code

This really shouldn't have lived so long...it does nothing now, and we
should probably just be exposing an API for packagekit anyways.
This commit is contained in:
Colin Walters 2013-07-07 18:14:53 -04:00
parent 26cef497a6
commit 53dcb3a68d
5 changed files with 0 additions and 336 deletions

View File

@ -1,28 +0,0 @@
# Makefile for C source code
#
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
#
# This library 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, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
libexec_PROGRAMS += ostreed
ostreed_SOURCES = src/daemon/ostreed.c \
src/daemon/ot-daemon.h \
src/daemon/ot-daemon.c \
$(NULL)
ostreed_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libgsystem -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/daemon -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
ostreed_LDADD = libotutil.la libostree.la $(OT_INTERNAL_GIO_UNIX_LIBS)

View File

@ -78,7 +78,6 @@ libgsystem_cflags = $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I$(srcdir)/src/libgsystem
libgsystem_libs = $(OT_INTERNAL_GIO_UNIX_LIBS) libgsystem_libs = $(OT_INTERNAL_GIO_UNIX_LIBS)
include src/libgsystem/Makefile-libgsystem.am include src/libgsystem/Makefile-libgsystem.am
noinst_LTLIBRARIES += libgsystem.la noinst_LTLIBRARIES += libgsystem.la
include Makefile-daemon.am
include Makefile-otutil.am include Makefile-otutil.am
include Makefile-libostree.am include Makefile-libostree.am
include Makefile-ostree.am include Makefile-ostree.am

View File

@ -1,72 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Colin Walters <walters@verbum.org>
*/
#include "config.h"
#include "ostree.h"
#include "ot-daemon.h"
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
static OstreeDaemonConfig config;
static GOptionEntry entries[] = {
{
"dummy-test-path", 0, 0, G_OPTION_ARG_FILENAME, &config.dummy_test_path, "Run against the given tree on the session bus", "path"},
{ NULL }
};
int
main (int argc,
char **argv)
{
OstreeDaemon *daemon = NULL;
GError *error = NULL;
GOptionContext *context = NULL;
g_type_init ();
context = g_option_context_new ("- OSTree system daemon");
g_option_context_add_main_entries (context, entries, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error))
goto out;
daemon = ostree_daemon_new ();
if (!ostree_daemon_config (daemon, &config, &error))
goto out;
g_main_loop_run (daemon->loop);
out:
ostree_daemon_free (daemon);
if (error)
{
g_printerr ("%s\n", error->message);
g_clear_error (&error);
exit (1);
}
return 0;
}

View File

@ -1,165 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Colin Walters <walters@verbum.org>
*/
#include "config.h"
#include <gio/gio.h>
#include <gio/gunixfdlist.h>
#include <string.h>
#include <stdlib.h>
#include "ostree.h"
#include "ot-daemon.h"
static GDBusNodeInfo *introspection_data = NULL;
static const gchar introspection_xml[] =
"<node>"
" <interface name='org.gnome.OSTree'>"
" </interface>"
"</node>";
static void
handle_method_call (GDBusConnection *connection,
const gchar *sender,
const gchar *object_path,
const gchar *interface_name,
const gchar *method_name,
GVariant *parameters,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
}
static const GDBusInterfaceVTable interface_vtable =
{
handle_method_call,
NULL,
NULL
};
static void
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
OstreeDaemon *self = user_data;
guint id;
self->bus = g_object_ref (connection);
if (introspection_data == NULL)
introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
id = g_dbus_connection_register_object (connection,
OSTREE_DAEMON_PATH,
introspection_data->interfaces[0],
&interface_vtable,
NULL, /* user_data */
NULL, /* user_data_free_func */
NULL); /* GError** */
g_assert (id > 0);
}
static void
on_name_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
OstreeDaemon *self = user_data;
GError *error = NULL;
GFile *repo_file = NULL;
repo_file = g_file_get_child (self->prefix, "repo");
self->repo = ostree_repo_new (repo_file);
g_clear_object (&repo_file);
if (!ostree_repo_check (self->repo, &error))
{
g_printerr ("%s\n", error->message);
g_clear_error (&error);
exit (1);
}
}
static void
on_name_lost (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
exit (1);
}
OstreeDaemon *
ostree_daemon_new (void)
{
OstreeDaemon *self = g_new0 (OstreeDaemon, 1);
self->loop = g_main_loop_new (NULL, TRUE);
self->ops = g_hash_table_new_full (g_int_hash, g_int_equal, NULL, NULL);
return self;
}
void
ostree_daemon_free (OstreeDaemon *self)
{
g_main_loop_unref (self->loop);
g_hash_table_unref (self->ops);
g_free (self);
}
gboolean
ostree_daemon_config (OstreeDaemon *self,
OstreeDaemonConfig *config,
GError **error)
{
gboolean ret = FALSE;
gboolean is_dummy = config->dummy_test_path != NULL;
if (!is_dummy)
{
if (getuid () != 0)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"This program must be run as root");
goto out;
}
}
if (is_dummy)
self->prefix = g_file_new_for_path (config->dummy_test_path);
else
self->prefix = g_file_new_for_path ("/sysroot/ostree");
self->name_id = g_bus_own_name (is_dummy ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
OSTREE_DAEMON_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
on_bus_acquired,
on_name_acquired,
on_name_lost,
self,
NULL);
ret = TRUE;
out:
return ret;
}

View File

@ -1,70 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Colin Walters <walters@verbum.org>
*/
#ifndef __OSTREE_DAEMON__
#define __OSTREE_DAEMON__
#include <gio/gio.h>
#define OSTREE_DAEMON_NAME "org.gnome.OSTree"
#define OSTREE_DAEMON_PATH "/org/gnome/OSTree"
#define OSTREE_DAEMON_IFACE "org.gnome.OSTree"
G_BEGIN_DECLS
typedef struct {
char *dummy_test_path;
} OstreeDaemonConfig;
typedef struct {
GMainLoop *loop;
GFile *prefix;
OstreeRepo *repo;
GDBusConnection *bus;
int name_id;
guint32 op_id;
GHashTable *ops;
} OstreeDaemon;
typedef struct {
guint32 id;
OstreeDaemon *daemon;
char *requestor_dbus_name;
GCancellable *cancellable;
} OstreeDaemonOperation;
OstreeDaemon *ostree_daemon_new (void);
void ostree_daemon_free (OstreeDaemon *self);
gboolean ostree_daemon_config (OstreeDaemon *self,
OstreeDaemonConfig *config,
GError **error);
G_END_DECLS
#endif