diff options
28 files changed, 2 insertions, 830 deletions
diff --git a/Makefile-daemon.am b/Makefile-daemon.am index 3a9d7187..aab7e408 100644 --- a/Makefile-daemon.am +++ b/Makefile-daemon.am @@ -17,9 +17,7 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -if !TRIGGERS_ONLY libexec_PROGRAMS += ostreed -endif ostreed_SOURCES = src/daemon/ostreed.c \ src/daemon/ot-daemon.h \ diff --git a/Makefile-libostree.am b/Makefile-libostree.am index 21b91996..5641ae9d 100644 --- a/Makefile-libostree.am +++ b/Makefile-libostree.am @@ -17,9 +17,7 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -if !TRIGGERS_ONLY privlib_LTLIBRARIES += libostree.la -endif libostree_la_SOURCES = src/libostree/ostree.h \ src/libostree/ostree-core.c \ @@ -41,8 +39,6 @@ libostree_la_SOURCES = src/libostree/ostree.h \ src/libostree/ostree-types.h \ src/libostree/ostree-traverse.c \ src/libostree/ostree-traverse.h \ - src/libostree/ostree-sysroot.c \ - src/libostree/ostree-sysroot.h \ $(NULL) if USE_LIBARCHIVE libostree_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \ diff --git a/Makefile-ostree.am b/Makefile-ostree.am index 13f967e9..ad06c81f 100644 --- a/Makefile-ostree.am +++ b/Makefile-ostree.am @@ -17,9 +17,7 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -if !TRIGGERS_ONLY bin_PROGRAMS += ostree -endif ostree_SOURCES = src/ostree/main.c \ src/ostree/ostree-curl-fetcher.h \ @@ -59,7 +57,6 @@ ostree_SOURCES += \ src/ostree/ot-admin-builtin-os-init.c \ src/ostree/ot-admin-builtin-install.c \ src/ostree/ot-admin-builtin-status.c \ - src/ostree/ot-admin-builtin-run-triggers.c \ src/ostree/ot-admin-builtin-upgrade.c \ src/ostree/ot-admin-builtins.h \ src/ostree/ot-admin-cleanup.c \ diff --git a/Makefile-otutil.am b/Makefile-otutil.am index 8598025c..47ea98cf 100644 --- a/Makefile-otutil.am +++ b/Makefile-otutil.am @@ -17,9 +17,7 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -if !TRIGGERS_ONLY noinst_LTLIBRARIES += libotutil.la -endif libotutil_la_SOURCES = \ src/libotutil/ot-checksum-utils.c \ diff --git a/Makefile-switchroot.am b/Makefile-switchroot.am index 99301064..3dacb87a 100644 --- a/Makefile-switchroot.am +++ b/Makefile-switchroot.am @@ -15,13 +15,11 @@ # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -if !TRIGGERS_ONLY if BUILDOPT_DRACUT sbin_PROGRAMS += ostree-prepare-root sbin_PROGRAMS += ostree-remount noinst_LTLIBRARIES += libswitchroot-mountutil.la endif -endif libswitchroot_mountutil_la_SOURCES = \ src/switchroot/ostree-mount-util.c \ diff --git a/Makefile-triggers.am b/Makefile-triggers.am deleted file mode 100644 index 359d5914..00000000 --- a/Makefile-triggers.am +++ /dev/null @@ -1,41 +0,0 @@ -# Makefile for triggers -# -# 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. - -triggersdir = $(libexecdir)/ostree/triggers.d -triggers_SCRIPTS = \ - src/triggers/triggers.d/0001ldconfig.trigger \ - src/triggers/triggers.d/0005depmod.trigger \ - src/triggers/triggers.d/0010mime-database.trigger \ - src/triggers/triggers.d/0020dconf.trigger \ - src/triggers/triggers.d/0030glib.trigger \ - src/triggers/triggers.d/0040gdk-pixbuf.trigger \ - src/triggers/triggers.d/0050gconf.trigger \ - src/triggers/triggers.d/0060immodules.trigger \ - src/triggers/triggers.d/0070pango.trigger \ - src/triggers/triggers.d/0080gtk+.trigger \ - src/triggers/triggers.d/0090desktop-database.trigger \ - src/triggers/triggers.d/0100fontconfig-cache.trigger \ - $(NULL) -EXTRA_DIST += $(triggers_SCRIPTS) - -bin_PROGRAMS += ostree-run-triggers - -ostree_run_triggers_SOURCES = src/triggers/ostree-run-triggers.c -ostree_run_triggers_CFLAGS = $(OT_INTERNAL_GIO_UNIX_CFLAGS) -ostree_run_triggers_LDADD = $(OT_INTERNAL_GIO_UNIX_LIBS) diff --git a/Makefile.am b/Makefile.am index 2f1a7935..ac4bf5ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -76,16 +76,13 @@ endif libgsystem_srcpath := src/libgsystem libgsystem_cflags = $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I$(srcdir)/src/libgsystem libgsystem_libs = $(OT_INTERNAL_GIO_UNIX_LIBS) -if !TRIGGERS_ONLY include src/libgsystem/Makefile-libgsystem.am noinst_LTLIBRARIES += libgsystem.la -endif include Makefile-daemon.am include Makefile-otutil.am include Makefile-libostree.am include Makefile-ostree.am include Makefile-switchroot.am -include Makefile-triggers.am include Makefile-tests.am include Makefile-dracut.am diff --git a/configure.ac b/configure.ac index 5e822210..e10b9c05 100644 --- a/configure.ac +++ b/configure.ac @@ -31,11 +31,6 @@ LT_INIT([disable-static]) OSTREE_FEATURES="" AC_SUBST([OSTREE_FEATURES]) -AC_ARG_ENABLE(triggers-only, - AS_HELP_STRING([--enable-triggers-only], [Only build and install triggers]),, - enable_triggers_only=no) -AM_CONDITIONAL(TRIGGERS_ONLY, test x$enable_triggers_only != xno) - AC_ARG_ENABLE(installed_tests, AS_HELP_STRING([--enable-installed-tests], [Install test programs (default: no)]),, @@ -61,9 +56,6 @@ AS_IF([test x$enable_embedded_dependencies = xyes], [ AC_ARG_WITH(soup, AS_HELP_STRING([--with-soup], [Use libsoup @<:@default=yes@:>@]), [], [with_soup=check]) - if test x$enable_triggers_only != xno; then - with_soup=no - fi AS_IF([test x$with_soup != xno ], [ AC_MSG_CHECKING([for $SOUP_DEPENDENCY]) PKG_CHECK_EXISTS($SOUP_DEPENDENCY, have_soup=yes, have_soup=no) @@ -89,9 +81,6 @@ AC_ARG_ENABLE(documentation, AC_HELP_STRING([--enable-documentation], [build documentation]),, enable_documentation=yes) -if test x$enable_triggers_only != xno; then - enable_documentation=no -fi if test x$enable_documentation = xyes; then AC_PATH_PROG([XSLTPROC], [xsltproc]) if test x$XSLTPROC = x; then @@ -103,9 +92,6 @@ AM_CONDITIONAL(BUILD_DOCUMENTATION, test x$enable_documentation = xyes) AC_ARG_WITH(libarchive, AS_HELP_STRING([--without-libarchive], [Do not use libarchive]), :, with_libarchive=maybe) -if test x$enable_triggers_only != xno; then - with_libarchive=no -fi AS_IF([ test x$with_libarchive != xno ], [ AC_MSG_CHECKING([for $LIBARCHIVE_DEPENDENCY]) @@ -125,7 +111,7 @@ AS_IF([ test x$with_libarchive != xno ], [ if test x$with_libarchive != xno; then OSTREE_FEATURES="$OSTREE_FEATURES +libarchive"; fi AM_CONDITIONAL(USE_LIBARCHIVE, test $with_libarchive != no) -AS_IF([test x$cross_compiling != xyes && test -d /etc/kernel && test x$enable_triggers_only != xyes ], +AS_IF([test x$cross_compiling != xyes && test -d /etc/kernel ], [kernel_updates_default=yes], [kernel_updates_default=no]) @@ -136,7 +122,7 @@ AC_ARG_ENABLE(kernel-updates, enable_kernel_updates=${kernel_updates_default}) AM_CONDITIONAL(ENABLE_KERNEL_UPDATES, test $enable_kernel_updates != no) -AS_IF([test x$cross_compiling != xyes && test -d /etc/grub.d && test x$enable_triggers_only != xyes ], +AS_IF([test x$cross_compiling != xyes && test -d /etc/grub.d ], [grub2_hook_default=yes], [grub2_hook_default=no]) @@ -163,7 +149,6 @@ echo " =============== - triggers only: $enable_triggers_only embedded dependencies: $enable_embedded_dependencies libsoup (retrieve remote HTTP repositories): $with_soup libarchive (parse tar files directly): $with_libarchive diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c deleted file mode 100644 index 2517c551..00000000 --- a/src/libostree/ostree-sysroot.c +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2012 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 <sys/wait.h> - -#include "ostree.h" -#include "otutil.h" - -static const char * const sysroot_environ[] = { - "HOME=/", - "PWD=/", - "HOSTNAME=ostreesysroot", - "LANG=C", - "PATH=/usr/bin:/bin:/usr/sbin:/sbin", - "SHELL=/bin/bash", - "TERM=vt100", - "TMPDIR=/tmp", - "TZ=EST5EDT", - NULL -}; - -const char *const* -ostree_get_sysroot_environ (void) -{ - return (const char *const*)sysroot_environ; -} - -/** - * @root: (allow-none): Change to this root; if %NULL, don't chroot - * - * Triggers are a set of programs to run on a root to regenerate cache - * files. This API call will simply run them against the given root. - */ -gboolean -ostree_run_triggers_in_root (GFile *root, - GCancellable *cancellable, - GError **error) -{ - gboolean ret = FALSE; - int estatus; - gs_free char *rel_triggerdir = NULL; - gs_unref_object GFile *triggerdir = NULL; - gs_unref_ptrarray GPtrArray *argv = NULL; - - rel_triggerdir = g_build_filename ("usr", "libexec", "ostree", "triggers.d", NULL); - - if (root) - triggerdir = g_file_resolve_relative_path (root, rel_triggerdir); - else - triggerdir = g_file_new_for_path (rel_triggerdir); - - if (g_file_query_exists (triggerdir, cancellable)) - { - argv = g_ptr_array_new (); - if (root) - { - g_ptr_array_add (argv, "linux-user-chroot"); - g_ptr_array_add (argv, "--unshare-pid"); - g_ptr_array_add (argv, "--unshare-ipc"); - /* FIXME - unshare net too */ - g_ptr_array_add (argv, "--mount-proc"); - g_ptr_array_add (argv, "/proc"); - g_ptr_array_add (argv, "--mount-bind"); - g_ptr_array_add (argv, "/dev"); - g_ptr_array_add (argv, "/dev"); - g_ptr_array_add (argv, (char*)gs_file_get_path_cached (root)); - } - g_ptr_array_add (argv, "ostree-run-triggers"); - g_ptr_array_add (argv, NULL); - - if (!g_spawn_sync (NULL, (char**)argv->pdata, - (char**) ostree_get_sysroot_environ (), - G_SPAWN_SEARCH_PATH, - NULL, NULL, NULL, NULL, &estatus, error)) - goto out; - - if (!g_spawn_check_exit_status (estatus, error)) - goto out; - } - - ret = TRUE; - out: - return ret; -} diff --git a/src/libostree/ostree-sysroot.h b/src/libostree/ostree-sysroot.h deleted file mode 100644 index b10246df..00000000 --- a/src/libostree/ostree-sysroot.h +++ /dev/null @@ -1,39 +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_SYSROOT -#define _OSTREE_SYSROOT - -#include "ostree-core.h" -#include "ostree-types.h" - -G_BEGIN_DECLS - -const char *const* ostree_get_sysroot_environ (void); - -gboolean ostree_run_triggers_in_root (GFile *root, - GCancellable *cancellable, - GError **error); - -G_END_DECLS - -#endif diff --git a/src/libostree/ostree.h b/src/libostree/ostree.h index b5b50f3c..3734af66 100644 --- a/src/libostree/ostree.h +++ b/src/libostree/ostree.h @@ -29,7 +29,6 @@ #include <ostree-mutable-tree.h> #include <ostree-repo-file.h> #include <ostree-traverse.h> -#include <ostree-sysroot.h> #include <ostree-diff.h> #endif diff --git a/src/ostree/ot-admin-builtin-run-triggers.c b/src/ostree/ot-admin-builtin-run-triggers.c deleted file mode 100644 index 5609ee75..00000000 --- a/src/ostree/ot-admin-builtin-run-triggers.c +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2012 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 "ot-admin-builtins.h" -#include "ot-admin-functions.h" -#include "ostree.h" - -#include <unistd.h> -#include <stdlib.h> -#include <glib/gi18n.h> - -static GOptionEntry options[] = { - { NULL } -}; - -gboolean -ot_admin_builtin_run_triggers (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error) -{ - GOptionContext *context; - gboolean ret = FALSE; - gs_unref_object GFile *rootdir = NULL; - __attribute__((unused)) GCancellable *cancellable = NULL; - - context = g_option_context_new ("[ROOT] - Run triggers (regenerate caches, etc.)"); - g_option_context_add_main_entries (context, options, NULL); - - if (!g_option_context_parse (context, &argc, &argv, error)) - goto out; - - rootdir = g_file_new_for_path (argv[1]); - - if (!ostree_run_triggers_in_root (rootdir, cancellable, error)) - goto out; - - ret = TRUE; - out: - if (context) - g_option_context_free (context); - return ret; -} diff --git a/src/ostree/ot-admin-builtins.h b/src/ostree/ot-admin-builtins.h index 99240867..307e0e26 100644 --- a/src/ostree/ot-admin-builtins.h +++ b/src/ostree/ot-admin-builtins.h @@ -38,7 +38,6 @@ gboolean ot_admin_builtin_deploy (int argc, char **argv, OtAdminBuiltinOpts *adm gboolean ot_admin_builtin_prune (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error); gboolean ot_admin_builtin_status (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error); gboolean ot_admin_builtin_diff (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error); -gboolean ot_admin_builtin_run_triggers (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error); gboolean ot_admin_builtin_upgrade (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error); G_END_DECLS diff --git a/src/ostree/ot-builtin-admin.c b/src/ostree/ot-builtin-admin.c index b1dfac72..8b54f883 100644 --- a/src/ostree/ot-builtin-admin.c +++ b/src/ostree/ot-builtin-admin.c @@ -52,7 +52,6 @@ static OstreeAdminCommand admin_subcommands[] = { { "prune", ot_admin_builtin_prune }, { "status", ot_admin_builtin_status }, { "config-diff", ot_admin_builtin_diff }, - { "run-triggers", ot_admin_builtin_run_triggers }, { NULL, NULL } }; diff --git a/src/ostree/ot-builtin-checkout.c b/src/ostree/ot-builtin-checkout.c index d88e01ee..25433af1 100644 --- a/src/ostree/ot-builtin-checkout.c +++ b/src/ostree/ot-builtin-checkout.c @@ -31,7 +31,6 @@ static gboolean opt_user_mode; static gboolean opt_allow_noent; -static gboolean opt_no_triggers; static char *opt_subpath; static gboolean opt_union; static gboolean opt_from_stdin; @@ -42,7 +41,6 @@ static GOptionEntry options[] = { { "subpath", 0, 0, G_OPTION_ARG_STRING, &opt_subpath, "Checkout sub-directory PATH", "PATH" }, { "union", 0, 0, G_OPTION_ARG_NONE, &opt_union, "Keep existing directories, overwrite existing files", NULL }, { "allow-noent", 0, 0, G_OPTION_ARG_NONE, &opt_allow_noent, "Do nothing if specified path does not exist", NULL }, - { "no-triggers", 0, 0, G_OPTION_ARG_NONE, &opt_no_triggers, "Don't run triggers", NULL }, { "from-stdin", 0, 0, G_OPTION_ARG_NONE, &opt_from_stdin, "Process many checkouts from standard input", NULL }, { "from-file", 0, 0, G_OPTION_ARG_STRING, &opt_from_file, "Process many checkouts from input file", NULL }, { NULL } @@ -262,12 +260,6 @@ ostree_builtin_checkout (int argc, char **argv, GFile *repo_path, GError **error if (!process_many_checkouts (repo, checkout_target, cancellable, error)) goto out; - - if (!opt_no_triggers) - { - if (!ostree_run_triggers_in_root (checkout_target, cancellable, error)) - goto out; - } } else { @@ -286,13 +278,6 @@ ostree_builtin_checkout (int argc, char **argv, GFile *repo_path, GError **error checkout_target_tmp ? checkout_target_tmp : checkout_target, cancellable, error)) goto out; - - if (!opt_no_triggers) - { - if (!ostree_run_triggers_in_root (checkout_target_tmp ? checkout_target_tmp : checkout_target, - cancellable, error)) - goto out; - } } ret = TRUE; diff --git a/src/triggers/ostree-run-triggers.c b/src/triggers/ostree-run-triggers.c deleted file mode 100644 index 4ac1f1c9..00000000 --- a/src/triggers/ostree-run-triggers.c +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2011,2012 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 <string.h> - -static gboolean verbose; - -static GOptionEntry options[] = { - { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Display informational messages", NULL }, - { NULL } -}; - -static gboolean -run_trigger (const char *path, - GCancellable *cancellable, - GError **error) -{ - gboolean ret = FALSE; - char *basename = NULL; - GPtrArray *args = NULL; - int estatus; - - basename = g_path_get_basename (path); - - args = g_ptr_array_new (); - - g_ptr_array_add (args, (char*)path); - g_ptr_array_add (args, NULL); - - if (verbose) - g_print ("Running trigger: %s\n", path); - if (!g_spawn_sync (NULL, - (char**)args->pdata, - NULL, - 0, - NULL, NULL, NULL, NULL, - &estatus, - error)) - { - g_prefix_error (error, "Failed to run trigger %s: ", basename); - goto out; - } - - ret = TRUE; - out: - g_free (basename); - if (args) - g_ptr_array_free (args, TRUE); - return ret; -} - -static int -compare_files_by_basename (gconstpointer ap, - gconstpointer bp) -{ - GFile *a = *(GFile**)ap; - GFile *b = *(GFile**)bp; - char *name_a, *name_b; - int c; - - name_a = g_file_get_basename (a); - name_b = g_file_get_basename (b); - c = strcmp (name_a, name_b); - g_free (name_b); - g_free (name_a); - return c; -} - -static gboolean -get_sorted_triggers (GPtrArray **out_triggers, - GCancellable *cancellable, - GError **error) -{ - gboolean ret = FALSE; - GError *temp_error = NULL; - char *triggerdir_path = NULL; - GFile *triggerdir = NULL; - GFileInfo *file_info = NULL; - GFileEnumerator *enumerator = NULL; - GPtrArray *ret_triggers = NULL; - - ret_triggers = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref); - - triggerdir_path = g_build_filename (LIBEXECDIR, "ostree", "triggers.d", NULL); - triggerdir = g_file_new_for_path (triggerdir_path); - - enumerator = g_file_enumerate_children (triggerdir, "standard::name,standard::type", - G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, - cancellable, - error); - if (!enumerator) - goto out; - - while ((file_info = g_file_enumerator_next_file (enumerator, cancellable, &temp_error)) != NULL) - { - const char *name; - guint32 type; - - name = g_file_info_get_attribute_byte_string (file_info, "standard::name"); - type = g_file_info_get_attribute_uint32 (file_info, "standard::type"); - - if (type == G_FILE_TYPE_REGULAR && g_str_has_suffix (name, ".trigger")) - { - char *child_path; - GFile *child; - - child_path = g_build_filename (triggerdir_path, name, NULL); - child = g_file_new_for_path (child_path); - g_free (child_path); - - g_ptr_array_add (ret_triggers, child); - } - g_clear_object (&file_info); - } - if (file_info == NULL && temp_error != NULL) - { - g_propagate_error (error, temp_error); - goto out; - } - - g_ptr_array_sort (ret_triggers, compare_files_by_basename); - - ret = TRUE; - if (out_triggers) - { - *out_triggers = ret_triggers; - ret_triggers = NULL; - } - out: - g_free (triggerdir_path); - g_clear_object (&triggerdir); - g_clear_object (&enumerator); - if (ret_triggers) - g_ptr_array_unref (ret_triggers); - return ret; -} - -gboolean -run_triggers (GCancellable *cancellable, - GError **error) -{ - gboolean ret = FALSE; - int i; - GPtrArray *triggers = NULL; - char *path = NULL; - - if (!get_sorted_triggers (&triggers, cancellable, error)) - goto out; - - for (i = 0; i < triggers->len; i++) - { - const char *basename; - GFile *trigger_path = triggers->pdata[i]; - guint64 start_time; - guint64 end_time; - - g_free (path); - path = g_file_get_path (trigger_path); - basename = strrchr (path, '/'); - if (basename) - basename += 1; - else - basename = path; - - start_time = g_get_monotonic_time (); - g_print ("ostree-run-triggers: Starting: %s\n", basename); - if (!run_trigger (path, cancellable, error)) - goto out; - end_time = g_get_monotonic_time (); - g_print ("ostree-run-triggers: Completed %s in %.2f seconds\n", basename, - (double) (end_time - start_time) / (double)G_USEC_PER_SEC); - } - - ret = TRUE; - out: - g_free (path); - if (triggers) - g_ptr_array_unref (triggers); - return ret; -} - -int -main (int argc, - char **argv) -{ - GOptionContext *context; - GError *real_error = NULL; - GError **error = &real_error; - GCancellable *cancellable = NULL; - gboolean ret = FALSE; - - g_type_init (); - - context = g_option_context_new ("- Regenerate caches in operating system tree"); - g_option_context_add_main_entries (context, options, NULL); - - if (!g_option_context_parse (context, &argc, &argv, error)) - goto out; - - if (!run_triggers (cancellable, error)) - goto out; - - ret = TRUE; - out: - if (real_error) - g_printerr ("%s\n", real_error->message); - g_clear_error (&real_error); - if (!ret) - return 1; - return 0; -} diff --git a/src/triggers/triggers.d/0001ldconfig.trigger b/src/triggers/triggers.d/0001ldconfig.trigger deleted file mode 100755 index daed471a..00000000 --- a/src/triggers/triggers.d/0001ldconfig.trigger +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# Post-installation hook for shared libraries. -*- mode: sh -*- -# -# Written by 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. - -if test -x "$(which ldconfig 2>/dev/null)"; then - exec ldconfig -fi diff --git a/src/triggers/triggers.d/0005depmod.trigger b/src/triggers/triggers.d/0005depmod.trigger deleted file mode 100755 index fc786b28..00000000 --- a/src/triggers/triggers.d/0005depmod.trigger +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# Post-installation hook for kernel modules. -*- mode: sh -*- -# -# Written by 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. - -set -e - -if test -x "$(which depmod 2>/dev/null)"; then - for d in /usr/lib/modules/*; do - if test -d "$d"; then depmod $(basename "$d"); fi - done -fi diff --git a/src/triggers/triggers.d/0010mime-database.trigger b/src/triggers/triggers.d/0010mime-database.trigger deleted file mode 100755 index e99cf2ec..00000000 --- a/src/triggers/triggers.d/0010mime-database.trigger +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Post-installation hook for shared-mime-info. -*- mode: sh -*- -# -# Written by Matthias Clasen <mclasen@redhat.com> -# -# 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. - -if test -x "$(which update-mime-database 2>/dev/null)"; then - exec update-mime-database /usr/share/mime -fi diff --git a/src/triggers/triggers.d/0020dconf.trigger b/src/triggers/triggers.d/0020dconf.trigger deleted file mode 100755 index 620d4e0e..00000000 --- a/src/triggers/triggers.d/0020dconf.trigger +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Post-installation hook for system dconf schemas. -*- mode: sh -*- -# -# Written by 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. - -if test -x "$(which dconf 2>/dev/null)"; then - exec dconf update -fi diff --git a/src/triggers/triggers.d/0030glib.trigger b/src/triggers/triggers.d/0030glib.trigger deleted file mode 100755 index 8c8bf506..00000000 --- a/src/triggers/triggers.d/0030glib.trigger +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Post-installation hook for glib/gschema. -*- mode: sh -*- -# -# Written by 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. - -if test -x "$(which glib-compile-schemas 2>/dev/null)"; then - exec glib-compile-schemas /usr/share/glib-2.0/schemas -fi diff --git a/src/triggers/triggers.d/0040gdk-pixbuf.trigger b/src/triggers/triggers.d/0040gdk-pixbuf.trigger deleted file mode 100755 index 989d08b2..00000000 --- a/src/triggers/triggers.d/0040gdk-pixbuf.trigger +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Post-installation hook for gdk-pixbuf. -*- mode: sh -*- -# Corresponds to gdk-pixbuf/gdk-pixbuf/Makefile.am:install-data-hook -# -# Written by 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. - -if test -x "$(which gdk-pixbuf-query-loaders 2>/dev/null)"; then - exec gdk-pixbuf-query-loaders --update-cache -fi diff --git a/src/triggers/triggers.d/0050gconf.trigger b/src/triggers/triggers.d/0050gconf.trigger deleted file mode 100755 index f7a7c380..00000000 --- a/src/triggers/triggers.d/0050gconf.trigger +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# Post-installation hook for GConf. -*- mode: sh -*- -# -# Written by 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. - -if test -x "$(which gconftool-2 2>/dev/null)"; then - GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` - export GCONF_CONFIG_SOURCE - for f in /etc/gconf/schemas/*.schemas; do - # The default output is extremely chatty...redirect to - # /dev/null here until there's a way to make it quieter. - gconftool-2 --makefile-install-rule "$f" >/dev/null - done -fi diff --git a/src/triggers/triggers.d/0060immodules.trigger b/src/triggers/triggers.d/0060immodules.trigger deleted file mode 100755 index b9738eec..00000000 --- a/src/triggers/triggers.d/0060immodules.trigger +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Post-installation hook for GTK+ input method modules. -*- mode: sh -*- -# -# Written by Matthias Clasen <mclasen@redhat.com> -# -# 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. - -if test -x "$(which gtk-query-immodules-3.0 2>/dev/null)"; then - exec gtk-query-immodules-3.0 --update-cache -fi diff --git a/src/triggers/triggers.d/0070pango.trigger b/src/triggers/triggers.d/0070pango.trigger deleted file mode 100755 index 250d8960..00000000 --- a/src/triggers/triggers.d/0070pango.trigger +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# Post-installation hook for pango. -*- mode: sh -*- -# Corresponds to gdk-pixbuf/gdk-pixbuf/Makefile.am:install-data-hook -# -# Written by 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. - -if test -x "$(which pango-querymodules 2>/dev/null)"; then - # Support both old and new pango-querymodules; see - # http://git.gnome.org/browse/pango/commit/?id=9bbb992671140b840bedb4339f6c326a2ae2c072 - if ! pango-querymodules --system --update-cache; then - DEST=/etc/pango/pango.modules - pango-querymodules --system > ${DEST}.tmp && mv ${DEST}.tmp ${DEST} - fi -fi diff --git a/src/triggers/triggers.d/0080gtk+.trigger b/src/triggers/triggers.d/0080gtk+.trigger deleted file mode 100755 index 85b9e799..00000000 --- a/src/triggers/triggers.d/0080gtk+.trigger +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# Post-installation hook for gtk icon cache. -*- mode: sh -*- -# -# Written by 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. - -if test -x "$(which gtk-update-icon-cache 2>/dev/null)"; then - for dir in /usr/share/icons/*; do - if test -f $dir/index.theme; then - if ! gtk-update-icon-cache --quiet $dir; then - echo "Failed to run gtk-update-icon-cache for $dir" - exit 1 - fi - fi - done -fi diff --git a/src/triggers/triggers.d/0090desktop-database.trigger b/src/triggers/triggers.d/0090desktop-database.trigger deleted file mode 100755 index 25da1e9b..00000000 --- a/src/triggers/triggers.d/0090desktop-database.trigger +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Post-installation hook for desktop files. -*- mode: sh -*- -# -# Written by Matthias Clasen <mclasen@redhat.com> -# -# 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. - -if test -x "$(which update-desktop-database 2>/dev/null)"; then - exec update-desktop-database -q /usr/share/applications -fi diff --git a/src/triggers/triggers.d/0100fontconfig-cache.trigger b/src/triggers/triggers.d/0100fontconfig-cache.trigger deleted file mode 100755 index 3b93b8bd..00000000 --- a/src/triggers/triggers.d/0100fontconfig-cache.trigger +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Post-installation hook for the FontConfig cache -*- mode: sh -*- -# -# Written by Adrian Perez de Castro <aperez@igalia.com> -# -# 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. - -if test -x "$(which fc-cache 2>/dev/null)"; then - exec fc-cache --system-only -fi |